- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2016 11:45 AM
Hi,
I have requirement to auto populate the few fields in change form based on Category, Sub Category and App Category(this is custom field and is dependent on Sub Category field).
Following fields should be populated:
Implementation plan
Short Description
Blackout plan
Justification
Downtime
We have created a custom table and loaded all the Category, Sub Category, Appl Category, Implementation plan, Short Desc, Blackout Plan, Justification and Downtime.
And I have created a client script which checks the values selected in Category, Sub Category and Appl Category and query the custom table where the above fields data is loaded. If the data is matched based on Category, Sub Category and Appl Category the other values should be auto populated.
Below is the Client Script which is working if I am selecting only category and Sub Category. When I am trying to select Appl Category it is not working.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if(newValue!=''){
//alert('here');
var category = g_form.getValue('category');
var subc = g_form.getValue('u_subcategory');
var applCat = g_form.getValue('u_appl_category');
var shortDesc = g_form.getValue('short_description');
//var description = g_form.getValue('description');
var gr = new GlideRecord('u_change_dependent_values');
gr.addQuery('u_category',category);
gr.addQuery('u_subcategory',subc);
gr.addQuery('u_appl_category',applCat);
//gr.addQuery('u_short_description',shortDesc);
gr.query();
while(gr.next())
{
if(gr.u_short_description !='')
{
g_form.setValue('short_description',gr.u_short_description);
}
if(gr.u_description !='')
{
g_form.setValue('description',gr.u_description);
}
if(gr.u_justification !='')
{
g_form.setValue('justification',gr.u_justification);
}
if(gr.u_implementation_plan !='')
{
g_form.setValue('implementation_plan',gr.u_implementation_plan);
}
if(gr.u_downtime_explation !='')
{
g_form.setValue('u_downtime_duration',gr.u_downtime_explation);
}
if(gr.u_checkout_plan !='')
{
g_form.setValue('test_plan',gr.u_checkout_plan);
}
if(gr.u_backout_plan !='')
{
g_form.setValue('backout_plan',gr.u_backout_plan);
}
if(gr.u_affected_groups !='')
{
g_form.setValue('u_affected_groups',gr.u_affected_groups);
}
if(gr.u_affected_locations !='')
{
g_form.setValue('u_affected_locations1',gr.u_affected_locations);
}
}
}
}
Can some one help me why it is not working. I need this to be delivered today. Please help me.
Thanks!
Raj
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2016 12:08 PM
I got the fix. I was missing to select the field name in the client script.
Thanks!
Raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2016 12:08 PM
I got the fix. I was missing to select the field name in the client script.
Thanks!
Raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2017 11:17 AM
var gr = new GlideRecord('u_change_dependent_values');
what is this record for ? I didn't understand ?
I got the fix. I was missing to select the field name in the client script. !! --> Can you please elaborate using the script. Please write the code what u got fixed .