Hi I have a problem where in I am inserting the records in one custom object and once its successful, I want to perform update on same custom object in same execution context.

The update operation which I want to perform is by taking lookup reference from another custom object which I am receiving in form of List. So I want to iterate through that list and want to get the field information and assign that information to 1st List which I have inserted and then update it.

Both are lists. I am getting this both list from different execution so I am stuck here.

I am not sure how to perform another operation using update. I mean how to form SOQL for update operation.

Custom Object A: Field: X B - Look up Ref to another custom object Z

Custom Object B: Fields: P Q R

When I perform Insert on A, I have list which inserts the records in bulk.

After insert I have list B which is lookup ref to A which I want to assign it to A and perform update on A.

Only thing is B is list and A expect single record at a time to be saved.

Let me know if you require more info. Thank.


I think you can insert and update in a single context , i am not sure if I am able to understand the problem point. I can help you if I can see the code. Example you mentioned is very confusing

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.