How to read ctx inner node values inside an RT Email Template? | Community
Skip to main content
Level 2
March 22, 2024
Solved

How to read ctx inner node values inside an RT Email Template?

  • March 22, 2024
  • 2 replies
  • 976 views

Hi All,

 

Example of my SOAP Push Event payload:

<ctx> <information> <paragraph>Lorem Ipsum One</paragraph> <status>red</status> </information> <information> <paragraph>Lorem Ipsum Two</paragraph> <status>yellow</status> </information> . . . N </ctx>

Inside the RT Email Template, I want to fetch and validate value for node status for each rtEvent.ctx.information and display the value within node paragraph.

For example if status = red, then display "Alert" and so on.

 

Expected Output:

Lorem Ipsum One - red - Alert

Lorem Ipsum Two - yellow - Warning

and so on

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 isahore

Hi @anushka_rk,

 

You can do it like this:

 

 

var infos = rtEvent.ctx.information; for each (var info in infos){ if(info.status.toString() == "red"){ //alert } if(info.status.toString() == "yellow"){ //warning } }

 

 

BR,

Ishan

2 replies

Manoj_Kumar
Community Advisor
Community Advisor
March 22, 2024

Hello @anushka_rk 

 

Did you try this?

 

rtEvent.ctx.information.paragraph rtEvent.ctx.information.status

 

You can use conditions for alert like this

if(rtEvent.ctx.information.status=='red'){ PRINT ALERT HERE }
Manoj     Find me on LinkedIn
AnushkaRajan
Level 2
March 22, 2024

Hi @_manoj_kumar_ ,

 

Thank you for your response.

Yes, I tried this. But the <information> node is dynamic and the number of information nodes might vary each time.

How can I pull all the details for each <information> node?

 

Kind Regards,

Anushka RK

isahore
Community Advisor
isahoreCommunity AdvisorAccepted solution
Community Advisor
March 22, 2024

Hi @anushka_rk,

 

You can do it like this:

 

 

var infos = rtEvent.ctx.information; for each (var info in infos){ if(info.status.toString() == "red"){ //alert } if(info.status.toString() == "yellow"){ //warning } }

 

 

BR,

Ishan

Level 2
March 22, 2024

Hi @isahore,

Thank you for your response.

It worked!

Kind Regards,

Anushka RK