3

What I'm trying to do is in Flow query (Fast Lookup) a Task's TaskWhoRelation records, loop over them to build a new sobject collection of Contact records using the TaskWhoRelation.RelationId, then perform a Fast Update on the built up sobject collection of Contacts.

The part I'm stuck on is that the Assignment element does not let me set the Contact.Id field.

enter image description here

3
  • This is a bit confusing as to where you are in the flow (have you already queried for the Contacts)?
    – cropredy
    Dec 26, 2016 at 23:00
  • @cropredy, I have not queried any Contacts, only the TaskWhoRelation object. My goal is to not query Contacts since I already have the IDs from the TaskWhoRelation.RelationId field. Thanks
    – Doug Ayers
    Dec 26, 2016 at 23:04
  • 1
    sfdcfox has it pegged;
    – cropredy
    Dec 27, 2016 at 0:33

1 Answer 1

3

This is a limitation of flows. The Id field is contractually read-only, and so the Flow system won't let you assign a value to the Id field. You will need to use a Fast Lookup or Record Lookup to first query the records you want to update. Even though we wouldn't do this in plain Visualforce/Apex Code (since we already have the ID values), Flows do not allow us to simply call into existence records that are already in the database unless we query them somehow. The alternative to this, which I feel defeats the purpose of using flows, would be to create an InvocableMethod and a series of InvocableVariable declarations, and create the objects in Apex Code.

1
  • Thanks @sfdcfox, I've resorted to an invocable apex class to parse the relations and return back list of contacts.
    – Doug Ayers
    Dec 26, 2016 at 23:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .