Variable activity label | Community
Skip to main content
Rch_
Level 3
May 14, 2024
Solved

Variable activity label

  • May 14, 2024
  • 3 replies
  • 1177 views

Hi all,

 

I have a ask where i need the variable code to get the label of the list activity in alert (such as  <%= instance.label %> ), without passing any variable in the list activity.

 

Thanks in advance,

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 LakshmiPravallika

Hi @rch_ ,

 

To get the label of the List activity inside the alert activity's body email, Please use the below Javascript Code inside the Alert activity :-

 

<%

logInfo(instance.activities.readGroup[0].label)
vars.labelReadList=instance.activities.readGroup[0].label

%>
<p></p>
<p><%=vars.labelReadList %></p> 

<!-- to print label of read list activity --!>

 

Hope this helps.

 

Regards,

Pravallika.

 

 

 

3 replies

CampaignerForLife
May 15, 2024

Try this:
instance.activities.alert[0].label = "X"

 

Is this what you pretend? I don't understand your problem at all

Heku_
May 15, 2024

Hello @rch_ , to get the label of the alert activity you can use

instance.activities.alert[0].label

With this, you can use it to save it in a variable:

In the Js code:

logInfo(instance.activities.alert[0].label) vars.labelAlert=instance.activities.alert[0].label

 With that in the variable vars.labelAlert you can use it in a query like this:

Hope this helps!

LakshmiPravallika
Community Advisor
LakshmiPravallikaCommunity AdvisorAccepted solution
Community Advisor
May 15, 2024

Hi @rch_ ,

 

To get the label of the List activity inside the alert activity's body email, Please use the below Javascript Code inside the Alert activity :-

 

<%

logInfo(instance.activities.readGroup[0].label)
vars.labelReadList=instance.activities.readGroup[0].label

%>
<p></p>
<p><%=vars.labelReadList %></p> 

<!-- to print label of read list activity --!>

 

Hope this helps.

 

Regards,

Pravallika.

 

 

 

Rch_
Rch_Author
Level 3
May 15, 2024

Hi @lakshmipravallika ,

 

Am getting undefined as an alert. Is there something am missing to add in read list activity?

 

Thanks,

Heku_
May 15, 2024

Hello, @rch_. Following @lakshmipravallika's solution, I've tried the same but instead of writing 

<% logInfo(instance.activities.readGroup[0].label) vars.labelReadList=instance.activities.readGroup[0].label %>

Inside the HTML content, I've used that code inside the Initialization script of the alert:

This solution worked for me. I hope this helps.