The CreatorCon Call for Content is officially open! Get started here.

Email script to show variables visible on summary

Rajesh Mushke
Mega Sage

Hi Team,

we have an email notification when an item is submitted, here we need to show variables visible on summary.

can any one suggest me how to show variables visible on summary using email script.



Thanks,
Rajashekhar Mushke
Rising star : 2022 - 2024
Community Leader -2018
Connect me on LinkedIn : Rajashekhar Mushke
1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

You can use this code in a mail script to print variables. This one assumes the message is on the sysapproval_approver table and gets the variables from the record pointed to by the sysapproval table.



printVars();


function printVars(){


      var set = new GlideappVariablePoolQuestionSet();


      set.setRequestID(current.getValue('sysapproval'));


      set.load();


      var vs = set.getFlatQuestions();


      for (var i=0; i < vs.size(); i++) {


              if(vs.get(i).getLabel() != '') {


                      template.print('       ' +   vs.get(i).getLabel() + " = " + vs.get(i).getDisplayValue() + "\n");


              }


      }


}


View solution in original post

13 REPLIES 13

A small revision to hide variables that are not set to "Visible on Summaries":

find_real_file.png

printVars();

function printVars(){
	var set = new GlideappVariablePoolQuestionSet();
	set.setRequestID(current.getValue('sysapproval'));
	set.load();
	var vs = set.getFlatQuestions();
	for (var i=0; i < vs.size(); i++) {
		if (!vs.get(i).isVisibleSummary()) {
			continue;
		}
		if(vs.get(i).getLabel() != '') {
			template.print('       ' +   vs.get(i).getLabel() + " = " + vs.get(i).getDisplayValue() + "\n");
		}
	}
}

Rajesh Mushke
Mega Sage

Hi ctomasi,

 

the above script is not pulling Macro variables on summary view, is there any reason for that?

 

Thanks,

Rajashekhar Mushke

Community Leader - 18



Thanks,
Rajashekhar Mushke
Rising star : 2022 - 2024
Community Leader -2018
Connect me on LinkedIn : Rajashekhar Mushke

Hi Sir,

May I have your e-mail address? because I have some practices to hope you can help to check, thanks

Hey Supereric,

 

Good Day.!!!

 

Please connect me through LinkedIn:

Rajashekhar Mushke

 

Thanks,

Rajashekhar Mushke

Community Leader - 18



Thanks,
Rajashekhar Mushke
Rising star : 2022 - 2024
Community Leader -2018
Connect me on LinkedIn : Rajashekhar Mushke