6

I created two new flows using some features in the new and improved Lightning Flow tool.

One of them uses the new Scheduled start - which lets you select a group of records to start with and run some logic against them. Works great, passed UAT, time to move between sandboxes to run the next level of testing.

Every time I had any reference to the $Record that Salesforce uses to reference the records queried in the Start element, I hit the following error during deployment:"This flow can't reference $Record because its trigger type is null. Change the trigger type, change the flow global variable, or remove the flow global variable from this flow."

I'm not sure how exactly to interpret that at all - only the third option, to remove any and all reference to the $Record global variable seems to have worked.

Has anyone else run into this problem that knows what this error means or how to resolve?

Similarly, I tried to take advantage of the fact that Salesforce now automatically creates a variable for you to store records you find in a Get Records step in my other flow, and referenced those variables. Once again, the logic worked fine and even my complex logic flow passed UAT. When it came time to migrate though, I kept getting "Because the queriedFields field is set, you also need to set the following fields: sObjectOutputReference." Manually setting all the variables rather than using the ones created automatically seemed to resolve this.

Any advice there?

To sum up, I'm looking for any advice or documentation around the new Flow features recently released.

--November 12 '19 update

Update for anyone who hits this error: the "This flow can't reference $Record because its trigger type is null. Change the trigger type, change the flow global variable, or remove the flow global variable from this flow." error comes when you don't have a Start time set up but are referring to $Record. You can see this error if you take a Scheduled flow that makes use of the reference to $Record, and attempt to change it to an auto-launched flow.

In my case, we were seeing these errors because we were using the Copado deployment tool, and that tool wasn't using the new Start metadata. We were able to fix the error by deploying using ANT and making sure to grab the Start/Flowstart metadata mentioned here as part of the deployment package. https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_visual_workflow.htm

2
  • I've grabbed the start metadata succesfully but when I try to deploy i receive the following error: "Property 'start' not valid in version 46.0" even if I deploy with "sfdx force:source:deploy --sourcepath .\force-app\main\default\ --apiversion 47.0" option (using the salesforce dx terminal). How did you deploy? Dec 6, 2019 at 9:00
  • 1
    Sounds like somehow Salesforce isn't accepting the 47. I haven't deployed using the dx terminal, only ANT or change sets, and I wasn't the one pushing the deployment with Copado here. My bet is there's someplace else you're specifying the API version. Maybe the dx tool itself needs to be updated? Dec 7, 2019 at 13:23

2 Answers 2

1

Turns out if I make the flow inactive, then deploying the package, the error went away. (this is from SFDC support)

0

I used ver 50 with flow deactivated and no reference to the ver # in the manifest.

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.