Expand my Community achievements bar.

SOLVED

JS code to call one workflow from another workflow

Avatar

Level 2

Hi Everyone,

I am building a connectivity between two workflows and need to call one workflow from another workflow using external signal activity.

Need small help in getting way for same.

Regards

1 Accepted Solution

Avatar

Correct answer by
Level 4

Also if you're looking to do the external signal method you originally posted about, have a look at:

https://blog.floriancourgey.com/2018/07/call-another-workflow-in-adobe-campaign 

View solution in original post

3 Replies

Avatar

Level 5

Hello @random_guy_tech ,

 

In Adobe Campaign Classic, you can use JavaScript to interact with workflows, including calling one workflow from another. The JavaScript can be used within a "JavaScript" activity or within a script within an "Execute JavaScript" activity. To trigger another workflow programmatically, you'll typically use the workflow object and its methods.

 

// Define the ID of the workflow you want to call
var targetWorkflowId = 'your_target_workflow_id';

// Load the target workflow
var targetWorkflow = xtk.workflow.load(targetWorkflowId);

// Check if the workflow was loaded successfully
if (targetWorkflow) {
// Execute the target workflow
// 'targetWorkflow.run()' will start the workflow immediately
targetWorkflow.run();

// Optionally, log the successful execution
logInfo('Workflow ' + targetWorkflowId + ' has been triggered successfully.');
} else {
// Log an error if the workflow could not be loaded
logError('Workflow ' + targetWorkflowId + ' could not be loaded.');
}

 

Explanation

  1. Define the Workflow ID:

    • Replace 'your_target_workflow_id' with the actual ID of the workflow you want to trigger.
  2. Load the Workflow:

    • Use xtk.workflow.load(targetWorkflowId) to load the workflow based on its ID.
  3. Check and Execute the Workflow:

    • Check if the workflow was loaded successfully. If so, call targetWorkflow.run() to start the workflow.
    • Use logInfo or logError for logging purposes to track the status of the workflow execution.

 

Best regards,

MEIT MEDIA (https://www.meitmedia.com)

Find us on LinkedIn

Contact Us: infomeitmedia@gmail.com

MeitMedia_0-1725346401885.png

 

Avatar

Level 2

Thanks for your help @MeitMedia .

I will review from answer and will code accordingly.

Will it possible to help on few more doubts, I posted in adobe campaign community, it will be great help.

 

Regards

 

Avatar

Correct answer by
Level 4

Also if you're looking to do the external signal method you originally posted about, have a look at:

https://blog.floriancourgey.com/2018/07/call-another-workflow-in-adobe-campaign