Expand my Community achievements bar.

Join us for the Adobe Campaign Community Q&A Coffee Break on 30th September at 8 am PT with Campaign experts Arthur Lacroix and Sandra Hausmann.
SOLVED

How can i retrieve the internal name of a workflow in other for segmentation within the same campaign?

Avatar

Level 2

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? 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @Javi_Landa ,

 

Firstly you need to define 2 Variables in the Campaign Workflow properties Tab as shown below

LakshmiPravallika_0-1688457540499.png

 

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.

 

View solution in original post

9 Replies

Avatar

Correct answer by
Community Advisor

Hi @Javi_Landa ,

 

Firstly you need to define 2 Variables in the Campaign Workflow properties Tab as shown below

LakshmiPravallika_0-1688457540499.png

 

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.

 

Avatar

Level 2

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?

Avatar

Community Advisor

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.

Avatar

Level 2

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?

Avatar

Community Advisor

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.

Avatar

Level 6

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.

 

 

Avatar

Community Advisor

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)

ParthaSarathy_0-1688476058445.png

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

ParthaSarathy_1-1688476258769.png

(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.

ParthaSarathy_2-1688476496964.png

 

 

 

Avatar

Level 2

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?

Avatar

Community Advisor

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,

ParthaSarathy_0-1688477576622.png