The first rule of any technology used in a business is that automation applied to an efficient operation will magnify the efficiency. The second is that automation applied to an inefficient operation will magnify the inefficiency.
Bill Gates
I got an interesting automation use case and thought of sharing it with you.
Usecase:
You are managing Adobe Campaign application for a multi-billion dollar company. You have noticed that a lot of operations in the campaign instance are done manually and required constant follow up with your team members. You want to create an application that will scan your Adobe Campaign instance and find out the status of all the processes (workflows) and take appropriate actions on them automatically. In case you see that a particular workflow is not running, you should be able to trigger it from your application.
Let’s look at the tools that you would need to develop this application.
The system need to run a workflow in Neolane and monitor its execution. So we need to set up an API that the system can call and retrieve its results.
The API can be command line. A Javascript program can be called from the Shell like this :
nlserver javascript <name_of_script>
In Javascript, a workflow can be started with a Javascript function
xtk.workflow.PostEvent(<name_of_workflow>, <name_of_signal_activity>)
This function is asynchronous. It will only start the workflow. To retrieve the workflow status it needs to be equipped with a Javascript loop that queries for the workflow’s state at regular intervals, using a queryDef like this:
var query = xtk.queryDef.create(
<queryDef schema="xtk:workflow" operation="get">
<select>
<node expr="@state"/>
</select>
<where>
<condition expr="@internalName = '" + workflowName + "'"/>
</where>
</queryDef>
)
return query.ExecuteQuery().@state
In you application you can add additional business logic to play with the workflows in your Adobe Campaign instance.
Hope this helps.