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

It's not working actually once the RITM is approved then SCTASK and Change Request are getting created automatically.

 

So in RITM description Change Request number should be populate.

 

When I keep the Business Rule to run before then it's not working changed to run after also it's not working.

 

Business Rule:

ArjunReddyYer_0-1683882721168.png

ArjunReddyYer_1-1683882849826.png

 

@Arjun Reddy Yer Please increase the order to 2000 and try.

 

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

@Arjun Reddy Yer In the RITM, parent field should be select as Change Number

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

still not working

ArjunReddyYer_0-1683884629009.png

ArjunReddyYer_1-1683884662067.png

 

Hi @Arjun Reddy Yer ,

 

try writing insert BR on "change_request" table instead of RITM and then use following code

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