Requested for defaulting to Opened By

allison_holt
Giga Expert

Whenever I create Service Catalog items, they are defaulting to the Opened by person unless I include a script that sets the requested for person. The script works great and I am able to get the requested for person to match the requested for variable, but we are wanting to be able to use the cloning function for catalog items. Whenever I use the cloning function with this script in place, the first task is correct, but the clones are the same requested for person as the initial task. If I don't have the script in place, the first task has the opened by person, but the clones have the correct people.

I have tried using a business rule that i found on this community page Requsted for field is defaulting for Service Requests?, but it still does the same as my script within my workflow.

Hopefully that made sense.

Any help would be greatly appreciated!!

Allison

1 ACCEPTED SOLUTION

Sure.   I created the following business rule:


table:   sc_req_item


when: before


Insert: true


condition:   current.variables.requested_for != undefined



if (gs.getSession().isInteractive()){  


var user = current.variables.requested_for.getDisplayValue();


current.request.requested_for.setDisplayValue(user);  


}



Hope this helps!


A


View solution in original post

15 REPLIES 15

I currently have a BR that updates the requested for to the variable, it just doesn't work with the clone. So from what I'm gathering, we can't use the clone if we're wanting to also use the requested for variable??


You will need a second BR that runs when a clone is created to copy the 'Requested For' to the variable, since the Requested For is your correct value here. Using the CLONE functionality OOB is NOT possible if you want variables to change. You will need to customize this part.


When I have the clone turned on and the BR turned off to fill in the initial request, the names I put in the boxes on the clone screen appear perfectly. When I have the BR turned on, it uses the same requested for person for every copy. If that makes sense.
So for example, I'm making an initial Request for Person A. I then want to clone it for PErson B, C and D. When the BR is turned on, every request is created for Person A. If I have the BR turned off, the first request is set to the Opened By Person (Not Person A), but the clones are set to B, C, and D.


Ahh, a bit different issue. So what if you only run the BR when you are creating a request manually? Not sure how you can determine you are running manually (perhaps isInteractive()). I usually use a Client Script instead of a BR, so it runs onChange of my Requested For variable.


Do you think the client script would be better than the BR? I'll try the isInteractive and see if that works.