"Requested For" on the Request Form and the RITM

velvet
Mega Guru

On a Request form, the wrong information is in the Requested For.   For Example, if   I use the Hardware Request Form and select Requested for as User A, opened by is User B.

On the REQ it shows the Requested for as User B.. It should be User A.

On the RITM it shows the Requested for as User A.. that is correct.

Why is User B showing up as the Requested For, when on the Request form it was selected correct.

And how can I fix this.

1 ACCEPTED SOLUTION

SD29
Tera Expert

Hi velvet,



Please try using this before BR on request table.




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



  var grRITM = new GlideRecord('sc_req_item');    


grRITM.addQuery('request', current.sys_id);    


grRITM.query();    


while (grRITM.next()) {    


  if (!JSUtil.nil(grRITM.variables.requested_for)) {    


      current.requested_for = grRITM.variables.requested_for;


  }    


}



})(current, previous);



Thanks,


SD


View solution in original post

10 REPLIES 10

siva_dirisala
ServiceNow Employee
ServiceNow Employee

Hello Velvet, out of the box only sc_request has "Requested For" field, not sc_req_item. And the behavior is that whoever is ordering they will by default be used to identify the requested for. However, there is a widget to set the requested for to be someone else before placing the order. I assume you are capturing the "Requested For" via a variable. If so, you would have to have some logic that sets the requested for on the cart (see CartJS - Scoped           for Cart API that allows setting Requested For).


Here is a REQ and RITM, both have Requested For, but they don't have the same information.   The RITM has the Requested For correct.







find_real_file.png




find_real_file.png


roehltablada
Mega Guru

Hi Velvet,



if you check the Requested Item table, you will find that there is no Requested For column in it. In fact, if you carefully check the Requested Item form, you find the Request For column is actually coming from the Request table.



The Requested For column will always contain the user who requested a catalog item.



In my company, the solution taken was to create a Requested For column within the Requested Item table.




Regards,



Roehl Tablada


I have a Requested For column in the Requested item and the Request table.   I am new so sorry if I am not responding with the correct information



find_real_file.png