having issue for different values for "Request for" field on RITM's that are a part of same request

Dileep Raju
Giga Guru

Hi 
I have raised a two RITMs that are a part of one request (REQ#######)..
Here my defect is I need Two "request for" fields in two RITMs should be same..but it is working only for one

For example

RITM for 1st( RITM11111)
Request for = aaaa

under variables 

request for = aaaaa

 

where as for 2nd RITM(RITM22222)

Request for = aaaa

under variables 

request for = bbbb

Here i need for 2nd RITM (RITM22222)

request for = bbbb

under variables

request for = bbbb

5 ACCEPTED SOLUTIONS

Weird
Mega Sage

The requested_for field is not actually a field on the sc_req_item table, but on the sc_request table.
If you right click the field on sc_req_item table and select show - 'requested_for' it will open a small popup that shows "sc_req_item.request.requested_for".
Each Request is therefore always for 1 person no matter how many RITM's you include.
Rather in your case you could consider that if manager (or whoever) is ordering the RITM's then they'd be the requested_for for all and then separately have a variable which holds the actual recipient.

Otherwise you'd have to create your own custom requested_for field on sc_req_item and use that instead.



View solution in original post

Dileep Raju
Giga Guru

Hi 

And also please share screen shoot for it if possible like how we can proceed
Otherwise you'd have to create your own custom requested_for field on sc_req_item and use that instead

View solution in original post

jaheerhattiwale
Mega Sage
Mega Sage

@Dileep Raju Tried and tested solution

Create a Business Rule on RITM as follows

jaheerhattiwale_2-1670577542780.png

 

jaheerhattiwale_0-1670577401148.png

 

jaheerhattiwale_1-1670577419068.png

 

Script:

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

current.requested_for = current.variables.requested_for;

})(current, previous);

 

 

Please mark as correct answer if this solves your issue.

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023

View solution in original post

@Dileep Raju Cant' exactly say why its not populated in second RITM? It depends on the logic you built in the catalog item and workflow.

 

Which screen shot you want i did not get that?

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023

View solution in original post

@Dileep Raju There are 2 "Requested for" fields on the RITM table, one is its own field and one more is the "Request" table field. (please see image below)

jaheerhattiwale_3-1670732543819.png

In list view above you can see those 2 fields.

 

In the form view you can notice the field "Requested for" added on the form is of "Request" field not of RITM field.

jaheerhattiwale_6-1670732653296.png

jaheerhattiwale_10-1670732703232.png

 

And "Requested for" of Request is only one person.

 

And through our script we are populating the RITM "Requested for" field. So please add the RITM "Requested for" field on form OR check the RITM "Requested for" field populated in the list view.

 

Please mark as correct answer if this solves your issue.

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023

View solution in original post

21 REPLIES 21

Weird
Mega Sage

The requested_for field is not actually a field on the sc_req_item table, but on the sc_request table.
If you right click the field on sc_req_item table and select show - 'requested_for' it will open a small popup that shows "sc_req_item.request.requested_for".
Each Request is therefore always for 1 person no matter how many RITM's you include.
Rather in your case you could consider that if manager (or whoever) is ordering the RITM's then they'd be the requested_for for all and then separately have a variable which holds the actual recipient.

Otherwise you'd have to create your own custom requested_for field on sc_req_item and use that instead.



Dileep Raju
Giga Guru

Hi 

Mega Guru
Thank you for quick reply

 

In Personal development instance it is working as expected.
Could you please let me know what will be the issue.....please share screen shot

For example
For One request( REQ#####)

RITM for 1st( RITM11111)
Request for = aaaa

under variables 

request for = aaaa

 

where as for 2nd RITM(RITM22222)

Request for = aaaa

under variables 

request for = bbbb

Here i need for 2nd RITM (RITM22222)

request for = bbbb

under variables

request for = bbbb

Dileep Raju
Giga Guru

Hi 

And also please share screen shoot for it if possible like how we can proceed
Otherwise you'd have to create your own custom requested_for field on sc_req_item and use that instead

jaheerhattiwale
Mega Sage
Mega Sage

@Dileep Raju Tried and tested solution

Create a Business Rule on RITM as follows

jaheerhattiwale_2-1670577542780.png

 

jaheerhattiwale_0-1670577401148.png

 

jaheerhattiwale_1-1670577419068.png

 

Script:

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

current.requested_for = current.variables.requested_for;

})(current, previous);

 

 

Please mark as correct answer if this solves your issue.

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023