0

I have a nested loop iterating over EVENTWHORELATION (outer) and then into CONTACT (inner). The loop iterates each EventWhoRelationID for a match against a ContactID. I admit going over all contacts isnt very selective, but it works.

I have an additional decision filtering any matched contact and a few record variable assignments before I populate my collection variable and return to the outer loop. It then creates a few new custom records. Works real nice.

enter image description here

However, the custom record needs a text area field appended with every contact Full Name that passes the decision. I have tried six ways from Sunday to assign the current innerloop contact Name to a variable. SFDC crashes the flow, claiming "The flow failed to access the value for ContactLoop.Name because it hasn't been set or assigned"

I don't get it. The inner loop is going through a previously 'fast' get records. It should let me loop through every succerssfulk decision and grab the current contact name, append it to a text variable, so I can later use the string to populate my text field upon custom record creation.

Any ideas out there ?

0

You need to distinguish between 'Contact Loop', which is the name of the Loop element and your Loop Variable, which refers to the current contact.

call your Loop Variable something like curContact and use that in your assignment

Also, if you are expecting more than one hit, you need to have your 'matches' path return to the Contact Loop element. right now you have it returning to the outer loop, which means you're quitting after a single hit.

1
  • Thanks for trying to help Alex ! I was explicitly attempting to quit after a single hit. I expected just one per iteration. That said, once I corrected the cause of the posted problem, I found that SFDC will continue at <b> the last iteration index </b>. Apparently, Apex 'continue' is not supported. I did end pointing back to the Contact loop, but just to spend extra iterations, so the contact loop would start fresh, and not skip records. The actual issuewas a rookie mistake. I forgot the fast get was not getting all the contact fields! It was not getting 'NAME'. Jul 4 '20 at 5:57
0

The issue turned out to be quite simple; The Fast Getter for Contact was getting Contact.ID and Contact.UserID. I forgot it was not getting all fields. Hence Contact.Name was not queried, and the loop could not fetch it. The salesforce flow error collection is lazy, and this one is particularly unhelpful (as is all SFDC flow documentation).

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.