How to set reference field

raj149
Giga Guru

Hello Experts,

When ever High incident is inserted then I am trying to create communication plan and communication and communication channel automatically.

 

 I am using below below business rule script 

Everything is working as expected but only one field is not setting the value .

the filed name is email client template - email_client_template (reference field).

 

(function executeRule(current, previous /*null when async*/) {
 
var commPlan = new GlideRecord('incident_alert');
commPlan.initialize();
commPlan.source_incident = current.sys_id;
commPlan.short_description = 'Communication Plan for' + current.number;
commPlan.assignment_group = current.assignment_group.sys_id;
commPlan.state = 'open';
commPlan.insert();
 
var commTask = new GlideRecord('incident_alert_task');
commTask.initialize();
commTask.short_description = 'Communication Task for' + current.number;
commTask.incident_alert.source_incident = current.sys_id;
commTask.state = 'open';
commTask.incident_alert = commPlan.sys_id;
commTask.insert();
 
var channel = new GlideRecord('comm_channel');
channel.initialize();
channel.comm_task = commTask.sys_id;
channel.recipient_field = 'to';
channel.state = 'not_sent';
channel.sys_class_name = 'comm_channel_email';
channel.comm_channel_config = '1513471e870013000e3dd61e36cb0bf2';
channel.comm_task.comm_plan.source = current.sys_id;
channel.email_client_template = '7fa8e20a870103006fb5d61e36cb0b1d'; /// this line is not working
 
channel.insert();
 
})(current, previous);
 
 
How to set email client template field....?
 
Best regards,
Raj.
1 ACCEPTED SOLUTION

@raj149 Check if the template is active and a reference qualifier on email_client_template field is not causing the issue.

View solution in original post

3 REPLIES 3

Sandeep Rajput
Tera Patron
Tera Patron

@raj149 Can you check if the email client template with sys_id 7fa8e20a870103006fb5d61e36cb0b1d exist on your instance.

Hello @Sandeep Rajput 

 

Yes it is available in email client template table.

@raj149 Check if the template is active and a reference qualifier on email_client_template field is not causing the issue.