Skip to content

Instantly share code, notes, and snippets.

@lbrenman lbrenman/Test.json Secret
Created Jun 3, 2019

Embed
What would you like to do?
Axway Integration Builder - Connector Request Triggered Flow Example (Assets)
{"id":26431,"name":"Test","userId":21107,"accountId":18281,"createdDate":"2019-05-22T21:37:14Z","steps":[{"id":169219,"onSuccess":["queryDestinationContact"],"onFailure":[],"name":"buildEmailQueryParam","type":"script","properties":{"body":"var email = trigger.request.body.properties.email;\n\nconsole.log(email);\n\n\nvar urlEncoded = encodeURIComponent(\"Email=\"+\"'\"+email+\"'\");\n\nvar encodedParam = \"where=\" + urlEncoded;\n\nconsole.log(encodedParam);\n\ndone(encodedParam);"}},{"id":168934,"onSuccess":[],"onFailure":[],"name":"consoleLog","type":"script","properties":{"body":"console.log(trigger.request.body);"}},{"id":169270,"onSuccess":["createNewContact"],"onFailure":[],"name":"constructPostBody","type":"script","properties":{"body":"var newContactSource = trigger.request.body;\n\nvar newContactDest = {\n FirstName: newContactSource.properties.firstname,\n LastName: newContactSource.properties.lastname,\n Email: newContactSource.properties.email,\n Title: newContactSource.properties.jobtitle\n \n}\n\ndone(newContactDest);"}},{"id":169269,"onSuccess":[],"onFailure":[],"name":"createNewContact","type":"elementRequest","properties":{"body":"${steps.constructPostBody}","method":"POST","elementInstanceId":"${config.sfdc}","api":"/contacts"}},{"id":169218,"onSuccess":[],"onFailure":[],"name":"invalidCreateLog","type":"script","properties":{"body":"console.log('Not a valid contact create');"}},{"id":169267,"onSuccess":["constructPostBody"],"onFailure":["notNewContact"],"name":"isNewContact","type":"filter","properties":{"body":"var obj = steps.queryDestinationContact.response.body;\nif ((obj.length === 0) || obj[0] === null) {\n done(true);\n} else {\n done(false);\n}"}},{"id":169217,"onSuccess":["buildEmailQueryParam"],"onFailure":["invalidCreateLog"],"name":"isValidCreate","type":"filter","properties":{"body":"console.log(trigger.request.body);\n\nconsole.log(trigger.response.code);\n\nconsole.log(trigger.response.body.raw.isNew);\n\nif(trigger.response.code == 200 && trigger.response.body.raw.isNew) {\n done(true); \n} else {\n done(false); \n}"}},{"id":169268,"onSuccess":[],"onFailure":[],"name":"notNewContact","type":"script","properties":{"body":"console.log(\"Contact already exists.\");"}},{"id":169220,"onSuccess":["isNewContact"],"onFailure":[],"name":"queryDestinationContact","type":"elementRequest","properties":{"method":"GET","elementInstanceId":"${config.sfdc}","api":"/contacts?${steps.buildEmailQueryParam}","query":""}}],"triggers":[{"id":23520,"onSuccess":["isValidCreate"],"onFailure":[],"type":"elementRequest","async":true,"name":"trigger","properties":{"method":"POST","elementInstanceId":"${config.hubspot}","api":"/contacts"}}],"engine":"v3","singleThreaded":false,"debugLoggingEnabled":true,"active":true,"configuration":[{"id":46463,"key":"hubspot","name":"hubspot","type":"elementInstance","required":true},{"id":46555,"key":"sfdc","name":"sfdc","type":"elementInstance","required":true}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.