Expand my Community achievements bar.

SOLVED

Custom JS Code for Custom Workflow Activity Execution (ACC)

Avatar

Level 2

Hi Team,

 

My usecase is to create a custom workflow activity which performs a specific(custom) logic for filtering multiple inbound records and generate its output.

For this, I have created a custom workflow activity and made changes in - 

1. Extended Workflow Schema (Elements and Methods changes)

2. Input Form

3. Created a Custom Library JS code containing simple business logic

 

I was wondering how can I connect/map the workflow activity execution to my custom library js code.

 

Currently, while configuring the activity, I am able to see logs in web logs as its makes a soap call on leave as mentioned in input form.

But when starting the workflow it errors out on the custom activity (no clue as of which js method is getting invoked while execution)

 

Please let me know if the flow for creating a custom workflow activity is right as mentioned above or anything else needs to be done. I have been looking for answers in the forum.

Thanks in advance!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

 

For xtk:workflow schema element:

 <element name="foo" template="xtk:workflow:activity">
  <attribute default="'/bar/foo.js'" name="library"/>
</element>

 

Create 2 functions in bar:foo.js global namespace:

  • foo_call () {} // no args, return 0 for success
  • foo_recall () {return 0} // i have no idea what this does but it's always stubbed to return 0

 

For workflow activities when starting out I've found the crm connector activity to be the most useful reference.

There is way more code than needed and it's not consistent in how it integrates with Campaign, but in total it's comprehensive.

 

Thanks,

-Jon

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

Hi,

 

For xtk:workflow schema element:

 <element name="foo" template="xtk:workflow:activity">
  <attribute default="'/bar/foo.js'" name="library"/>
</element>

 

Create 2 functions in bar:foo.js global namespace:

  • foo_call () {} // no args, return 0 for success
  • foo_recall () {return 0} // i have no idea what this does but it's always stubbed to return 0

 

For workflow activities when starting out I've found the crm connector activity to be the most useful reference.

There is way more code than needed and it's not consistent in how it integrates with Campaign, but in total it's comprehensive.

 

Thanks,

-Jon

Avatar

Level 2

Hey @Jonathon_wodnicki,
Thanks for the reply, It surely did help me.
I took reference of wkfSurvey.js and found some inbuild functions not mentioned in jsapi documentation like registerSchema, buildSQLSchema, buildColumnList etc.

I need to create a temp table (temp:custom kind) and insert data into that.
Can you please help/guide me with this process of generating the temp schema as output transition.
My output currently is in a array of objects which needs to be converted to temp table..

Avatar

Administrator

Hi @acs-ratul,

Was the given solution helpful to resolve your query or do you still need more help here? Do let us know.

Thanks!



Sukrity Wadhwa