The requested for shows incorrect on Request

pennieturner
Mega Guru

I have a bit of an issue at the moment with the requested for field.

We use two fields on the request:

Requested By - Default is the current USERID

Requested For - default is blank

On the actual request the requested by is the user raising the request and the requested for is the person who the request is for IE

Requested By - Pennie

Requested For - Tracy

After I have gone through the 2 stage shopping cart, the request shows as both as Pennie, and the actual requested Items show correctly as pennie for the requested by and tracy for the requested for.


We are on Calgary release and I'm stuggling to find why its not setting it correctly on the request?


Can anyone help?

We have the requested for delivery details turned off because of this error (UI Macro called catalog_requested_for), as on the cart it shows wrong aswell, but if you go back to the request (eg edit it) it shows what you actually put.

Thank you in advance

1 ACCEPTED SOLUTION

poyntzj
Kilo Sage

We have this as a BR in sc_request


set as a Before Insert / Update



var grRITM = new GlideRecord('sc_req_item');  


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


grRITM.query();  


while (grRITM.next()) {  


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


      current.requested_for = grRITM.variables.requestor_name;


  }  


}



Added by someone from Servicenow for us



We also have a Variable Set called requested_for_vars


that has the requested_for variable in there



Otherwise I would suggest you look at the audit history and see if it is changing as well as looking at all your BR's to see if they are doing anything


View solution in original post

11 REPLIES 11

poyntzj
Kilo Sage

For us, the REQ has the requested for information as passed by the record producer


we only ever go back to this value and not the variable - though should actually work



so in your example, we would have



current.requested_for = grRITM.request.requested_for;



I have just run this against one our records and they give me the same value and it is the same and correct user.



var gr = new GlideRecord('sc_req_item');


gr.addQuery('number','RITM0198898');


gr.query();


while(gr.next())


{


gs.print(gr.variables.requested_for);


gs.print(gr.request.requested_for);


}


Will try.Thank you.