CLAIMATE

Technical blog

SAP Build Process Automation: Direct Task Links in Email Notifications

Created by Midjourney

Patrik Majer

19. 2. 2025

Automation

Business Value of Direct Task Links in Email Notifications 

In SAP Build Process Automation, workflow tasks often require approvals. When a task is created, we send an email notification to the approver with a general link to the My Inbox app. The challenge arises when the approver must manually search for the specific task within My Inbox. This can be time-consuming and inefficient, especially in environments where multiple tasks are pending approval. 

By enhancing the workflow to include a direct link to the exact task, we improve efficiency, reduce errors, and enhance the user experience. Instead of searching for the task, the approver can directly access it, leading to faster decision-making and improved process automation. 

Understanding the Problem 

By default, you are not able to send email notifications with direct links to specific tasks in My Inbox.

The reason is simple:  

If you attempt to send the email before task creation, there is no task ID available. If you try sending it after task creation, the process waits for the task outcome (approve/reject), and only then can the email be sent—defeating the purpose of notifying the approver in advance. 

Solution Overview 

To overcome this limitation, we use a Timer Event in SAP Build Process Automation that triggers upon task creation. This allows us to: 

  1. Create the Task – Define the approval task in the process. 

  2. Trigger the Timer Event – This event fires when the task is created. 

  3. Retrieve Task Instance ID – Call the Workflow API to fetch the latest task instance ID. 

  4. Store the Task Link – Use a Script Task to generate a direct link to My Inbox with the task ID. 

  5. Send the Email Notification – Include the direct task link in the email for immediate access. 

Implementation 

Step 1: Create a Process with an Approval Task 

  • In SAP Build Process Automation, define a new process. 

  • Add an approval task and configure the required approver. 

Step 2: Add a Timer Event After Task Creation 

  • Insert a Timer Intermediate Event that triggers immediately after the task creation. 

  • This ensures we wait until the task exists before retrieving its instance ID. 

Obsah obrázku text, software, Počítačová ikona, Webová stránka

Obsah vygenerovaný umělou inteligencí může být nesprávný.

Step 3: Retrieve Task Instance ID Using Workflow API 

  • We are not able to call Action in Event Handling. Therefor I have created a new Process that will call the Action

  • Use an Action Step to call the SAP Workflow API

  • The API request should retrieve the latest task instance ID associated with the workflow instance. (We have to order the instances by Creation Date, Top 1 and obviously Workflow Instance ID) 

Step 4: Store the Task Link in a Variable 

Insert a Script Task to generate the task URL dynamically: 

var workzoneURL = "https://{yourBTPsubdomain}.launchpad.cfapps.eu10.hana.ondemand.com/site/{name of your site}";
var taskInstanceId = $.context.action_get_getV1TaskInstances_1.result.responseArray[0].id; 
var workzoneURLtask = workzoneURL + "#WorkflowTask-DisplayMyInbox&/detail/NA/" + taskInstanceId + "/TaskCollection(SAP__Origin='NA',InstanceID='" + taskInstanceId + "')" 
$.context.custom.linktotask = workzoneURLtask;

Step 5: Send Email Notification with Direct Task Link 

Unfortunately we are not able to set a link as a variable in the SAP Build Process Automation editor when creating a Mail Task. Therefor we need to create a simple Workflow in Business Application Studio just for the HTML Mail Task 

  • Modify the Email Notification Step to include the dynamic link. 

Conclusion 

With this enhancement, approvers can now access their tasks directly from the email notification, eliminating unnecessary manual searches. This improves efficiency, enhances user experience, and accelerates the approval process in SAP Build Process Automation.  

Navigace

© 2023 CLAIMATE

Navigace

© 2023 CLAIMATE