Send email from workflow then wait for response

James Turney
Tera Contributor

Hello All,

 

 I'm trying to wrap my head around how to make this work and seem to keep getting stuck so I need a little help or advice.

 

I'm being asked to build out a new hardware request process due to some changes in the way we handle equipment. I have my workflow set up with an IF statement so depending on the variables selected it will either go to IT or someone at one of company locations, and sometimes it will go to both. When the request requires IT to order the equipment it generates a task BUT if it goes to one of our locations I need it to send them an email with the request information and wait for their response. This step is basically for them to check their stock onsite and if they have equipment available they will respond with something like "Have Stock" which would complete the request. If they respond with something along the lines of "No Stock" I then need it to generate a task for our IT team to order and have it sent to the location. 

 

When the employee initially fills out the request there is a variable titled "Site" that allows them to select their site location. These are all groups containing the names of individuals that have access to the stock room at these locations. In testing I managed to send an approval record to this variable by using: 

 
answer = [];
answer.push(current.variables.site_location);
 
This had the information needed and my original thoughts were they could select approve if they have equipment on hand and don't need anything ordered or decline if they needed something ordered. The business pushed back and didn't like this as they thought it could be too confusing and didn't care for the layout of the approval email(they wanted more separation of the variables). I've played around with sending a notification from the workflow which works great in being able to send to the variable "site" but I can't seem to get any variables to display in this notification. I tried having the workflow generate an event that would send an email notification using a mail script but I can't target the specific variable to send to and the mail scripts I have played with look too bunched together when the email sends and will show ALL variables from the request with a true or false. One thing I like about the approval email is it only shows the variables that are true and will omit any false variables. 
 
Once I can get sending the email worked out I then need to work out how to handle the response. My thoughts were to have an inbound action that would toggle a check box titled in stock which would drive the request to either close or send it on to the next stage but I don't know if the system automatically sends a reference with it's outbound emails so it will know WHICH request to update. 
 
I hope this makes sense, I'm completely new to a lot of this and have no solid scripting knowledge so I apologize in advance if I use incorrect or unclear terms.
1 REPLY 1

James Turney
Tera Contributor

Just as I finished typing this out I figured out how to send it to the variable so I can scrub that piece. I somehow missed using parameter 1 to attach that script. So I now need to figure out how to display the TRUE variables and then handle the response