Technical Articles
Setting up task delegation for SAP Cloud Platform Workflow
Introduction
SAP Cloud Platform Workflow (part of SAP Cloud Platform Workflow Management) now supports automatic task delegation, based on user-defined rules.
In this blog, I’ll show how this works.
Pre-requisites
I assume you have already set up Workflow, the SAP Business Application Studio and a Fiori Launchpad site in your Cloud Foundry account on SAP Cloud Platform, and have some workflows with user tasks available.
If not, you can follow the tutorial here.
Enabling the substitution feature in My Inbox
As first step, we have to enable the substitution UI for the My Inbox tile in the Fiori Launchpad.
For this, open the project which contains the Fiori Launchpad module in SAP Business Application Studio, which contains the My Inbox tile description.
Note: You can also import the project from Github. It already has all the necessary changes, so afterr build and deployment you can directly jump to the next section (Create Substitution Rule).
Under the portal-site/business-apps folder, create a new file called “inbox.json” with the following content:
{
"_version":"3.0",
"identification":{
"id":"cross.fnd.fiori.inbox",
"entityType":"businessapp"
},
"payload":{
"visualizations":{
"WorkflowTask-MyInboxWithSubstitution":{
"vizType":"sap.ushell.DynamicAppLauncher",
"vizConfig":{
"sap.app":{
"title":"My Inbox",
"description":"Manage my tasks",
"tags":{
}
},
"sap.flp":{
"target":{
"inboundId":"WorkflowTask-DisplayMyInbox",
"parameters":{
"substitution":{
"value":{
"value":"true",
"format":"plain"
}
},
"userSearch":{
"value":{
"value":"false",
"format":"plain"
}
}
}
}
}
}
}
}
}
}
Now, open the CommonDataModel.json in the portal-site folder in the Code editor, and search for the My Inbox tile definition (“cross.fnd.fiori.inbox”).
Replace the value of “vizId” attribute with the id used in the inbox.json above: “WorkflowTask-MyInboxWithSubstitution”. Make sure to leave the rest of the code as is.
"viz": [{
"id": "cross.fnd.fiori.inbox-0-1568986171400",
"appId": "cross.fnd.fiori.inbox",
"vizId": "WorkflowTask-MyInboxWithSubstitution"
}, {
As final step, build and deploy the MTA project.
Create substitution rule
Open the Fiori Launchpad URL. You can find it by navigating from the sub-account in your Cloud Cockpit: Cloud Foundry -> Spaces -> [your space] -> WorkflowManagementFLP_appRouter -> Application Routes
From the home page, open the My Inbox tile. Make sure you have some tasks assigned to your user.
While in the My Inbox app, open the user menu from the Fiori Shell (top right corner), and select “Manage My Substitutes”.
There are two different types of substitution rules: Planned and Unplanned.
- Planned substitution is set for a specific time span between two dates (start and end). During this time span, tasks are automatically available to the substitute.
Use this for planned absences. - Unplanned substitution is for unplanned absences, e.g. sick leave. Here, you do not select a start and end date. The substitute can activate and deactivate the substitution at any time to start taking over tasks. This is done via the “Substitute For” entry in the user menu above.
Let’s create a new planned substitution rule.
Switch to the “Planned” tab, and click on the “Add New Substitute” button in the lower right corner.
Enter the user ID (e.g. email address) of the user who shall be the substitute, and define a time period by just selecting a start and end date.
After saving, the rule should now be visible in the list:
If you set the start date to today, the rule becomes immediately active. Otherwise, it will show as inactive, and only get activated on the start date.
The substitute user should now see the tasks of the user who created the rule.
More information
There are a few important things to note about the substitution functionality:
- Substitution rules only work for tasks, which have been assigned to individual users.
For tasks, which have been assigned to groups, substitution is not possible.
In this case, you can simply add additional users to the group. - Substitution only works one level deep (i.e. rules are not transitive). Let’s say user B substitutes user A, and user C substitutes user B (A -> B -> C).
B will see the tasks of A, but C will only see tasks of B. - Substitution rule events are logged in the Audit Log, which can be accessed by account administrators.
- Substitution is only available in the Cloud Foundry environment, not in the Neo environment.
You can find further information also in the documentation.
Thank you for the info, that substitution is finally available in CF environment.
It perfectly works when I use that in local portal site - created through mta application.
But when I put that configuration (parameters) to the portal site it doesnt show up.
Dont you know how can I make it functional in portal site?
Hi Vladimir,
I assume you are referring to a site built using SAP Cloud Platform Portal Site/Content Manager?
How exactly did you integrate the My Inbox app there?
Regards,
Christian
Hello Christian Loos ,
yes, I meant site using content manager
Here is configuration of application to integrate my inbox.
Semantic object and tcmURL parameter to redirect api calls.
and on visualisation tab i entered parameters for subtitution and userSearch
Hi Vladimir,
I'm currently trying to re-produce this but struggle with integrating the My Inbox app into Portal.
If you can share some documentation / how-to on how to set up the content provider and make the tile appear in the site, it would be appreciated.
You could also try to create a support ticket on the Portal component to see if they can help.
Regards,
Christian
Hello Christian Loos ,
you dont need to setup content provider. I added my inbox as a manual integration - look at the blog series of Murali Shanmugham - here .
For actual values for my inbox application, you can use screenshots from my previous comment.
I've finally managed to integrate My Inbox into a Portal site - I was struggling with the cross-origin policy.
Thanks to your blog I finally solved it!
The substitution parameter also doesn't work for me - neither under "navigation" nor when I put it under Configuration.
I will ask the Portal colleagues for support and report back with the answer.
Nice to hear, that you cracked it finally 🙂
It would be also perfect if you will share, what you will find out regarding that missing substitution on portal site.
The reason the substitution menu is not shown is because the My Inbox app is embedded via an iFrame into the Portal site. Therefore, the commands to add the menu items are not reaching the FLP shell.
We are working on a deeper integration into the Launchpad which (hopefully) will address these issues.
Thank you Christian for the explanation.
So I suppose, that right now there is not a way how to push that info down to that iFrame - some workaround.
EDIT: but in fact I found one (workaround). I defined my inbox into service flp (in mtar) and in SaaS portal site I defined the URL tile, where I call that mtar portal app with my inbox. That way I can manage roles for that tile (wont be possible in mtar FLP) and have substitution available. Not the prettiest solution, but it works for me.
But anyway - is there some estimation, when the standard substitution functionality will be available on saas portal site ?
Not sure I understand your workaround - I also did the same:
Still, the substitution menu is not shown in the Portal Site shell bar (outer FLP).
Are you using another approach?
If you have FLP module (with My inbox tile) in your mtar, then open that FLP and My inbox in it. Copy the URL. The url should consist of
approuter URL
+
/cp.portal/site#WorkflowTask-DisplayMyInbox?sap-ui-app-id-hint=cross.fnd.fiori.inbox&substitution=true&userSearch=false&/detail/NA/<someid>/TaskCollection(SAP__Origin=’NA’,InstanceID='<instanceID>’)
And put that URL into SaaS portal app tile – see picture. Also set app to open in new tab and uncheck “add intent and default SAP parameters to URL”
That should open My Inbox but from your portal from MTAR – so in fact you are opening portal app (mtar) from another portal (SaaS portal).
I dont know if its clear how it is done – if not, I will write whole blog post about that workaround – step by step. It would be interesting for more people – probably.
EDIT: In fact I made that blog. I also mentioned you and this blog post of you - so I hope that you don`t mind that.
Got it working - thanks for sharing.
It also works in-place instead of new tab, but then it looks strange with the two shell bars.
On additional hint: You can remove the "/detail..." part from the URL. Otherwise, if you have complete this particular task instance, My Inbox would show an error.
We currently plan to have the improved integration ready in Q1/2021.
Thanks for info and also for that future bugfix - it will make lives of SCP architects and developers easier 😉
And regarding that tip - yes I didnt realized, that this detail part is just for that exact task.
Christian
Hello, Is there a standard way to report on substitution delegation in SCP workflows without a lot of customization? We need to know the substitute information when the workflow is running so that we can update the same in the transaction in S4 & C4.
Hi Nakul,
can you specify in which point in time and in which API you need this information included?
Thanks.
Best regards,
Krassimir Kondarev
BTP Workflow service
Hi! Is it possible to add some other validations for substitutions - e.g. check that user is valid, that it has appropriate authorizations in the system?
And also you mention that it doesn't work for groups and that user can simply be added to this group, but if the task is already available for that group adding user wont solve the delegation, right? Let's assume we have group task, but that this particular group contains only one user, who is on unplanned leave - is there a way to use substitutions to redirect this task?
Thank you
Shan.
Dear Christian Loos
thanks for that interesting post. Has the issue mentioned by
Hi Christian Loos,
Thankyou for your Blog.
Is it possible to add some validations for substitutions like Email Id Exists in BTP or not?
Is it possible to send email notification to the substitute when an actual user has planned/unplanned absences.