Request Offering: Request On Behalf Of logic
I'd like to hide a user prompt in my request offerings unless a user is input into the Create Request On Behalf Of prompt.
I assume javascript can show/hide my request offering user prompt when the Create Request On Behalf Of prompt changes (add/remove user)?
Best Answer
-
Aaron_Boock Customer Advanced IT Monkey ✭✭✭Thank you to all the contributors for the ideas and leads.5
Answers
You can get more detail here: https://support.cireson.com/KnowledgeBase/View/1270#/
I added a True/False to permit users to indicate if they are submitting on behalf of another, it is redundant after already specifying a user to create on behalf of.
I would like to know how to use some javascript to hide a user prompt within the offering (if possible) unless requester specifies a user in the Create Request on Behalf prompt.
Is that right?
I've not tested it but from memory you can't see that field from the ARO wizard.
Hmmmm
Javascript could do it, but the field you are hiding could not be a "Required" field as it would see that field and not save the form, but the user would never see it.
The JS would be very specific to that one RO.... Not sure if someone has an example they can share?
For this particular functionality, I would suggest targeting very specific RO pages for this behavior if possible, so you can tightly control which RO this functionality appears on. You can do this by having a JS function that looks for the URL of the RO you want to apply this to (this could be one or more, set in an array). Something like this would work for that (this just shows a few ways to use that functionality):
Is this what you had in mind?
You pretty much nailed it Seth. Only it would likely be something a majority of my ROs would use.
I have high demand in my environment to allow the submitter (created by user) to indicate which user gets the ongoing notifications.
I have extended the IR/SR class to add a UserToNotify property. I then provide a simple list to allow submitter to choose who gets notified: Affected User, Submitter (created by user), or Both. The selection from this simple list populates the UserToNotify propery. I have SCSM subscriptions for each possible UserToNotify value
What I truly desire is that whenever a user is input to the Create Request On Behalf Of prompt, the UserToNotify simple list is then displayed on the RO form. Plus, when a user is cleared, it should be hidden.
Obviously, you can't use the ARO to do this because the On Behalf Of field is not technically a part of the RO form, but something we add on.
I've got page-load logic, but not sure what to use when the AffectedUserName.value changes.
Note: I'm testing by hiding the Filter item within query results prompt.
//RO hide Filter on load if no create request on behalf of user set
$(document).ready(function (){
if(window.location.href.indexOf("ServiceCatalog/RequestOffering") > -1){
console.log("I'm on a Request Offering page.");
if(AffectedUserName.value == ""){
console.log("No affected user");
$('input[placeholder="Filter"]').parent().hide();
}
}
});