Create a Workflow Project using SAP Business Application Studio in the Cloud Foundry Environment
In this second part you’ll learn how to create a simple Workflow Project and deploy it into your SAP Cloud Platform Cloud Foundry environment, besides configuring a Mail Destination for Mail Tasks for your Workflow Projects. Find here the previous part of this blog post about enabling a Fiori Launchpad Portal with the Workflow Fiori Apps enabled.
First, in case you haven’t enabled your SAP Business Application Studio, you can enable it following this quick tutorial.
Now, let’s set up the Mail Destination. Under Connectivity on your left menu, click on Destinations and later click on New Destination:
In my case I’m using a gmail account for the SMTP protocol. If you are using gmail as well, this an example of how to fill out the parameters needed in the Destination (find here more info about the properties). If you don’t find the properties in the drop-down list, don’t worry, just copy and paste them there and save it:
Note: It is important to enable less secure apps and account access in your gmail account, in order to be able to trigger automatically Mail Tasks with SAP Cloud Platform Workflow Services.
[Update 2022: Since May 30, 2022, google has disable the “less secure apps” access option, but you can still “enable” it following Google recommendations of setting up the 2-step verification and App Password. This video tutorial from YouTube can help you to do it quickly.]
Now, let’s create the Workflow Project. Big thanks to Christian Loos for his blog, it helped me understand how to configure Workflow Projects in the Business App Studio 🙂
Create a Space in the Business Application Studio:You mainly need to enable Workflow Management, but I recommend you to enable the other ones inside the SAP Fiori as you may need them in the future:
Here you can create the project from template, but it is faster using the terminal. In the Project path, type yo and select Basic Multitarget Application:
Enter a project name. In my case I used testworkflow:
Go to the path of your project:
Type yo to create a @workflow/workflow module:
Enter a Module Name and Workflow Name, in my case I used the same testworkflow. You can leave the Workflow Description blank, click enter and type y to overwrite the mta.yaml file:
In the mta.yaml file, if you’re using your trial account, change the service-plan to lite. The workflow_mta is the Workflow Service Instance that is automatically being generated:
Go to testworkflow.workflow file and let’s do a simple exercise. By placing your mouse in the StartEvent, click on the task icon and add a Mail Task:
Select the Mail Task and go to Details at the right side. Enter your email or recipient email. Type an email subject and some text in the body of the email:
Now you need to login into your CF environment within the SAP Business Application Studio. Type in your console cf login and add the endpoint in case you don’t have it already. You can find this endpoint in your SAP Cloud Platform Cockpit (in my case is https://api.cf.us10.hana.ondemand.com). Later it will ask you about the organization and space, if you only have a trial account there will be automatically selected, if not select the ones that you want to use.
Put your credentials (email and password of your account):
Now right click on your mta.yaml file and Build your Multitarget Application:
After the Built is done. Right click on the .mta file and Deploy your Multitarget Application:
Now go to your Fiori Launchpad Portal and click on Workflow Definitions:
Select your Workflow that you just deployed. In my case testworkflow and click on Start New Instance twice (you can leave the json sample as it is for this quick exercise):
Go to Workflow Instances:
And see in the Execution Log the tasks already completed:
And finally the email generated:
In conclusion, in this blog you can review how to configure a Mail Destination using a Gmail account (and its prerequisites) and how to create and deploy a Workflow Project linked to your Fiori Launchpad Portal with all the Workflow Fiori Apps already included. I hope it will be helpful for you!
If you are interested, check out the next blog post (here) to learn how to configure a Technical Authentication to be able to trigger Workflows Instances in the Cloud Foundry through other applications 🙂
Looks familiar, thank you
Thank you !
I was trying to send email from my company id in email task . But I am getting error as "Could not send email: The server 'smtp.office365.com' could be reached, but the login with the given credentials failed. Verify that the credentials are valid for the server" I tried smtp.outlook.com as well. But still no luck.
For gmail followed steps given. And its working fine.same way any settings we need to do . Any idea. Please share.
Thanks in advance