- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2015 08:36 AM
Can anyone assist with a script to fill a Yes/No field based on another fields selection.
Background Information:
This is an Order Guide item. I am creating a catalog client script called: Set Agreement Value Based on Dept
The Order form requires fields to be filled in, like name and department. Initially the form comes up with no entries.
When I select 'Info Technology' from the reference field from the Department table , I want the field on the Order Guide Form for Confidentiality Agreement to automatically change from No to Yes.
Here is what I have tried, unsuccessfully.
Function onChange() {
var dept = g_form.getValue('department');
if(dept == 'info technology'){
g_form.setValue('agreement','Yes');
}
}
Form screen shots below: First is the Department selection fields; second is the Yes/No question I want auto populated based on the department chosen.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2015 12:12 PM
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var dept = g_form.getReference('department').name;
if(dept == 'info technology'){
g_form.setValue('agreement','Yes');
}
}
Try above script.
Regards,
Hardik Vora
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2015 12:12 PM
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var dept = g_form.getReference('department').name;
if(dept == 'info technology'){
g_form.setValue('agreement','Yes');
}
}
Try above script.
Regards,
Hardik Vora
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2015 12:15 PM
The script no longer errors out, but it also does not change the 'agreement' field to Yes. Sorry, this is very frustrating for someone who does not know scripting.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2015 12:29 PM
I had to capitalize the I and T in Info Technology and then it worked. Thank you very much
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2017 11:54 PM
Hi ,
I have a issue. I need to populate a reference field based on the location of the logged-in user.
ex- if the logged-in user is from X country ,the fulfillment group should populate Y.
and if logged-in user is from A country, the fulfillment group should populate B.
Thanks.