- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2015 05:30 AM
Hi,
I am currently working on a new catalog item to allow for users to submit requests for access to shared drives. We have the drive information stored in a table called Storage File Shares (cmdb_ci_storagefileshares). This includes the following information:
- Path
- Approver
- Read Access Group
- Write Access Group
On my catalog item, I have created two variables, one call 'Path' and the other called 'Approver'. What I am looking to do is have the Approver value automatically update when I select a value in the 'Path' variable.
A basic view of what I am trying to do is below. The table represents my storage file shares table which is extended off the cmdb_ci table.
Path | Approver |
---|---|
\\fileshare01\test | Tom Jones |
\\fileshare01\HR | Mary Jones |
\\fireshare02\newfolder | John Jones |
If I select \\fileshare01\test in the 'Path' variable (reference field to the table above) on my catalog item when logging a new request, can the second variable then update with the approvers name, ie. Tom Jones?
I am pretty new to all of this and am looking to see if this can be easily done or if this will require more advanced scripting. I have done some basic scripting recently within the application but am a newbie so to speak.
Any assistance or thoughts on this would be appreciated.
Cheers.
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2015 07:27 AM
Sorry, try this:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var path = g_form.getReference('Path');
g_form.setValue('Approver', path.u_approver1);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2015 07:27 AM
Sorry, try this:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var path = g_form.getReference('Path');
g_form.setValue('Approver', path.u_approver1);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2015 08:14 AM
Hi Bryan,
Many thanks for your help with this. Works perfectly now.
Cheers,
James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2015 07:24 AM
Hello James,
We also have similar kind of requirement.
Quick explaination: we have 3 diff. variables on service catalog item.
1. Contact type (choice list with options as email and mobile)
2. Email (auto populates with user mail ID, we have configured this variable with default value as "javascript:gs.getUser().getRecord().getValue('email');" )
3. Mobile ( auto populate with user mobile number, similar as that of the email variable)
while raising the request if user select contact type as "email" then automatically Email variable appears with users mail id
and if user select contact type as "mobile" then automatically mobile variable appears with users mobile number.
we have written below catalog client script :
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var type = g_form.getValue('contact_type').toString();
//g_form.addInfoMessage(type);
if(type == 'email')
{
g_form.setDisplay('email_id',true);
g_form.setDisplay('mobile_number',false);
}
else if(type == 'mobile')
{
g_form.setDisplay('email_id',false);
g_form.setDisplay('mobile_number',true);
}
}
in your case try to develop with above logic if choice list is feasible for you.
here you can add the "path" in pace of "contact type" and set the approver values accordingly. its like hard coding the values. if you have less values to configure.
else another solution I can think of is using GlideAjax.
do the following:
1. create a client callable script include.
and configure
2. create a on change catalog client script
3. call that script include using the GlideAjax
All the Best
Regards,
Shashank Joshi