- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2014 02:51 AM
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2014 03:23 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2014 12:28 AM
Hi Julian
Thanks for your response.
I have put the answers below
So I use the Service Catalog and Request something
Logged in person - Kate
I choose "Requsted For" and I choose Pennie
I choose "Requested By" and I choose Jane
Now, when I look in the system
the REQ record is showing
Requested For = Pennie ? Shows Kate (should show the requested By's name as we could have multiple requested items on one request.
Requested By = Julian or Jane ? Shows Kate
On the RITM record(s)
Requested For = Pennie ? Shows Pennie
Requested By = Julian or Jane ? Shows Kate
There must be somewhere else it is setting the requested by to be the current users session ID, but I can't find where.
I have tried adding an onChange catalog client script on to set the requested by to the person that was put onto the form IE the current person:
function onChange(control, oldValue, newValue, isLoading) {
if (newValue){
var gr = new GlideRecord('sc_cart');
gr.addQuery('user', g_user.userID);
gr.query();
gr.next();
gr.requested_by = newValue;
gr.update();
}
}
When I put some debugging into the business rule, the current.requested_by shows the sys_id of the person I want it to be, so something later on must be changing it back
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2014 02:21 AM
so the RITM is showing the correct information. Is that on all the RITM's ?
So I raise an REQ
- RITM 1 is for Julian
- RITM 2 is for Pennie
- RITM 3 is for Joe
do they show the correct Requested For, or do they all show the same name ?
Looking at your reply, the REQ is looking OK
the REQ record is showing
Requested For = Pennie ? Shows Kate (should show the requested By's name as we could have multiple requested items on one request.
Requested By = Julian or Jane ? Shows Kate
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2014 12:44 AM
I found the problem! The workflow attached to it had a spelling mistake in it so the requested by wasn't being set on the RITM
Thank you for your help on this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2014 01:36 AM
Cool
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2015 08:14 AM
HI All,
Am having a similar issue here. I have a 'Requested for' field which is part of a variable set. Now when a request is submitted the requested for' in the request form is different to the 'Requested for' variable. (Hope this makes sense). So i browsed through the community site for a business rule to set this up. I applied the following
function onBefore(current, previous) {
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;
}
}
}
which doesnt seem to be working. Can anyone help with what I could be doing missing