Ask Search:
Karleen MendozaKarleen Mendoza 

Flow taking forward to move to next step

Testing flow in sandbox (sandbox B), get to a create step and it's taking forever to load... like it's still thinking. Anybody else experience this? When I'm testing the same flow in another sandbox (sandbox A), moves through flow just fine. Internet connection is ok.
User-added image
 
Best Answer chosen by Karleen Mendoza
Jeff MayJeff May
Perfect. Now move the screen to just before the FastCreate. If you get there, then the FastCreate is probably causing workflow rule and or Process Builders and or triggers to run.

All Answers

Jeff MayJeff May
Since your sandboxes will have different data, perhaps the Flow is in a loop looking for a record it can't find.
Karleen MendozaKarleen Mendoza
 Interesting..Seems to get stuck here. Doesn't happen in the other org and I don't have any record IDs hard-coded in.

User-added image

 
Karleen MendozaKarleen Mendoza
Looks like it's getting hung up at another part of the flow too. Again at the Fast lookup. The custom objects that its looking up are the same in both orgs. Thoughts?
Jeff MayJeff May
You need to add a Decision after the FastLookup to be sure you find a record instead of just doing the Assignment and Create.
Karleen MendozaKarleen Mendoza
Odd. Wonder why it allowed it in the previous sandbox. When doing the decision, what would the decision be? AircraftID not equal Null?
Jeff MayJeff May
It will allow it, but you have a potential crash if the FastLookup doesn't find a record and you try to use any of the fields from that sObject variable.  In the FastLookup, check the 'set variable to null if no record is found'. Then, add a Decision to be sure the sObject is not null.
Karleen MendozaKarleen Mendoza
Thanks Jeff. I added a Decision after the FastLookup like you mentioned, then I get this error:
Error element FieldnotNull (FlowDecision).
The flow couldn't find the sAircraftDetails resource.

The sAircraftDetails is the sObject that the FastLookup is looking at.
Jeff MayJeff May
Double check that is the name of the sObject variable your FastLookup is trying to set, and make sure you are setting it to null in the FastLookup if the record can't be found.
Karleen MendozaKarleen Mendoza
Did both:
User-added image
User-added image
Jeff MayJeff May
In your Decision, you are trying to get the Flow to use the Name field on the sObject. If the sObject is null, there is no Name field. Instead, select just the sObject in the Resource dropdown.
Karleen MendozaKarleen Mendoza
Hmm, ok did that. The flow moved forward, but the sObject returns as null. I set the default outcome to a random screen and it went to that random screen versus following the correct path.
Jeff MayJeff May
That means the Flow cannot find the record you are trying to Lookup. Does the record exist and does the current user have access to the record?
Karleen MendozaKarleen Mendoza
Yes, I have access. But this part of the flow is to create a new record. Here's what should happen:

User searches for Aircraft record and choices are given via Dynamic choices:
User-added image

If the Aircraft is not found, they check the box to create a new Aircraft Record. They complete the fields on the screen:
User-added image
Choose a matching Airport.
User-added image

And then when they click next - it is supposed to create that new Aircraft Record and send them to a success screen and then the flow moves forward.

However, after choosing the matching airport - that's where it gets held up.
 
Jeff MayJeff May
What is the FastLookup trying to lookup?
Karleen MendozaKarleen Mendoza
All the Aircraft fields so it can be assigned and created.
Jeff MayJeff May
So the Flow is saying that there is no existing Aircraft record that meets the filter criteria.  That means your flow will have to create the sObject then do a FastCreate.
Karleen MendozaKarleen Mendoza
But the sObject is already created? Isn't that what it's doing here? 
User-added image
Fast Lookup > Decision (sObject not Null) > Assignment > FastCreate
Jeff MayJeff May
The variable exists, but the record you are trying to load into the sObject doesn't exist so the variable is set to null.    If you want to create a new record, you have to use an Assignment element to populate all the fields in the sObject then do a FastCreate.
Karleen MendozaKarleen Mendoza
That's there too:
User-added image
Jeff MayJeff May
Where are you doing the Assignment if the FastLookup is null?
Karleen MendozaKarleen Mendoza
Here's the portion of the flow before and after the error. The arrow is where it throws the error.User-added image

If I opt not to create a new Aircraft and move forward (Decision - Aircraft Not Found=False) - it works fine.
Jeff MayJeff May
Yes. The Decision element after your FastLookup is confirming that no Aircraft record is being found. Are you expecting one? or is that a test to see if you need to create a new one or update an existing one?
Karleen MendozaKarleen Mendoza
At that point in the flow, it should take the fields populated from the Screen (Create New Aircraft) and create a new Aircraft record.

User-added image
Jeff MayJeff May
The lower left side is only being run if an Aircraft is found.  In your scenario, those Assignments and FastCreate are not being run.
Karleen MendozaKarleen Mendoza
Right, so how do I fix this? Seemed to be working ok earlier in the other Sandbox. In Sandbox B, it doesn't. I'm afraid if it's pushed to production it won't follow through.
Jeff MayJeff May
Based on the part of the flow that is having an issue, it sounds like the Aircraft record is being found in the other Sandbox. Anyway...

What is the purpose of the FastLookup of the Aircraft?  Are you expecting to find one? Or will you always be creating one?
Karleen MendozaKarleen Mendoza
Thought I had to lookup the Aircraft object in order to get the fields to assign. At this point in the flow, we'd always createa new aircraft record. Since the left portion is to basically create a new aircraft if that aircraft isn't already in the system.
Jeff MayJeff May
No, you just have to create the sObject variable, then you can set any of the fields.
Karleen MendozaKarleen Mendoza
Ok, so I deleted the FastLookup and kept the Decision element. The sObject variable for the Aircraft Details is created but th sObject is still populates null and sends me to my random "fail" screen.
Jeff MayJeff May
Without the FastLookup there is nothing to set the sObject so it will be null.  Remove the Decision, so you are just Assigning fields of the sObject from your other Flow variables and sObjects, then do a FastCreate.
Karleen MendozaKarleen Mendoza
That's what I had at the beginning of all this.. FastLookup > Assignment > FastCreate .. and that's when it took forever to load the next screen. (in this Sandbox)
Jeff MayJeff May
Right -- get rid of the FastLookup. There's no need for it.  Collect the info from the user, use an Assignment element to set sObject variable fields from the info you collected, then do a FastCreate.
Karleen MendozaKarleen Mendoza
Took out the FastLookup and it's stuck spinning again.
Jeff MayJeff May
Add a screen element that you can tie into the flow after the before the assignment element, then move it down one by one until you see which element is causing the spin. And, you can always use a Decision element to ensure your sObject variable is getting set with the values you think.
Karleen MendozaKarleen Mendoza
I've got a Decision Element now that checks whether a checkbox is checked or not on the previous screen. Looks like that's where it's causing it to spin because after I leave that page and hit Next, we're on to spinning. After I leave the "Matching Airport" screen, it's supposed to look if that checkbox is checked, if it's not - move forward and create the new Aircraft Record, if yes, move to a screen to create a new Airport record.
User-added image
User-added image
 
Jeff MayJeff May
Cool. So, add a screen after the checkbox decision to make sure you get the screen before the assignment.
Karleen MendozaKarleen Mendoza
Alright, tested the screen in between the Decision element and the Assignment. I got the screen, looks like the Assignment or the FastCreate are causing the spin.

So, the sObject for the Aircraft fields is this: 
User-added image
Assignment:
Variables are the correct sObjectUser-added image

FastCreate:
Variable is correct sObject
User-added image
Jeff MayJeff May
Perfect. Now move the screen to just before the FastCreate. If you get there, then the FastCreate is probably causing workflow rule and or Process Builders and or triggers to run.
This was selected as the best answer
Karleen MendozaKarleen Mendoza
Huh, interestingly enough, I moved it to just before the FastCreate and everything ran smoothly! Thanks for helping troubleshoot Jeff. You the man!!
Jeff MayJeff May
Phew. I thought we would be here all night. :)