11

I have a flow where I've looked up and looped through service contracts and looked up and looped through contract line items storing sobject variables which I've placed into a collection. I then create opportunities with the info I have from service contracts.

I have 2 questions:

  1. I want to check if the way I'm getting the newly created oppty ids is the only way or if I'm missing something. I do a fast lookup on opptys looking for an id I save on the opptys as I create them. I then loop thru the collection and save the ids as sobject variables which I add to a collection.

  2. Is is possible to add a sobject variable to a collection and later in the flow add more data to the same sobject variable and then add that data to the same collection without overwriting the variables gathered?

In my case, I use the same collection to collect the newly created oppty ids and to which also had other sobject variables added but when I attempt to fast create the oppty line items it does not work, stating that info I verified with screens earlier is not present

Hope that makes sense! Top half of the flow

Second half of the flow

  • Are you able to provide a screenshot of your flow? – Alex Tennant Sep 11 '14 at 8:19
  • @AlexTennant I've just added screenshots – Marchandoj Sep 11 '14 at 11:13
  • If you add the additional data later, you're doing an update, not a create. That may be the source of the problem you're having. If you're trying to reuse your code, you'd be overwriting what's already there rather than adding to it via say an upsert. – crmprogdev Sep 13 '14 at 14:50
  • Were you able to find an answer to this? – Willem Mulder Nov 22 '16 at 10:56
  • @willem Mulder see below, just posted an answer – gorav Jan 13 '17 at 12:58
1

Once you insert a sObject collection, you should be able to access the record IDs in the collection itself.

To demonstrate, add a screen element and display the sObject collection that you just inserted. You will see a list of opp IDs.

Screenshots below for a sample flow that creates two account sObject variables, adds them to a collection, and inserts the collection. You can see that prior to the insert, if you display the sObject collection, it just shows a commma. After the insert, you see the two IDs.

Flow

flow overview

sObject collection before insert

soc before insert

sObject collection after insert

soc after insert

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.