BR to autopopulate RITM value on incident form

Swetham
Tera Contributor

I have created a custom field called REQUESTED ITEM(u_requested_item) in related records.

 

Now I have to autopopulate this field when a request is created from the incident.

 

I have used a Before BR:

Before - Insert&update

 

condition: current.sys_class_name == 'incident' && current.u_requested_item.nil()

Script: 

 

(function executeRule(current, previous /*null when async*/) {

if (current.sys_class_name == 'incident' && current.request_item.nil()) {
var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('request', current.sys_id); 
ritm.query();

if (ritm.next()) {
current.request_item = ritm.sys_id;
}
}

})(current, previous);

 

For some reason its not populating.

Iam using UI action from incident to create a request.

 

Can anyone help on this?

 

Thanks in advance!

 

20 REPLIES 20

@Swetham 

you can already establish relationship between INC and RITM via REQ as REQ already has parent field populated with INC

why to have extra field on INC table?

@Ankur Bawiskar  They have an idea to design a flow based on this custom variable as a part of next sprint. So we were trying to create one here and populate. Is there a way I can populate it? My BR above doesn't work.

 

@Ankur Bawiskar ,

 

your inputs on this??

anubhavritolia
Giga Sage

Hi @Swetham 

 

To understand the situation better, Could you share the screenshot where you have created Incident and how are you creating Request from Incident? As I don't see any such process yet OOTB.

 

 

@anubhavritolia ,

 

The Service desk team logs incident when they get calls from customers and they have a UI action on the incident form to create a Request from the same.