Hi I want to pass a sys id as sys property name in email script glide record

rajeshKongamudi
Tera Contributor

Hi I want to pass a sys id as sys property name in glide record in add query method, to pass all the group members in the cc when the notification triggers, can someone please help. thanks in advance.

3 REPLIES 3

Shruti
Mega Sage
Mega Sage

Create a system property and store sys_id in it and call it in email script using gs.getProperty('property_name')

 

Amit Gujarathi
Giga Sage
Giga Sage

Hi @rajeshKongamudi ,
I trust you are doing great.
To pass a sys ID as the sys property name in a GlideRecord's addQuery method, you can use the following code:

var sysId = '<your_sys_id>'; // Replace <your_sys_id> with the actual sys ID you want to use

var gr = new GlideRecord('<table_name>'); // Replace <table_name> with the name of the table you want to query

gr.addQuery('sys_id', sysId);
gr.query();

var ccList = [];

while (gr.next()) {
  // Retrieve the group members and add them to the ccList array
  var member = gr.getValue('<cc_field_name>'); // Replace <cc_field_name> with the name of the field containing the group members' sys IDs
  ccList.push(member);
}

// Use the ccList array to pass the group members in the cc when the notification triggers
// Add your notification logic here

Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



Shishir
Mega Guru

You can use email script to add CC to you email notification. In email script you can fetch system property by using gs.getProperty method