We have an if statement in our PO pdf template tha...
# general
l
We have an if statement in our PO pdf template that prints something something different depending on whether the PO is approved or not. I have a Send Email action on Entry of the Approved state. It is after the Set Field Value action that sets the Approval Status from Pending Approval to Approved. The PO attachment sent is the unapproved version. Maybe because the PO isn’t saved yet when the email is sent so it does not recognize the new approval status? So I created a new state called Update, and moved the Send Email action on Entry in that new state, but I still receive the unapproved PO attachment. Is there any way around it? Thanks.
m
Are you changing the custom form to get a new PDF form to send?
l
No. It's the same pdf template and custom form. Within that pdf template, there is an if statement that says, if the PO is not yet approved, show this value on the printout, otherwise show this intead.
m
Can you put your update state between approval and approved? So the user clicks "Approve" button in the approval state. Then you go to Update, where you change the status to "Approved" on update. Then do a transition to Approved and the Send email action is in the approved state?
l
That’s already the current setup except for the states. 1. Set Field Value is in the Approved state and 2. Send Email action is in the Update state. Same sequence just different states.
m
In the workflow logs for the approved state does it show the status field change?
l
yes, it is successful
m
Hmmm weird. What trigger does it say is being used? ENTRY (AFTERSUBMIT)
?
l
Here: Running ONENTRY trigger (Event: BUTTON; Context: null)
m
And your IF Statement on PDF does work correctly? Just not wihtin the context of this WF?
l
Yes. If I print a PO manually, it looks right.
m
Are the email template and print template the same on the form?
l
Yes. They are also the same as the preferred pdf template
m
It does sounds like a timing issue of when the WF is triggering actions and sending emails Maybe make a separate scheduled WF that runs independently that sends the emails every 30 min?
l
I believe so. The gap time is less than 1 second per logs. Maybe the update to the approval status isn't registered yet in the database. I'll try creating a separate workflow but I'll do it at after record submit. Maybe that would make a difference. Lol. Just wanted to avoid the delay in the email as much as possible