Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards

Precheck in adobe campaign classic

Avatar

Level 2

Hi team,

 

I have set up a daily trigger workflow that is intended to run only once per day. However, due to occasional manual errors, it sometimes runs twice. To prevent this, I want to implement a check that, before executing the delivery a second time, splits the transactions and notifies the user.

 

Delivery type : Action delivery (star delivery)

Delivery : New, create from aTemplate 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

2 Replies

Avatar

Community Advisor

Hello @AdobeWisdomWarrior 
Here’s a logic that could meet your need.
Before your delivery activity, insert a JavaScript activity and activate the "process errors" branch inside it:

Amine_Abedour_0-1760975638223.png


Then use the JavaScript code below:

// Build the query to select workflow tasks matching the criteria
var queryWkfTask = xtk.queryDef.create(
  <queryDef operation="select" schema="xtk:workflowTask">
    <select>
      <node expr="@id"/>
    </select>
    <where>
      <condition boolOperator="AND" expr={"@activity = '"+activity.transitions.done.target+"'"}/> // Filter by activity matching the target transition (the delivery activity in ou case)
      <condition boolOperator="AND" expr={"[@workflow-id] = "+instance.id}/> // Filter by workflow instance ID (only workflow tasks of current workflow
      <condition boolOperator="AND" expr="@creationDate &gt;= ToDate( GetDate())"/> // Filter by creation date greater than or equal to today
      <condition expr="@status = 1"/> // Filter by status done (optional)
    </where>
  </queryDef>
).ExecuteQuery();

// Count the number of <workflowTask> nodes returned by the query
var taskCount = queryWkfTask.*.length();

// If at least one task exists, log an error and activate Error transition (the one going to alert activity)
if (taskCount > 0) {
  logError("A '" + activity.transitions.done.target + "' task has already been created today.");
}

Next, in the error transition, place an alert activity.

The JavaScript code checks if a workflow task has already been created today with the same name as the target activity of the JS. If it finds at least one matching task, it logs an error message to prevent creating another one and activate the error transition instead.

Br,

 

Avatar

Level 2

Hi @Amine_Abedour ,

 

Excellent its work fine  also how i am change script  Instead of running the campaign once per day, it should be executed only once during the entire duration.