Regaring client Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
I am not able to run onChange and onSubmit client scripts in my PDI for both Zurich and Yokohama versions. Since the scripts are correct, please suggest an alternative option.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi @AbhishaS,
From the looks of your OnSubmit script, it appears you are requiring a value for assignment_group for submission, but the onChange script you provided makes the assignment_group mandatory only for "Database" option, which then questions why you need the OnSubmit script anyway, since if "Database" is selected and requires Assignment Group to be selected, the form will naturally not allow submission until it is completed. If another option (other than "Database") is selected, then it should allow submission (assuming no other required fields are not yet completed on the form).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hi @AbhishaS ,
I tried your client script in my PDI and it works for me please check below OnSubmit script
function onSubmit() {
//Type appropriate comment here, and begin script below
var ag = g_form.getValue('assignment_group');
if(!ag || ag == ""){
alert("Please fill out manadatory field - Assignment Group");
g_form.setMandatory("assignment_group", true);
return false;
}
}Result
Once I select ok it make assignment group as mandatory
Now Check correct OnChange Client script
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
alert("New Value = " + newValue);
if (newValue == "software") {
g_form.addInfoMessage('Testing Template');
g_form.setValue('short_description', "Incident From client Script");
g_form.disableAttachments();
} else if (newValue == "database") {
g_form.addErrorMessage('Error fom an change client script');
g_form.disableAttachments();
g_form.setMandatory('assignment_group', true);
g_form.setSectionDisplay('related_records', false);
} else {
g_form.clearMessages();
g_form.enableAttachments();
g_form.hideRelatedList('task_ci');
}
}
Result
Please mark my answer correct and helpful if this works for you
Thanks and Regards,
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
In OnChnage make newValue if condition with small case , database and software
Please mark my answer correct and helpful if this works for you
Thanks and Regards,
Sarthak
