The first use case in the Ronin business scenario is project initiation and management. This page describes the relevant tasks and the operations you use in the Ronin connector and the other ESB connectors. It contains the following sections:
Overview
The flow for project initiation and management is illustrated in the following diagram. The ESB connectors for Pipedrive, Capsule CRM and Google Tasks will be used to connect to each service.
Creating projects
- Retrieve the selected won deals from the Pipedrive API using the listDeals operation in the Pipedrive API and create a project in the Ronin API using the createProject operation. Check if the related client or contact exists in the Ronin API using the listClients or listContacts operations.
- If the related client or contact does not exist, create them in the Ronin API using the createClient or the createContact operations respectively.
- Retrieve the selected won opportunities from the Capsule CRM API using the listOpportunities operation and create a project in the Ronin API using the createProject operation. Using the getParty operation, retrieve contact details from the Capsule CRM API.
- If the related client or contact does not exist, create them in the Ronin API using the createClient or the createContact operations respectively.
Ronin operations
Pipedrive operations
Capsule CRM operations
Samples
<?xml version="1.0" encoding="UTF-8"?> <!-- Ronin Business Scenario : Project Initiation and Management Retrieving selected won deals from PipeDrive API and selected won opportunities from CapsuleCRM, and create projects in Ronin API --> <proxy xmlns="http://ws.apache.org/ns/synapse" name="ronin_createProjectsFromDealsAndOpportunities" transports="https,http" statistics="disable" trace="disable" startOnLoad="true"> <target> <inSequence onError="faultHandlerSeq"> <!--Ronin Properties --> <property name="ronin.apiUrl" expression="json-eval($.ronin.apiUrl)" /> <property name="ronin.apiToken" expression="json-eval($.ronin.apiToken)" /> <!-- PipeDrive Properties --> <property name="pipedrive.apiUrl" expression="json-eval($.pipedrive.apiUrl)" /> <property name="pipedrive.apiToken" expression="json-eval($.pipedrive.apiToken)" /> <property name="pipedrive.filterId" expression="json-eval($.pipedrive.filterId)" /> <!-- CapsuleCRM properties --> <property name="capsulecrm.apiUrl" expression="json-eval($.capsulecrm.apiUrl)" /> <property name="capsulecrm.apiToken" expression="json-eval($.capsulecrm.apiToken)" /> <property name="capsulecrm.opportunityActualClosedDate" expression="json-eval($.capsulecrm.opportunityActualClosedDate)" /> <!-- Retrieving selected won deals from PipeDrive API and create Projects in Ronin API: BEGIN --> <!--Removing the Accept-Encoding Header. --> <header name="Accept-Encoding" action="remove" scope="transport" /> <!-- Calling PipeDrive listDeals method to retrieve selected won deals by filter --> <pipedrive.init> <apiUrl>{$ctx:pipedrive.apiUrl}</apiUrl> <apiToken>{$ctx:pipedrive.apiToken}</apiToken> </pipedrive.init> <pipedrive.listDeals> <filterId>{$ctx:pipedrive.filterId}</filterId> </pipedrive.listDeals> <filter source="$axis2:HTTP_SC" regex="200"> <then> <property name="data" expression="json-eval($.data)" /> <filter xpath="get-property('data')!='null'"> <then> <property name="deal.count" expression="count(//data)" scope="operation" /> </then> <else> <property name="deal.count" expression="0" scope="operation" /> </else> </filter> <property name="deal.index" expression="0" scope="operation" /> <filter xpath="get-property('operation', 'deal.count')=0"> <then> <property name="id" value="{}" /> <property name="status" value="skipped" /> <property name="message" value="No won deal(s) in PipeDrive to process." /> <call-template target="responseHandlerTemplate"> <with-param name="id" value="{$ctx:id}" /> <with-param name="activity" value="ronin_createProject" /> <with-param name="status" value="{$ctx:status}" /> <with-param name="message" value="{$ctx:message}" /> </call-template> <property name="pipeDrive.isOperationsDone" value="true" scope="operation" /> </then> <else> <!--FOR EACH deals : BEGIN --> <iterate continueParent="false" id="deals" expression="//data" sequential="true"> <target> <sequence> <property name="pipedrive.deal.id" expression="json-eval($.data.id)" /> <property name="ronin.project.name" expression="json-eval($.data.title)" /> <property name="ronin.project.description" expression="json-eval($.data.title)" /> <property name="ronin.project.rate" expression="json-eval($.data.value)" /> <property name="ronin.project.currencyCode" expression="json-eval($.data.currency)" /> <property name="pipedrive.organization" expression="json-eval($.data.org_id)" /> <property name="ronin.client.name" value="" /> <property name="ronin.client.id" value="" /> <filter xpath="get-property('pipedrive.organization')!='null'"> <then> <property name="ronin.client.name" expression="json-eval($.data.org_id.name)" /> <property name="pipedrive.orgId" expression="json-eval($.data.org_id.value)" /> <property name="common.client.id" expression="fn:concat('pipedrive_organizationId:', get-property('pipedrive.orgId'))" /> </then> <else> <property name="ronin.client.name" expression="json-eval($.data.person_id.name)" /> <property name="pipedrive.personId" expression="json-eval($.data.person_id.value)" /> <property name="common.client.id" expression="fn:concat('pipedrive_personId:', get-property('pipedrive.personId'))" /> </else> </filter> <property name="pipedrive.person" expression="json-eval($.data.person_id)" /> <property name="ronin.contact.name" value="" /> <property name="ronin.contact.email" value="" /> <filter xpath="get-property('pipedrive.person')!='null'"> <then> <property name="ronin.contact.name" expression="json-eval($.data.person_id.name)" /> <property name="ronin.contact.email" expression="json-eval($.data.person_id.email.value)" /> </then> </filter> <property name="common.contact.id" expression="fn:concat('pipedrive_contactPersonName:', get-property('ronin.contact.name'))" /> <property name="ronin.project.clientId" expression="get-property('operation','ronin.project.clientId')" /> <property name="common.id" expression="fn:concat('pipedrive_dealId:', get-property('pipedrive.deal.id'))"/> <!-- Calling createClientsContactsAndProjects sequence to create client/contact and projects in Ronin API--> <sequence key="createClientsContactsAndProjects" /> <property name="deal.index" expression="get-property('operation','deal.index') + 1" scope="operation" /> <filter xpath="get-property('operation','deal.count')=get-property('operation','deal.index')"> <then> <property name="pipeDrive.isOperationsDone" value="true" scope="operation" /> </then> </filter> </sequence> </target> </iterate> <!--FOR EACH deals : END --> </else> </filter> </then> <else> <property name="id" value="{}" /> <property name="status" value="error" /> <property name="message" expression="json-eval($.)" /> <call-template target="responseHandlerTemplate"> <with-param name="id" value="{$ctx:id}" /> <with-param name="activity" value="ronin_createProject" /> <with-param name="status" value="{$ctx:status}" /> <with-param name="message" value="{$ctx:message}" /> </call-template> <property name="pipeDrive.isOperationsDone" value="true" scope="operation" /> </else> </filter> <!-- Retrieving selected won deals from PipeDrive API and create Projects in Ronin API: END --> <filter xpath="get-property('operation','pipeDrive.isOperationsDone')='true'"> <then> <!-- Retrieving selected won opportunities from CapsuleCRM API and create Projects in Ronin API: BEGIN --> <!-- Calling CapsuleCRM listOpportunities to retrieve won opportunities --> <capsulecrm.init> <apiUrl>{$ctx:capsulecrm.apiUrl}</apiUrl> <apiToken>{$ctx:capsulecrm.apiToken}</apiToken> <format>json</format> </capsulecrm.init> <capsulecrm.listOpportunities> <milestone>won</milestone> </capsulecrm.listOpportunities> <filter source="$axis2:HTTP_SC" regex="200"> <then> <property name="capsulecrm.opportunity.count" expression="count(//opportunities/opportunity)" scope="operation" /> <property name="capsulecrm.opportunity.index" expression="0" scope="operation" /> <filter xpath="get-property('operation','capsulecrm.opportunity.count')>0"> <then> <!--FOR EACH opportunities : BEGIN --> <iterate continueParent="true" id="opportunities" expression="//opportunities/opportunity" sequential="true"> <target> <sequence> <property name="capsulecrm.opportunity.actualCloseDate" expression="json-eval($.opportunity.actualCloseDate)" /> <property name="capsulecrm.opportunity.actualCloseDate" expression="fn:substring-before(get-property('capsulecrm.opportunity.actualCloseDate'), 'T')" /> <filter xpath="get-property('capsulecrm.opportunity.actualCloseDate')=get-property('capsulecrm.opportunityActualClosedDate')"> <then> <property name="capsulecrm.opportunityId" expression="json-eval($.opportunity.id)" /> <property name="ronin.project.name" expression="json-eval($.opportunity.name)" /> <property name="ronin.project.description" expression="json-eval($.opportunity.description)" /> <property name="ronin.project.rate" expression="json-eval($.opportunity.value)" /> <property name="ronin.project.currencyCode" expression="json-eval($.opportunity.currency)" /> <property name="ronin.project.partyId" expression="json-eval($.opportunity.partyId)" /> <!-- Calling CapsuleCRM getParty method to retrieve contact details --> <capsulecrm.init> <apiUrl>{$ctx:capsulecrm.apiUrl}</apiUrl> <apiToken>{$ctx:capsulecrm.apiToken}</apiToken> <format>json</format> </capsulecrm.init> <capsulecrm.getParty> <partyId>{$ctx:ronin.project.partyId}</partyId> </capsulecrm.getParty> <property name="capsulecrm.party.organisation" expression="json-eval($.organisation)" /> <property name="capsulecrm.party.person" expression="json-eval($.person)" /> <filter source="boolean(get-property('capsulecrm.party.organisation'))" regex="true"> <then> <property name="capsulecrm.party.isOrganisation" value="true" /> </then> </filter> <filter source="boolean(get-property('capsulecrm.party.person'))" regex="true"> <then> <property name="capsulecrm.party.isPerson" value="true" /> </then> </filter> <property name="ronin.contact.name" value="" /> <property name="ronin.contact.email" value="" /> <filter xpath="get-property('capsulecrm.party.isOrganisation')='true'"> <then> <property name="ronin.client.name" expression="json-eval($.organisation.name)" /> <property name="capsulecrm.partyId" expression="json-eval($.organisation.id)" /> <property name="common.client.id" expression="fn:concat('capsulecrm_partyId:', get-property('capsulecrm.partyId'))" /> <property name="ronin.contact.name" expression="get-property('ronin.client.name')" /> <property name="ronin.contact.email" expression="json-eval($.organisation.contacts.email.emailAddress)" /> </then> </filter> <filter xpath="get-property('capsulecrm.party.isPerson')='true'"> <then> <property name="ronin.client.name" expression="json-eval($.person.organisationName)" /> <property name="capsulecrm.contact.firstName" expression="json-eval($.person.firstName)" /> <property name="capsulecrm.contact.lastName" expression="json-eval($.person.lastName)" /> <filter source="boolean(get-property('ronin.client.name'))" regex="false"> <then> <property name="ronin.client.name" expression="fn:concat(get-property('capsulecrm.contact.firstName'),' ', get-property('capsulecrm.contact.lastName'))" /> </then> </filter> <property name="capsulecrm.partyId" expression="json-eval($.person.id)" /> <property name="common.client.id" expression="fn:concat('capsulecrm_partyId:', get-property('capsulecrm.partyId'))" /> <property name="ronin.contact.name" expression="fn:concat(get-property('capsulecrm.contact.firstName'),' ', get-property('capsulecrm.contact.lastName'))" /> <property name="ronin.contact.email" expression="json-eval($.person.contacts.email.emailAddress)" /> </then> </filter> <property name="common.id" expression="fn:concat('capsulecrm_opportunityId:', get-property('capsulecrm.opportunityId'))" /> <!-- Calling createClientsContactsAndProjects sequence to create client/contact and projects in Ronin API--> <sequence key="createClientsContactsAndProjects" /> </then> </filter> <property name="capsulecrm.opportunity.index" expression="get-property('operation','capsulecrm.opportunity.index') + 1" scope="operation" /> <filter xpath="get-property('operation','capsulecrm.opportunity.count')=get-property('operation','capsulecrm.opportunity.index')"> <then> <property name="capsulecrm.isOperationsDone" value="true" scope="operation" /> </then> </filter> </sequence> </target> </iterate> <!--FOR EACH opportunities : END --> </then> <else> <property name="id" value="{}" /> <property name="status" value="skipped" /> <property name="message" value="No won opportunities(s) in CapsuleCRM to process." /> <call-template target="responseHandlerTemplate"> <with-param name="id" value="{$ctx:id}" /> <with-param name="activity" value="ronin_createProject" /> <with-param name="status" value="{$ctx:status}" /> <with-param name="message" value="{$ctx:message}" /> </call-template> <property name="capsulecrm.isOperationsDone" value="true" scope="operation" /> </else> </filter> </then> <else> <property name="id" value="{}" /> <property name="status" value="error" /> <property name="message" expression="json-eval($.)" /> <call-template target="responseHandlerTemplate"> <with-param name="id" value="{$ctx:id}" /> <with-param name="activity" value="ronin_createProject" /> <with-param name="status" value="{$ctx:status}" /> <with-param name="message" value="{$ctx:message}" /> </call-template> <property name="capsulecrm.isOperationsDone" value="true" scope="operation" /> </else> </filter> <!-- Retrieving selected won opportunities from CapsuleCRM API and create Projects in Ronin API: END --> </then> </filter> <filter xpath="get-property('operation','capsulecrm.isOperationsDone')='true'"> <then> <loopback /> </then> </filter> </inSequence> <outSequence> <payloadFactory media-type="json"> <format> { "Response":{ "process":"ronin-createProjectsFromDealsAndOpportunities", "activityResponse":[$1] } } </format> <args> <arg expression="get-property('operation','responseString')" /> </args> </payloadFactory> <property name="messageType" value="application/json" scope="axis2" /> <send /> </outSequence> </target> </proxy>
{ "ronin": { "apiUrl": "https://samliyanage.roninapp.com", "apiToken": "SlziN1JIIqUuXxAZDYNedvRw9w" }, "pipedrive": { "apiUrl": "https://api.pipedrive.com", "apiToken": "f65adc151e814c6ebf8d103573ad51a0c23740ed", "filterId": "15" }, "capsulecrm": { "apiUrl": "https://samliyanage.capsulecrm.com", "apiToken": "8f49cf0fca4f84ce45566b234a6531ae", "opportunityActualClosedDate": "2015-06-10" } }
Note
The following are the parameter descriptions:
The ID of the deal filter to retrieve won deals. To create a new deal filter, use the following conditions as the filter set:pipedrive.filterId:
- Deal status = 'Won'
- Deal won time = 'Today'
Date value for filter won opportunities, with actual closed date (The format should be yyyy-mm-dd).capsulecrm.opportunityActualClosedDate:
Creating tasks
Create project related tasks in the Ronin API using the createTask operation and if required create the same tasks in the Google Tasks API using the insertTask operation in order for contractors to follow it up easily.
Note
Contractor related tasks are identified through a flag defined in the Ronin API.
Ronin operations
Google Task operations
Samples
<?xml version="1.0" encoding="UTF-8"?> <!--Create project related tasks in Ronin api and the same task will be added to a google tasks list. --> <proxy xmlns="http://ws.apache.org/ns/synapse" name="ronin_createTasks" transports="https http" startOnLoad="true" trace="disable"> <target> <inSequence> <!-- Ronin Properties--> <property name="ronin.apiUrl" expression="json-eval($.ronin.apiUrl)" /> <property name="ronin.apiToken" expression="json-eval($.ronin.apiToken)" /> <property name="ronin.projectId" expression="json-eval($.ronin.projectId)" /> <!-- GoogleTask Properties--> <property name="googletasks.accessToken" expression="json-eval($.googletasks.accessToken)" /> <!--Common properties--> <property name="sharedTasks" expression="json-eval($.shared.taskDetails)" /> <property name="task.count" expression="count(//shared/taskDetails)" scope="operation" /> <filter xpath="get-property('operation','task.count') = 0"> <then> <property name="id" value="{}" /> <property name="status" value="Skipped" /> <property name="message" value="No task details to process." /> <call-template target="responseHandlerTemplate"> <with-param name="id" value="{$ctx:id}" /> <with-param name="activity" value="ronin_createTasks" /> <with-param name="status" value="{$ctx:status}" /> <with-param name="message" value="{$ctx:message}" /> </call-template> <loopback /> </then> <else> <property name="taskIndex" expression="0" scope="operation" /> <!--FOR EACH task : BEGIN--> <iterate continueParent="false" id="tasks" expression="//shared/taskDetails" sequential="true"> <target> <sequence> <property name="task.title" expression="//taskDetails/taskTitle/text()" /> <property name="task.description" expression="//taskDetails/taskDescription/text()" /> <property name="task.dueDate" expression="//taskDetails/dueDate/text()" /> <property name="googleTasks.taskListId" expression="//taskDetails/googleTasksTaskListId/text()" /> <!-- Call ronin connector createTask method to create a task for the given project --> <ronin.init> <apiUrl>{$ctx:ronin.apiUrl}</apiUrl> <apiToken>{$ctx:ronin.apiToken}</apiToken> </ronin.init> <ronin.createTask> <title>{$ctx:task.title}</title> <projectId>{$ctx:ronin.projectId}</projectId> <description>{$ctx:task.description}</description> <dueDate>{$ctx:task.dueDate}</dueDate> </ronin.createTask> <property name="ronin.taskId" expression="json-eval($.id)" /> <filter source="boolean(get-property('ronin.taskId'))" regex="false"> <then> <property name="id" value="{}" /> <property name="status" value="error" /> <property name="message" expression="json-eval($.)" /> </then> <else> <property name="id" expression="fn:concat('taskId:',get-property('ronin.taskId'))" /> <property name="message" value="Task has been created." /> <property name="status" value="success" /> </else> </filter> <call-template target="responseHandlerTemplate"> <with-param name="id" value="{$ctx:id}" /> <with-param name="activity" value="ronin_createTask" /> <with-param name="status" value="{$ctx:status}" /> <with-param name="message" value="{$ctx:message}" /> </call-template> <!--Remove the 'status' parameter value which appends to the payload of 'insertTask'--> <property name="status" action="remove" /> <filter source="boolean(get-property('googleTasks.taskListId'))" regex="true"> <then> <property name="googleTask.title" expression="fn:concat(get-property('task.title'),'[',get-property('ronin.taskId'),']')" /> <!-- Call googletasks connector insertTask method to create a task for the given taskList --> <googletasks.init> <accessToken>{$ctx:googletasks.accessToken}</accessToken> </googletasks.init> <googletasks.insertTask> <tasklist_id>{$ctx:googleTasks.taskListId}</tasklist_id> <title>{$ctx:googleTask.title}</title> <notes>{$ctx:task.description}</notes> <due>{$ctx:task.dueDate}</due> </googletasks.insertTask> <property name="googletask.taskId" expression="json-eval($.id)" /> <filter source="boolean(get-property('googletask.taskId'))" regex="false"> <then> <property name="id" value="{}" /> <property name="status" value="error" /> <property name="message" expression="json-eval($.)" /> </then> <else> <property name="id" expression="fn:concat('taskId:',get-property('googletask.taskId'))" /> <property name="message" value="Task has been created." /> <property name="status" value="success" /> </else> </filter> <call-template target="responseHandlerTemplate"> <with-param name="id" value="{$ctx:id}" /> <with-param name="activity" value="googletasks_createTask" /> <with-param name="status" value="{$ctx:status}" /> <with-param name="message" value="{$ctx:message}" /> </call-template> </then> </filter> <property name="taskIndex" expression="get-property('operation','taskIndex') + 1" scope="operation" /> <property name="index" expression="get-property('operation','taskIndex')" /> <filter xpath="get-property('operation','taskIndex') = get-property('operation', 'task.count')"> <then> <loopback /> </then> </filter> </sequence> </target> </iterate> <!--FOR EACH task end : END--> </else> </filter> </inSequence> <outSequence> <property name="messageType" value="application/json" scope="axis2" /> <payloadFactory media-type="json"> <format>{ "Response":{ "process":"ronin-createTasks", "activityResponse":[$1] } } </format> <args> <arg expression="get-property('operation', 'responseString')" /> </args> </payloadFactory> <send /> </outSequence> </target> <description /> </proxy>
{ "ronin": { "apiUrl": "https://sbliyanage.roninapp.com", "apiToken": "FhiKqe6sHKycv8tzxv8bRvr", "projectId":"79443" }, "googletasks": { "accessToken": "ya29.qgFZyWyz2pMVULALTq12meSpolI0Ca19EmrCDfCF6iOD9CnuQx0cKiiiBkjsWd28ohvzrPnWrAbUvw" }, "shared": { "taskDetails": [ { "taskTitle": "update ronin fiesdsdlds", "taskDescription": "ronin scenariosss", "dueDate": "2015-06-08T21:20:47Z" }, { "googleTasksTaskListId": "MTYwODI4NjYwNjk5OTYxOTkyMjA6MDow", "taskTitle": "do the report", "taskDescription": "ronin scenariosss", "dueDate": "2015-06-07T22:20:47Z" } ] } }
Note
The following are the parameter descriptions:
The Ronin project ID to which the the tasks will be created.ronin.projectId:
An array of objects with the following properties.shared.taskDetails:
List ID of the Google Tasks API. (Task will be created in Google Tasks API only if the list ID is provided.)googleTasksTaskListId:
Title of the task.taskTitle:
Description of the task.taskDescription:
dueDate:
The due date of the tasK.
Updating tasks
Retrieve updated tasks from the Google Tasks API using the listTasks operation and update the corresponding task in the Ronin API using the updateTask operation in order to synchronize the task details in both the APIs.
Ronin operations
Google Task operations
Samples
<?xml version="1.0" encoding="UTF-8"?> <!--Retrieve daily updated tasks from googleTasks API and update the relevant task in Ronin API. --> <proxy xmlns="http://ws.apache.org/ns/synapse" name="ronin_updateTasks" transports="https http" startOnLoad="true" trace="disable"> <target> <inSequence> <!-- Ronin Properties--> <property name="ronin.apiUrl" expression="json-eval($.ronin.apiUrl)" /> <property name="ronin.apiToken" expression="json-eval($.ronin.apiToken)" /> <!-- GoogleTask Properties--> <property name="googletasks.accessToken" expression="json-eval($.googletasks.accessToken)" /> <property name="googletasks.taskListId" expression="json-eval($.googletasks.taskListId)" /> <!--Get the current date mid night time to retrieve tasks updated for the current day--> <script language="js"> <![CDATA[ var currentDate=new Date(); var currentday=""+currentDate.getDate(); if(currentday.length==1){ currentday="0"+currentday; } var dateString=currentDate.getFullYear() + "-" + Number(currentDate.getMonth()+1) + "-" + currentday; var lastUpdate =dateString+"T00:00:00.000Z"; mc.setProperty('googletasks.taskUpdateMin', lastUpdate); ]]> </script> <!-- Call googletasks connector listTask method to list all tasks for the given taskList --> <googletasks.init> <accessToken>{$ctx:googletasks.accessToken}</accessToken> </googletasks.init> <googletasks.listTasks> <tasklist_id>{$ctx:googletasks.taskListId}</tasklist_id> <updatedMin>{$ctx:googletasks.taskUpdateMin}</updatedMin> </googletasks.listTasks> <property name="googletasks.taskCount" expression="count(//items)" scope="operation" /> <filter xpath="get-property('operation','googletasks.taskCount') = 0"> <then> <property name="id" value="{}" /> <property name="status" value="Skipped" /> <property name="message" value="No task details to process." /> <call-template target="responseHandlerTemplate"> <with-param name="id" value="{$ctx:id}" /> <with-param name="activity" value="googletasks_listTasks" /> <with-param name="status" value="{$ctx:status}" /> <with-param name="message" value="{$ctx:message}" /> </call-template> <loopback /> </then> <else> <property name="taskIndex" expression="0" scope="operation" /> <!--for each TASK : begin--> <iterate continueParent="false" id="tasks" expression="//items" sequential="true"> <target> <sequence> <property name="messageType" value="application/json" scope="axis2" /> <property name="googletasks.taskId" expression="json-eval($.items.id)" /> <property name="googletasks.taskTitle" expression="json-eval($.items.title)" /> <property name="googletasks.taskStatus" expression="json-eval($.items.status)" /> <property name="googletasks.taskDescription" expression="json-eval($.items.notes)" /> <property name="googletasks.taskDueDate" expression="json-eval($.items.due)" /> <switch source="get-property('googletasks.taskStatus')"> <case regex="needsAction"> <property name="ronin.taskStatus" value="false" /> </case> <case regex="completed"> <property name="ronin.taskStatus" value="true" /> </case> </switch> <script language="js"> <![CDATA[ var taskTitle = mc.getProperty('googletasks.taskTitle'); //retrieve the roninId contains in the googleTask title var matches = taskTitle.match(/\[(.*?)\]/); if (matches) { var roninId = matches[1]; mc.setProperty('ronin.taskId',roninId); } ]]></script> <filter source="boolean(get-property('ronin.taskId'))" regex="true"> <then> <!--Call ronin updateTask method to update the task associated with the googltasks task--> <ronin.init> <apiUrl>{$ctx:ronin.apiUrl}</apiUrl> <apiToken>{$ctx:ronin.apiToken}</apiToken> </ronin.init> <ronin.updateTask> <taskId>{$ctx:ronin.taskId}</taskId> <description>{$ctx:googletasks.taskDescription}</description> <dueDate>{$ctx:googletasks.taskDueDate}</dueDate> <complete>{$ctx:ronin.taskStatus}</complete> </ronin.updateTask> <property name="ronin.taskId" expression="json-eval($.id)" /> <filter source="boolean(get-property('ronin.taskId'))" regex="false"> <then> <property name="id" value="{}" /> <property name="status" value="error" /> <property name="message" expression="json-eval($.)" /> </then> <else> <property name="id" expression="fn:concat('googletasksTaskID:',get-property('googletasks.taskId'),',roninTaskId:',get-property('ronin.taskId'))" /> <property name="message" value="Task has been updated." /> <property name="status" value="success" /> </else> </filter> <call-template target="responseHandlerTemplate"> <with-param name="id" value="{$ctx:id}" /> <with-param name="activity" value="ronin_updateTask" /> <with-param name="status" value="{$ctx:status}" /> <with-param name="message" value="{$ctx:message}" /> </call-template> </then> </filter> <property name="taskIndex" expression="get-property('operation','taskIndex') + 1" scope="operation" /> <property name="index" expression="get-property('operation','taskIndex')" /> <filter xpath="get-property('operation','taskIndex') = get-property('operation', 'googletasks.taskCount')"> <then> <loopback /> </then> </filter> </sequence> </target> </iterate> <!--for each TASK : end--> </else> </filter> </inSequence> <outSequence> <property name="messageType" value="application/json" scope="axis2" /> <payloadFactory media-type="json"> <format>{ "Response":{ "process":"ronin_updateTasks", "activityResponse":[$1] } } </format> <args> <arg expression="get-property('operation', 'responseString')" /> </args> </payloadFactory> <send /> </outSequence> </target> <description /> </proxy>
{ "ronin": { "apiUrl": "https://samliyanage.roninapp.com", "apiToken": "SlziN1JIIqUuXxAZDYNedvRw9w" }, "googletasks": { "accessToken": "ya29.hwHEXBbOUKeTNR6DLaKEFG4K3WVkqKzYhPqV-Y3QkhRihVUCoTzzG9fFRakvyHnFXWZPUEdCqcmung", "taskListId":"MTYwODI4NjYwNjk5OTYxOTkyMjA6MDow" } }
Note
The following are the parameter descriptions:
Task list ID from which the tasks are retrieved.googletasks.taskListId: