2

I have an Autolaunched visual flow which has an insert and an update.

I can not create the opportunity in 'Closed Won' stage due to validation rules (which I don't want to udpate), thus, I need to create the opportunity in certain lower stage, and than update it.

According to documentation, a commit happens when a screen is shown or a wait element is called.

Trying to create that in a single flow, requires I will add a wait element (which invokes the commit).

My flow updates the old opportunity, and creates a duplicate of it.

  • Update old oppty
  • Create new oppty
  • Create OLI in the new oppty
  • Wait (how?)
  • update the new oppty stage to : Close won

enter image description here

After I ran the flow, I got the message:

enter image description here

My wait element: enter image description here

No Waiting conditions and/or variable assignments.

What I want is (so I thought) is that once I have the NewVarOpportunityID I can continue.

However, the opportunity is not getting updated with Close won Stage.

  • Are these specific variables that I need to wait for in my flow? All I actually need is a simple check (tried that) if the NewOpportunityID exists.

The current setting are as such:

  • Why can't you remove the wait element and do the record update in the same transaction? I don't see any reason you cant create a record and then update it later in the flow. What error do you run into? – gorav Sep 4 '16 at 12:22
  • Sf does not create the object unless the flow actually ends. Or a wait element is in place. This is according to the docs – Saariko Sep 4 '16 at 14:59
  • Ahh yes that makes sense.. Do you see a paused flow interview? It should fire within 15 mins or so. I think wait looks ok, will take a look again. An alternative would be to add a criteria to the validation rule to exempt if custom checkbox field is checked. Then you can just create closed won directly. If it's autolaunched flow, users don't need access to the field, so no risk of unauthorized use. – gorav Sep 4 '16 at 15:29
  • One other idea, could use workflow rule to update the opp stage. – gorav Sep 4 '16 at 16:49
  • @gorav I thought a commit occurred every time you reached a new Screen, too? That's caused us some issues in the past when users would cancel out of our wizard midway through, leaving data in a corrupted state. – sfdcfox Sep 4 '16 at 16:50
0

I'm not sure if either of my suggestions will work, but based on my experience with a similar problem I resolved, I'm thinking one of them might do the job for you.

First option: Replace the "Wait" element with "Record Lookup" or "Fast Lookup" to get info for the old opportunity. So you're getting fresh info about the old opportunity. Connect the new "Record Lookup" or "Fast Lookup" to your existing "Record Update" element after that (or use "Fast Update") to update the old opportunity.

Second option: configure the "Wait" element with the following settings. When looking for results after running a test, be patient: I found that there is can be some delay, perhaps around 30 seconds.

  1. Event
    • Name: Wait
    • Unique Name: Wait
    • Event Type: Alarm: Absolute Time
  2. Event Conditions
    • Field: Value
    • Base Time: {!Flow.CurrentDateTime}
  3. Waiting Conditions: leave unchecked "Wait for this event only if..."
  4. Variable Assignments: if there is any row to enter a parameter, delete it by clicking the trash can.

I hope one (or both!) of these options work for you, good luck!

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.