You need to sign in to do that
Don't have an account?
How to update data from object which is not directly connected to where it needs to be updated
Hello Salesforce Ohana,
Opportunity is connected with Custom Object A and Custom B.
Custom Object A and Custom Object B are only related by Opportunity (Lookup).
There is one more Custom object C.
Custom Object C is only connected to Custom object B not directly connected with Opportunity or Custom object A.
What I am trying to achieve to is When Custom Object c records are created then one of its fields I need to pass to Custom object A record.
Suppose 3 Custom object C records created so there will be already Custom object A 3 records available where I need to pass value from Custom object C.
It doesn't matter Custom Object C 1st number record data gets attached to Custom object A 3rd number but opportunity needs to be the same as values are unique.
Any suggestions or guidance will be helpful.
Thanks in advance
Possible solution to achieve what your requirement:
- You can have a relationship betwenn object A and object C.
- You can use Soql to get data from object A. Being third level child of Opportunity. You can query the Opportunity related to Object C record. Create a Map with OppId and object C record using above query.
- Use another query to get records from object A where parent is opportunity. create another map for OppId and List of object A records.
- Using both the map you can get the matching records now.
Please mark this as best answer if this helps.Regards,
Santosh Kumar