Hi!
I am doing a campaign and i have 2 workflows. I want to exclude in the second workflow the recipients that have been contacted in the first workflow.
I know i need to call the internal name of workflow 1 and i know i need javascript for create the event variable. But i dont know how to do it.
Could you guys help me on that?
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @Javi_Landa ,
Firstly you need to define 2 Variables in the Campaign Workflow properties Tab as shown below
Then, please use the below JS Code to fetch the Internal name in the Java script activity of the Workflow
var query = xtk.queryDef.create(<queryDef schema="nms:operation" operation="select"><select><node expr="@id"/><node expr="@internalName"/>
</select>
<where><condition expr={"@id = '"+instance.operation_id+"'"}/></where>
</queryDef>);
var eventExistss = query.ExecuteQuery();
for each (var eventT in eventExistss.operation)
{
instance.vars.CampaignInternalName = eventT.@internalName;
instance.vars.CampaignID = eventT.@id;
}
logInfo("Campaign Internal Name: "+instance.vars.CampaignInternalName);
logInfo("Campaign ID: "+instance.vars.CampaignID);
Regards,
Pravallika.
Views
Replies
Total Likes
Hi @Javi_Landa ,
Firstly you need to define 2 Variables in the Campaign Workflow properties Tab as shown below
Then, please use the below JS Code to fetch the Internal name in the Java script activity of the Workflow
var query = xtk.queryDef.create(<queryDef schema="nms:operation" operation="select"><select><node expr="@id"/><node expr="@internalName"/>
</select>
<where><condition expr={"@id = '"+instance.operation_id+"'"}/></where>
</queryDef>);
var eventExistss = query.ExecuteQuery();
for each (var eventT in eventExistss.operation)
{
instance.vars.CampaignInternalName = eventT.@internalName;
instance.vars.CampaignID = eventT.@id;
}
logInfo("Campaign Internal Name: "+instance.vars.CampaignInternalName);
logInfo("Campaign ID: "+instance.vars.CampaignID);
Regards,
Pravallika.
Views
Replies
Total Likes
Okay! That has been very useful. But I have one last question.
Once you have named the temporay variable for the workflow internal name. How can be queried in the second one? Through "Recipient delivery log>Delivery/Workflow/@internalName" is correct?
Views
Replies
Total Likes
Hi @Javi_Landa ,
Yes, you can use the query activity to fetch the other Workflows Internal Name as shown above.
The best solution for this would be either to use a List activity so that you will have an easy track of the Audience or the Delivery Code approach as suggested below.
The above JavaScript is helpful to fetch the Internal names and Campaign code rightly in a Campaign,
Regards,
Pravallika.
Views
Replies
Total Likes
Thank you, i dont want to use lists because i have a huge volume of campaigns and that could be confusing.
If through that javascript and calling the internal name is possible, i would be more than happy.
So can we confirm that this model will work?
Views
Replies
Total Likes
Hi @Javi_Landa ,
Yes, the mentioned Javascript delivery/workflow/@internalName will work if you create delivery in a stand alone WKF ..... but creating in campaign workflow, delivery/workflow/@internalName won't work.
We saw few Data's after using Javascript for the Workflows created inside a Campaign that the Data is not populating inside delivery/workflow/@internalName (Values are blank),so this Javascript can be used in Standalone Workflows, But I suggest you to do testing for both these use cases and cross check the Data in your Recipient Delivery Logs and if Data gets populated in your schemas then it can be used.
Regards,
Pravallika.
Views
Replies
Total Likes
Hi @Javi_Landa ,
The ideal way of doing the same is below :-
1. The recipient you are targeting in first workflow might have been saved somewhere like in your broadlog table or if same is not a case you can save the same in your own list.
2. In second workflow pick the recipients from list and exclude the same using your exclusion activity by doing reconciliation on any common parameter like Email or ID.
This is a recommended way of doing the same.
Hi @Javi_Landa ,
Adding to @aggabhi point, If you are using Delivery in Workflow-1 and you want to exclude those recipients in WKF-2 who has been targeted in WKF-1, you can try below approach,
While configuring all deliveries in WKF-1, in Delivery property > Delivery Code add a value (eg, workflow1)
And in your WKF-2, along with your targeting query condition, query - Recipient delivery Logs do not exist such as and (delivery/@deliveryCode) equals to workflow1. And in Blue highlighted area you can provide rest of the conditions to target recipients of WKF-2
(If you have multiple deliveries in WKF-1, in all deliveries you can give deliveryCode as workflow1)
Alternatively, by Using List:
In the end of WKF-1 you can use 'List update' activity and create a list.
In WKF-2, Use 'Read List' activity and call all recipients who has been targeted in WKF-1 and exclude them with Targeting query.
Views
Replies
Total Likes
Great, that is se interesting, but i came up with a question then. If i assign an internal name to a delivery such as "worklow1". How can actually relate that delivery with workflow 1?
I mean, i can use "workflow1" as an internal name for other delivery in other campaign and i will be selecting the incorrect one, isnt it?
Views
Replies
Total Likes
Hi @Javi_Landa ,
Internal name is always unique. But here I suggest you to add that value in delivery code text box (which is not unique, so your question is valid ).
So when creating delivery, make sure you use delivery code which is unique. For example, <campaignInternalName>_<workflow1's IntenalName>_July2023'
(OP235_WKF1234_July2023)
You can call the same in WKF-2's query as,
Views
Replies
Total Likes
Views
Likes
Replies