For quite sometime, I have been running busy with the implementation of Vendor Master Data Governance solution using Netweaver BPM due to which I wasn't able to post new blogs. In this blog I will be focusing on a simple scenario for assigning potential owner for a task using expressions for use in real BPM scenarios. This blog is targeted for people who have just started/or want to start learning Netweaver BPM.
How it will work?
We will create an attribute of type string in our Web Dynpro Component and map it with the Process Context. This attribute will store the Unique ID of the Portal User which we will use in our expression to assign potential user for a Task/Lane. We can have the decision logic for selecting the potential owner in our web Dynpro component and this can also be fetched from any backend storage such as database table based on some dynamic conditions (i.e. Selection of a particular type of Product; we can maintain approvers for different products in a database table). I am not providing the logic for fetching the appropriate user here, but we will take a sample user approver1 for this example.
Use the below code to fetch the Unique ID of a Portal User:
public String getUniqueIdFromUserId(String strUserId) throws UMException, NullPointerException
if (strUserId == null)
throw new NullPointerException("getUniqueIdFromUserId() called with a null User Id.");
IUserFactory userFactory = UMFactory.getUserFactory();
IUser user = userFactory.getUserByUniqueName(strUserId);
if (user == null)
throw new NullPointerException("User not found in UME.");
catch (UMException e)
After getting the unique ID for the potential user, set it in the context attribute that we have created and it will be used further in our expression for potential user assignment.
Follow the below steps to assign the potential users:
1. Open the properties tab after selecting the Lane and select the Potential Users Tab and click on the Edit Button beside the expression field to open Expression Editor
2. Select the function getPrincipal(String strUniqueId) from the inbuilt functions list and pass the Context attribute where we are storing the unique Id of the portal user
3. Save the process and deploy
Note: Make sure that proper Unique ID of the user is stored in the context, otherwise tasks would not be generated without the potential approvers.