The Zurich release has arrived! Interested in new features and functionalities? Click here for more

How to update worknote of Task after incident is created through record producer

YashviPatil
Tera Contributor

Hi All,

 

I have record producer which contain one lookup select box variable on SC_TASK table so at the time of submission of request when user select TASK number then after submission of request it should update the WorkNote of selected task with created incident number. i.e. " Incident is raised for this issue"

 

Can anyone help me how I can configure this functionality.

 

Thanks.

 

 

5 REPLIES 5

Pradeep19
Tera Contributor

Hi Yashvi,

You can write GlideRecord  script to add comment on SC_TASK table on Record producer script field.

 

For refrence check below screenshot

Pradeep19_0-1694416068947.png

 

Pradeep19
Tera Contributor

Hi,

Please update record producer script field with below script, in place of Get("add variable value of your reference field")

Pradeep19_0-1694416239535.png

 

Ben_G
Tera Expert

In the record producer script field you can access the select box variable, producer.variable_name, and call GlideRecord to get the task, add the incident number to the work notes and then update the task.

 

Example - 

var grTask = new GlideRecord('task');

if (grTask.get(producer.task_number)) {
	grTask.work_notes = current.number + ' has been created';
	grTask.update();
}

The task number variable on the record producer should be a reference, this allows you to do a get() with the sys_id.

Siva Jyothi M
Mega Sage

Hi @YashviPatil,

 

You can try the below code

var gr = new GlideRecord('task');
gr.addQuery('number',producer.task_number.getDisplayValue()); // replace it with the correct variable name
gr.query();
if(gr.next()){
	gr.comments.setJournalEntry(producer.task_number.getDisplayValue());
	gr.update();

}

Mark this answer as correct and helpful if it solves your issue.

 

Regards,

Siva Jyothi M.