on a purchase order transaction i have a super sim...
# suiteflow
m
on a purchase order transaction i have a super simple workflow button to email the transaction (the primary goal being i want any user to submit a PO to a supplier to send from the exact same name every time, e.g. “Bob’s Warehouse” not “John Smith” (per their user account.) anyway, it works however the workflow remains in the active status. how do I force it to end?
state 1 adds the button on view/update before record load and state 2 sends the email on entry
j
You could consider doing something like: 1. in your 'send email' state, also add a custom field (checkbox) 'email sent'. 2. create new action within same state to check that new checkbox 3. create new 'exit' state and transition to it on the condition of the new checkbox being checked. Honestly not sure if that's the most efficient way to force the workflow to exit but it works!
n
It might be that workflow is restarting when the record reload after the sand. You could include that checkbox in your criteria so that it won’t load if the checkboxes already checked.
j
Good call, that would be cleaner
m
thanks! i’ll give that a go. i still want users to have the ability to see and click the button even if they have sent the PO via this method once before. would that affect anything?
j
That would not work with this proposed method. In that case, why not just leave the workflow as is?
m
what i’m finding is that when the workflow remains active, the my custom button does not appear on the PO. when i cancel the workflow manually it appears again
j
Hmm, that shouldn't be the case with the workflow setup the way you described. Do you have any workflow initiation criteria that you didn't mention or perhaps some other state? I just created a simple test workflow following your initial details and, as NS Tragic thought, it seems to exit after sending the email and then re-initiate when the record reloads, putting it back into the 'add button' state. You may have something extra in there either preventing it from exiting after email send or preventing it from re-initiating back into the 'add button' state
Alternatively, you could add a loop to intentionally keep it in the workflow but send it back to the 'add button' state, like this. I have it transition to the 'still open' state if status != closed. Then it transitions back up to 'add button' afterward
m
i think with some tweaking i’ve got it going. i think it was my trigger points. having said that, the workflow remains active but still seems to do what i want
State 2 is just fire off the email
though i’m going to add your still open state. cheers!
j
If you look at workflow history you should technically see that it exits and re-enters the workflow, but no matter if it works. Cheers
m
good stuff. one last question for ya’ll: i have built in a confirmation (“are you sure you want to email?“) and it appears only when the purchase order is in edit mode. any ideas on how it can also appear when in view mode?