I have a workflow for Purchase Orders that is work...
# beginners
w
I have a workflow for Purchase Orders that is working, but if the Purchase Order is modified after being rejected, it restarts at the beginning. This is intended behavior, but the logic that assigns the Purchase Order to particular users based on the Total does not re-run. Basically I have it so that Totals up to $500 are assigned to userA, Totals up to $10,000 are assigned to userB, etc. If a user changes a Purchase Order so that the total of $500 changes to $5,000, I want that to be assigned to userB now instead of userA. How can I get the logic to re-run? I can see from Workflow History that the State where this logic exists is being initiated, but none of the logic is being applied. Any ideas?
k
Do you have criteria on those actions that is preventing it from executing them? i.e. if the user field is filled out does it skip over it?
w
The way I have it now, the
Next Approver
field is set to
null
in the first state, which that would try to re-run each time the PO was rejected, but I could see in the logs that it failed because the field was already set. I set that to conditionally run now to avoid the error. The place where the
Next Approver
is set is actually on the Entry of the next State. The next State is chosen based on several transitions that each have logic for different Totals. When I change the Total, the correct State is chosen, but the
Next Approver
field is never updated.
This is what my workflow looks like. Depending on the Total, Pending Approval - Level x is initiated.
k
I would look at the actions themselves for setting next approver.
w
There are no conditions on the actions that set the
Next Approver
field. They should run unconditionally anytime the workflow enters that state as that Action is triggered on Entry.
And it does work as intended, but only the very first time. If the PO is rejected, it won't trigger the next time it enters that state.
k
Only thing you can really do is turn on the create logs and look at it to see if there's some kind of error or something then.
make sure you show rejected actions when reviewing it
might explain why you're having the problem.
w
I have logging enabled and I've checked rejected actions, which is how I knew that there were errors on the first state when it tried to set
Next Approver
to
null
. I haven't seen any rejected actions for any of the Pending Approval states.
r
What is the error you see in the workflow logs
w
I don't see an error, that's the problem.
For anyone else that may run into this problem in the future, the problem was that I was transitioning states using a button. Once I switched that to
After Record Submit
, it worked as intended.
p
@F