Introduction
This article explains how to pass the current date string inside the workflow while creating an alarm in cumulocity.
Prerequisites
Create a tenant in Cumulocity (https://www.softwareag.cloud/site/product/cumulocity-iot.html#/) and register a device https://www.cumulocity.com/guides/users-guide/device-management/
Create a workflow using transformer
Login to webMethods.io Integration and create a workflow named say ‘TransformerPipeline’.
Add Cumulocity your workflow by dragging it from the right canvas by typing cumulocity as below.
Click on the gear icon on top of cumulocity and select the createAlarm operation
Create a cumulocity connection by clicking on + icon in Connect to Cumulocity section.
When adding the connection, use the following information:
Account Name to: <leave default value> (i.e. Cumuocity_1)
Host (required) to: https://use.your.cumulocity.tenant.url
Username = <use the local Cumulocity user you created for the above tenant>
Password = <password for this user>
Click Add when you are done. You should see a message saying “Account saved successfully”. If you do not see this, check your connection settings and try again.
Select the above created cumulocity connection click Next.
In the left-hand transform section click on Add New…
Provide the transform name as ‘getCurrentDate’ and select ‘Get Current Date String’ from the Transform Data dropdown.
Provide the pattern as ‘YYYY-MM-DDTHH:mm:ss.SSSZ’ and say Done
In the next step map the transformer value to time and provide the device id registered in cumulocity and status, severity and type.
Click Next and Finish and save. Run the workflow.
4. Verify in Cumulocity
Login to cumulocity and cockpit and select the device and in the alarms tab it should show the alarm created above using the workflow.