Learning Concepts at This Skill Station:
Using the update fields step
Now that we have learned how to check an employee’s leave balance before the request is sent to a manager, let's learn how to update the accrued balance after a request is approved. Go to your Steam Definition Canvas.
(Go to Your Streams. Unlock or simply open the currently published version. Add comments for the change logs, if necessary such as, “Editing step to update the accrual balance after a request is approved.” )
Scroll down and remove the connector line between the Send Approval Email step and the End step. In the Stream Definition Canvas navigation options, click on Smart Steps. Find the Update Fields step and drag it onto the canvas under the Send Approval Email step.
In the Update Data Fields configuration popup, give it a title. Title it “Update Accrual Balance.” Since we want to update the accrual balance that is present in the Employee Record, we need to tell Pulpstream to update that specific field.
In the Field pull-down menu, select “Employee.” The Map Type will be an Expression. Since “Employee” is a Smart Object field, as soon as you select that Pulpstream will make all the fields in that object available for use in a pull-down menu underneath that. Select “Leave Accrued.”
At an earlier Skill Station, we calculated the difference between the number of days in the request and how many the employee has accrued. We need to write a new expression to update the balance after the leave request is approved. The new balance would be the current balance minus the number of days that the employee requested. Use the merge field value finder to find the Employee Leave Accrued value. Access it by clicking on the magnifying glass icon to the right of the Value/ Expression box.
Copy the merge field value.
Paste it into the expression box. Next find the Number of days requested. Put a - in between them to build an expression that looks like this: Request.Employee.Leave_Accrued - Request. Number-of-days-Requested.
When you are done your Update Data Fields configuration popup should look like this:
Save your changes.
Next, connect the Approval Email step to the new Update Accrued Balance Step. Connect the Update step to the End step. Save your process.
That’s it. You have a step to update the leave balance after a request is approved. Check in your work stream. Publish it.
To test this, you can go to the Employees Smart Object to see how many days of leave they have accrued. Go to Smart Objects Management. Click on your Employees group.
Create a request for an employee to try it out. Notate their employee number before requesting it. You’ll need that.
Try completing the request from a mobile device. Pulpstream is available on both iOS and Android. (Download the appropriate app that by clicking on the name of the operating system.)
After a manager approves the request, go back to the Employee record. You will see the leave accrued balance has been updated. This concludes our visit to this Skill Station. At the next Skill Station we will learn how to automatically notify an employee that their leave balance is expiring.