JS code to call one workflow from another workflow | Community
Skip to main content
Level 2
September 3, 2024
Solved

JS code to call one workflow from another workflow

  • September 3, 2024
  • 1 reply
  • 1384 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by ALangridge

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 

1 reply

MeitMedia
Level 4
September 3, 2024

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

 

Level 2
September 3, 2024

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

 

ALangridge
ALangridgeAccepted solution
Level 4
September 5, 2024

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