- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2014 10:02 AM
The Requested for field is always set to whoever is creating the request (the person presently logged in). I'm trying to make it something different and all my attempts have failed. Ultimately, I'd like it to be the name of the person that is entered into the Variable (Requested for). I checked the dictionary for the field and saw that it had a default value as javascript:gs.getUserID() I removed this default value but the field gets set anyway. I tried to set it in the beginning of the workflow with a Run Script activity to the variable entry submitted by the user but that does nothing. No matter what I do, the field is always set to the person entering the request. I need that person to be able to designate someone else as the requested for person. Any ideas?
This is the script in the workflow:
var reqRecord = current.request.getRefRecord();
reqRecord.requested_for = current.variable_pool.requested_for;
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2014 08:00 AM
yes sir.. just replace the entire script with the below and it should work like magic.
___________________
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_for = newValue;
gr.update();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2014 07:28 AM
I'm getting the following error: The object "current" should not be used in client scripts. Am I suppose to create this function as a client script, then call it from the onBefore business rule?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2014 07:42 AM
Can you provide the onBefore business rule that you created?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2014 08:13 AM
did you disable the onbefore br that you had put in?
and when you say the requested for is blank.. blank on which form?! the catalog item, the checkout screen, the created request, or item?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2014 08:28 AM
I did disable the other client script I created. When the catalog item is first selected the form loads with the Requested For already filled in with my name. I change the requested for to someone else's name than mine, answer the rest of the questions then click order.
When I go to the list of open Requests, the list view shows the field Requested for as blank. It is also blank in the RITM and all the TASKS.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2014 08:33 AM