how to display change request number in ritm description filed once change request is created

Arjun Reddy Yer
Mega Sage

Can anyone help me @Vasantharajan N @Ankur Bawiskar 

 

As I need to display change request number in ritm description filed once change request is created

Tried with Business Rule and the condition is when the change state is in New. 

But not able to get the Change Request number.

 

Business Rule: 

var chnGr_sysId = current.change_request.toString();
var riTs = new GlideRecord('sc_req_item');
riTs.addQuery('parent', chnGr_sysId);
riTs.addActiveQuery(); 
riTs.query();
if (riTs.next()) {

    riTs.description = current.number.toString(); 
    chGr.update();

}

 

1 ACCEPTED SOLUTION

@Arjun Reddy Yer - Please try this code and let us know.

var chnGr_sysId = current.sys_id.toString();
var riTs = new GlideRecord('sc_req_item');
riTs.addQuery('parent', chnGr_sysId);
riTs.addActiveQuery();
riTs.query();
if (riTs.next()) {
    riTs.description = current.number.toString();
    riTs.setWorkflow(false);
    riTs.update();
}

 


Thanks & Regards,
Vasanth

View solution in original post

21 REPLIES 21

KB18
Tera Guru

Dear @Arjun Reddy Yer 

Please try using the below code


var riTs = new GlideRecord('sc_req_item');
riTs.addQuery('parent', current.sys_id);
riTs.addActiveQuery(); 
riTs.query();
if (riTs.next()) {
    riTs.description = current.number; 
    riTs.update();
}

 

 

Please hit the thumb Icon and mark as correct in case I help you with your query!!!
- Kailas

Akshay37
Mega Guru

Hi @Arjun Reddy Yer ,

 

Try writing insert BR without any condition on "change_request" table and update your code as below:

 

var chnGr_sysId = current.sys_id;
var riTs = new GlideRecord('sc_req_item');
riTs.addQuery('parent', chnGr_sysId);
riTs.addActiveQuery(); 
riTs.query();
if (riTs.next()) {

    riTs.description = current.number.toString(); 
   riTs.update();

}

 Please Mark it as correct/helpful if this helps you.

 

Thanks,

Akshay