- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2016 04:22 AM
I have a requirement where I have three variables in service catalog
1. CI Type(select box) -> VM , Linux , ESX, JBOSS
2. CI Name (reference field)
3. Sys ID (single line text)
Now I want that whenever the CI type is changing the referenced table in CI Name should change accordingly with their respective tables.
like for vm ->cmdb_ci_vm similarly for others as well.
My end result is to fetch selected ci name's sys id .
For changing reference field script include and onchange client script will be required .
for sysid fetch also onchange or onsubmit script will be required . Not sure about this
Please help me with the correct code for my requirement .
Let me know if you need any further information.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2016 02:13 AM
Please replace-
var type=current.u_type;
with
var type=current.variables.u_type;
It should work now. Best of luck.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2016 02:46 AM
Here is your code-
Write an onchange catalog client script-
Variable name - sys_id
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
g_form.setValue('sys_id',newValue);
}
Please mark all of my replies Helpful. and let me know whether this code solves your purpose or not...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2016 02:54 AM
Yes worked but I used variable CI name then it worked .
Thanks a lot for your help and quick response .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2016 02:56 AM
Yes the variable name would have been CI name... You are welcome.....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2016 05:17 AM
Output of CI Name is coming as sys id instead of name . Any idea why this is happening ? I wrote soap script in workflow and tried to print output of ci_name field.
Is there some other procedure to fetch value when its a reference field ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2016 05:35 AM
Wherever you are using the variable ci_name you need to metion it as ci_name.name; or ci_name.displayValue(); that will give you the name instead of sys id
