Learning Concepts at This Skill Station:
Using the wait step
Updating data fields
Configuring email notifications
Video Tutorial:
We have created a digital work Stream to optimize leave of absence requests. Ops are humming! But there is an opportunity to automate a few tasks. Let's enhance our work Stream to notify employees via email that their leave days are ending and they are expected to be back at work soon.
Go to your Stream Definition Canvas.
Unlock the currently published version of your Leave of Absence stream.
We will configure our stream to send an email notification 2 days before the leave days end. We have to build a waiting period into the process. For this purpose, Pulpstream has a special step called Wait Step.
In your Stream Definition Canvas options menu, click on Smart Steps. Find the step called “Wait Step.” Grab it and drag it onto your canvas.
In the configuration popup window, the most important component of this step is to decide how long one wants to wait. In the Wait duration pull-down menu you can see that one can specify the wait period using multiple mechanisms.
A few deserve explanation:
- Use a Date Field - If there is a date field present in a data component, it can be used to specify the wait duration. For example, if we wanted to send a notification on the last day of the leave, we could use the field “End date.” But we want to wait until 2 days before the end date.
- Wait for Days using value present in a field - This is an alternative to that last scenario. Instead of using a date field, you could use a number field that contains a specific number of days.
- Wait til an incoming message arrives - This is useful when we want to wait until some other system sends us a message, telling us to proceed. For example if we are waiting for an HR system to send us a message. The message would be sent with the following call: Method PUT
-
- Content Type – application/json
- URL – {host}/vfr/api/streamRecords/{recordId}/incomingMessage/{messageCode}
- The specific message code is specified in the wait step.
The "use a date field" is our best option for our use case. X out of this wait step for now.
We need to create a date field and store a date in it, which falls 2 days before the leave end date. To do this, open the Requests Data component.
Go to the Field tab. Add a New Field. Title it: “Wait til date.” The type of information this field will contain will be a “Date.”
Save your changes to the field. Save changes to the data component.
Next let’s modify the Setup Data step to add another field. Double click it to open it.
Click the "add another field text" to create a new row. In the field pull-down menu, select “Wait til Date.” The Map Type will be an “Expression.” In the value/ expression box, we will use an expression to add -2 days to the end date to get a date value which is 2 days before the end date. We will use the addDays function. Find the request end date merge field value and insert it between the parentheses to make it a parameter of the function. (Click on the magnifying glass icon to open this feature.) Add a second parameter by placing a comma to the right of that. Then add -2 to the left of the closing parenthesis symbol to make it look like this: addDays(Request.End_Date,-2)
Save your changes.
Next let’s create a new email template that will be used to tell the employee that their leave is ending. Go to your Email Templates. Hover your mouse over the title, to reveal the new function. Click on that.
Create a personalized email template with merge field values. Make it suit your business culture. Name it “Leave Ending Notification." When you’re done, your template should look something like this:
Now that we have a “Wait til Date” field and an email template, let’s add some steps.
Remove the connector line between the Update Accrual Balance step and the End step. In your canvas navigation menu options, find the Wait Step. Drag it onto your canvas.
Configure the wait step to use our recently created date fields. Title it “Wait til 2 days before end date.” The Wait duration will be “Use a Date Field.” The Select a Date Field will be “Wait til Date.” It should look like this:
Save your changes.
Next, connect the Update Accrual balance step to the new “Wait til 2 days...” Step. (Hover your mouse over the step to reveal the connector line arrow. Drag that from the step to the other step to connect them.)
Next let’s get an email step from the Smart Steps menu and drop it onto the canvas to the left of your wait step. Title it “Send Notification to employee.” Configure it to use our recently created email template, which we called “Leave ending notification email.” The Recipient Type will be the “record submitter." Let’s send the email to the employee’s manager too. Add one more recipient. Use the option “Email Address Present in a field.” Select the Employee Smart Object. In the pull-down menu below that, find and select “Manager Email.” It should look like this:
Save the step. Back on your Stream Definition Canvas connect the wait step to the send email step. Connect the send notification email step to the end step. At this point your work stream should look like this:
That’s it. Save your changes to the process.
You are ready to test the stream. Create a leave of absence request to do this. Go to the Home page and submit a new form.
At the next and final Skill Station in this line, we will learn how to embed leave forms into your company’s intranet.