Expand my Community achievements bar.

SOLVED

Variable activity label

Avatar

Level 2

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.

 

fgtrrt_0-1715703370541.png

Thanks in advance,

Topics

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @fgtrrt ,

 

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.

 

 

 

View solution in original post

6 Replies

Avatar

Level 7

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

 

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

Avatar

Level 7

Hello @fgtrrt , 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:

Heku__0-1715771808411.png

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:

Heku__1-1715772005122.png

Hope this helps!

Avatar

Correct answer by
Community Advisor

Hi @fgtrrt ,

 

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.

 

 

 

Avatar

Level 2

Hi @LakshmiPravallika ,

 

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

 

Thanks,

Avatar

Level 7

Hello, @fgtrrt. 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:

Heku__0-1715787409106.png

This solution worked for me. I hope this helps.