2

I have an autolaunched flow to create a record with particular field values, unless a record with the same values already exists. This answer offers a method for interactive flows. This answer says headless flows can do the job, but doesn't explain how.

Get Records successfully finds the record if it exists, but errors out if it doesn't.

  • 2
    How are you setting up your "Get Records"? You should be able to store a null value if no records are returned and then check if that variable is null to confirm if it exists or not. – Kris Goncalves Nov 12 at 20:02
  • you can also get the count of records returned and assign that to a variable for testing > 0 – cropredy Nov 12 at 20:15
  • @KrisGoncalves thanks, using "Manually assign variables (advanced)" allows the null to be stored instead of exiting. You should post that as an answer. – Foo Bar Nov 13 at 11:58
  • @cropredy I haven't found that option. Do you know where it is? – Foo Bar Nov 13 at 11:59
  • 1
    example of equals count : jenwlee.files.wordpress.com/2018/06/flowcollectionwithcount.gif – cropredy Nov 14 at 19:05
1

https://help.salesforce.com/articleView?id=flow_ref_elements_data_get.htm&type=5

Scroll down on the get record screen and select "Manually assign variables (advanced)". There should be an option at the bottom to specify setting the variable to null when no records are returned. Now, you can add a decision to check if this variable is null.

enter image description here

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.