Skip to Content

In the first part of this blog series, we have deployed our first workflow to the SAP Cloud Platform.

To see the deployed workflows in your account, there is a “Monitor Workflow” app. Before you can run it, you need to add it to your Fiori launchpad.

Adding the workflow apps to your home page

Open the Portal Administration space (you can find the link on the Portal service tile) and open the “Site Directory” menu. Choose the “Default” site and click on the link to open it.

Now, click on your user menu and use the App Finder to add all three apps from the Workflow catalog to your Home Page: My Inbox, Monitor Workflows (Definitions) and Monitor Workflows (Instances).

 

Check the deployed workflow definition in the “Monitor Workflow” app

Once you’re done, go to your Home page and open the Monitor Workflows (Workflow Definitions) app.

Here, you should see your deployed Workflow. Since we deployed it for the first time, the version number is “1”. Each new deployment will increase the version number.

You can now open the running instances for this workflow (there are none yet) or start a new instance.

Typically, you would start a new workflow instance either from an UI or from an another application, via the Workflow service REST API, but the monitoring app provides an easy way to start workflows for testing purposes.

When starting a workflow, you can provide a JSON structure as input data. These JSON objects get stored within the workflow as context data. You can use them throughout the workflow e.g. in Gateways, user tasks or service tasks. Read more on how to handle workflow data here.

Since the workflow we modelled contains only a start and end event, if you start an instances it will immediately get completed and hence not be visible under “Show instances” (you can still retrieve completed instances through the REST API).

So let’s go back to the Web IDE and enhance our workflow with a user task.

Adding an user task to the workflow

In the workflow editor, select the “User Task” symbol from the palette and click on the connector between the start and the end event.

Change the name to “ApproveBook” in the properties under the “General” tab.

Now, switch to the “Display Texts” properties tab.

Here, you can define the task subject. This is the text that the user will see in his inbox.

We want to show the book name, so let’s use an expression which references a field from the sample JSON structure above (read more on how to use expressions here).

Enter “Approve ${context.product}” in the Subject field.

Move on to the “Recipients” tab to define who will receive the task.

Enter your user ID exactly as it shows up in the user info (please note that this field is case sensitive).

As a last step, switch to the “User Interface” tab.

Here, you will have to enter the application and component name of an SAPUI component, which will display the task in the inbox.

For now, let’s just enter some dummy values (test/test).

Save and deploy the workflow again and then switch back to the monitoring app. Note that the Version of your workflow definition has increased from “1” to “2”.

Start a new workflow instance

Start another workflow instance, and leave the standard JSON input as is.

When you now open the “Show Instances” view, you should see the one instance you just started:

 

The execution log shows, that there is a task waiting in the inbox.

Open the task in My Inbox

So let’s go back to the Fiori launchpad home page. As you can see, the “My Inbox” tile shows one open task.

If you open the inbox, you see the task with some header information, but without any further details or actions.

In order to actually complete the task (and thereby the workflow), you will have to build a SAPUI component as described here.

Update: Please also check out the new blog series by Archana Shukla here:
https://blogs.sap.com/2017/10/12/part-1a-build-your-custom-html5-application-in-sap-webide-for-workflow/

However, we will leave this for another blog, and end our introduction here.

Summary

You have seen how to model and deploy workflows using the SAP Web IDE, start and monitor workflow instances via the Monitor Workflow app and see user tasks in the My Inbox.

Check out the Workflow Developer Guide or explore the REST APIs in the SAP API Business Hub sandbox environment.

Share your feedback, and stay tuned for more blogs on SAP Cloud Platform Workflow!

 

To report this post you need to login first.

30 Comments

You must be Logged on to comment or reply to a post.

  1. Phil Cooley

    Thanks Christian, not sure why but I did not have a Default FLP site in my list. I did have other FLPs in my trial account but could not find any Workflow related tiles within them. Any ideas?

    Also, just to understand this, I need to build a My Inbox type of app and deploy this prior to starting this exercise – using the SAPUI components included in the Workflow sap.help instructions.

    OK…will attempt over the coming days.

     

    (0) 
    1. Dhimant Patel

      Hi Phil, looks like a little manual work is involved.  While you will see the apps, catalog, and group being shared, it does not assign any roles.  So, go to FLP Site Admin, click Content Management > Catalogs > Workflow.  In Workflow Catalog, click edit (bottom right) and click Roles button (on top), then add Everyone Role to it.  Now if you re-launch your default FLP and try adding apps, you will see Workflow catalog available with three apps.  Hope this helps.

      (1) 
    2. Christian Loos Post author

      Hi Phil,

      No, you  don’t need to build your own inbox app, you can use the standard My Inbox app.

      Just make sure to have a proper role assignment for the Workflow catalog as described by Dhimant.

      Regards,

      Christian

       

      (1) 
  2. Phil Cooley

    Doh! Thanks Dhimant – should have picked up on this! Thanks for providing this information, I can now continue on with my Part 2 of the workflow exercise.

     

    Thanks!

    Phil

    (0) 
  3. Prateek Vinod Chadha

    Thanks Christian,

     

    I was going through your tutorial. When I  go to app finder to add apps mentoned : My Inbox, Monitor Workflows (Definitions) and Monitor Workflows (Instances), I do not see any of these applications. Also in the cockpit under subscriptions I do not find above apps. How can I subscribe to these applications ?

     

    (0) 
      1. Christian Loos Post author

        Hi Prateek,

         

        Are you sure you have also deployed the workflow in this other account?

        Did you get a success message when deploying the workflow?

        Can you retrieve the definition via the REST API?

         

        Regards,

        Christian

         

        (0) 
        1. Prateek Vinod Chadha

          Hi Cristian,

           

          Thank you for your response. Unfortunately our system was down so was not able to reply you  back yesterday.

          Yes Application seems to be deployed :

          when I call the service : /workflow-service/rest/v1/workflow-definitions I get following HTML response :

           

          (0) 
  4. Manoj kumar

    Hi Christian,  in user task i have used one HTML5 application, in that I have binded data using json. but in my inbox app I am getting UI but data is not coming.

     

    (0) 
  5. Raghavendra H K

    Hi

    Actually I am doing workflow for  vendor data creation for this app multiple level of approvals are there. Can u please explain how to achieve multiple levels of approving.

     

    Best regards
    Raghavendra

    (0) 
    1. Christian Loos Post author

      Just add multiple user tasks in a sequence to the workflow.

      If the number of approval steps is dynamic (meaning it depends on the business context how many steps are necessary), just model a loop and check after each iteration whether there are additional steps required,

      (0) 
      1. Raghavendra H K

         

         

        Hi,

        Thank u , Multiple Approval is working now.

        In My Inbox ,  admin can approve or reject the request. I have one question how can he monitor or check  the approved or rejected request. In some blog they have mentioned that after genereating the IDP , It gets added in the SAP Cloud Platform Identity Authentication Administration, but I am not having sufficient privileges to access it, Is there any alternate solution to check the approved or rejected request.

        Best regards
        Raghavendra

        (0) 
        1. Christian Loos Post author

          You can check the workflow logs in the Monitor Workflows app, if the workflow instance is still running.

          Once it’s completed, currently you can only retrieve the logs via the REST API.

          (0) 
          1. Raghavendra H K

            Hi  Christian,

            Thank  u for quick response,

            Is it possible to call SCIM api while approving the task in my inbox and then getting the approved task in SAP  Cloud Platform Identity Authentication Administration console?

            Thanks & Regards,

            Raghavendra

            (0) 
            1. Christian Loos Post author

              Hi Raghavendra,

              I’m not sure I understand your question. How is your custom vendor data creation workflow related to the IAS Administration console? Do you call some IAS APIs (e.g. to create users) as part of the workflow?

              Regards,

              Christian

               

              (0) 
              1. Raghavendra H K

                Hi Christian,

                Thank u, I am really so happy the way you are helping me,

                I am not calling any IAS APIs.

                Yesterday u told to use  REST API to retrieve all workflow logs, but I am getting only one log details because there I have to mention the Workflow instanceId which is different for each logs, so I had mentioned the previous log details and I am getting the details of that previous log, but my requirement is to get the details of all the logs which admin has approved or rejected for that workflow.

                Thanks & Regards,

                Raghavendra

                (0) 
                1. Christian Loos Post author

                  Hi Raghavendra,

                  If you want to provide some “admin” dashboard to track all requests in the system and who approved which, then the most efficient way is to store this information in your own custom database table (e.g. HANA) and expose it to your UI (e.g. via XSOData and Fiori Elements).

                  In your workflow, after the approval task you can model service task. Here you can implement your own Java service, in which you can retrieve the task instances for the current workflow instance, including their status (e.g. completed) and their owners (approvers). Then you can insert this information into your database table which stores all the requests.

                  Otherwise, everytime an user opens the dashboard, you would have to loop through all workflow instances via REST API and parse the individual logs.

                  In the future, we plan to offer some configurable monitoring functionality for business users, which they can use to track requests.

                  Regards,

                  Christian

                   

                  (0) 
                  1. Raghavendra H K

                    Hi Christian,

                    Thank u,

                    Is service task is only used for business rules or we can use it for hana services also?

                    and U had given one more solution for tracking  the request, so I have called ajax method for hana services  in my html5 application,

                     

                     

                    but I could not able to post the data. I am getting following error,

                    (0) 
  6. Johannes Wienhold

    I am following the script and was able to deploy the workflow. But after deploying, the workflow monitoring app, does not show the workflow.

    When following your instructions I see the following differences. After the deployment I get a pop-up asking to deploy to Fiori Lauchpad. 

    And if I follow the “register to SAP Fiori Launchpad” I get a screen where most fields are inactive and I cannot proceed. 

    When testing the workflow in Monitoring App, I can open the app, but the workflow instance is not shown.

    Looking at the HTML5 Application created I see the workflow app, but it has no destination created.

    Can you please advise, how to proceed.

    Thanks

    Johannes

    (0) 
    1. Christian Loos Post author

      It looks like you deployed the (empty) UI5 project which contains the workflow definition.

      You only need to deploy the individual .workflow files (via the dedicated “Deploy to SAP Cloud Platform Workflow” context menu action).

      The Monitor Workflow app is a standard app which is already subscribed into your sub-account and doesn’t need to be deployed.

      You only need to add it into your FLP site.

       

      (0) 
  7. Johannes Bacher

    Hello Christian,

    thank you a lot for this blog – i could easily follow the steps. Before that, i was trying around by using only the developer documentation, but without significant success.

    Why is there not a set of sample workflows available ? that would be a good enabler.

    Thanks, Johannes

    (0) 
    1. Christian Loos Post author

      Follow the this step from my blog:

      Click on your user menu (the user icon on the top left corner in your screenshot) and use the App Finder to add all three apps from the Workflow catalog to your Home Page: My Inbox, Monitor Workflows (Definitions) and Monitor Workflows (Instances).

       

      (0) 

Leave a Reply