Get "Assigned_to" and "Assignment_group" from another table to Notification

F_bio Santos
Kilo Sage

Hi everyone, Im trying to get the "assignment_group" and "assigned_to" from a "sc_req_item" record to a notification on the "sysapproval_approver", I have tried in some diferent ways, but nothing seems to work ...

I have tried to use: 

 

${document_id.assigned_to}
${document_id.assignment_group}
------------------------------------------
${assigned_to}
$assignment_group}
------------------------------------------

And also with script:

    var gr = new GlideRecord('sc_req_item');
	gr.get(current.sys_id);

	template.print('<b> Assigned To: <\b>' + gr.assigned_to + '\n' 
	+ '<b> Assignment Group: <\b>' + gr.assignment_group);


But havent been able to make it work, does anyone know how to do this ?

1 ACCEPTED SOLUTION

debendudas
Mega Sage

Hi @F_bio Santos ,

The sc_req_item record's sys_id is stored in the document_id field so to get the Assigned to and Assignment Group update the code as below:

var gr = new GlideRecord('sc_req_item');
gr.get(current.document_id);

template.print('<b> Assigned To: <\b>' + gr.getDisplayValue("assigned_to") + '\n' 
	+ '<b> Assignment Group: <\b>' + gr.getDisplayValue("assignment_group"));

Also to get the name of the assigned to and assignment group use getDisplayValue() method.

 

If this solution helps you then, mark it as accepted solution ‌‌✔️ and give thumbs up 👍

View solution in original post

2 REPLIES 2

debendudas
Mega Sage

Hi @F_bio Santos ,

The sc_req_item record's sys_id is stored in the document_id field so to get the Assigned to and Assignment Group update the code as below:

var gr = new GlideRecord('sc_req_item');
gr.get(current.document_id);

template.print('<b> Assigned To: <\b>' + gr.getDisplayValue("assigned_to") + '\n' 
	+ '<b> Assignment Group: <\b>' + gr.getDisplayValue("assignment_group"));

Also to get the name of the assigned to and assignment group use getDisplayValue() method.

 

If this solution helps you then, mark it as accepted solution ‌‌✔️ and give thumbs up 👍

Hi @debendudas it worked but for some reason now I have the html elements on the notification "<>"