- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2022 11:00 AM
I have a few checkboxes on a record producer. I would like to make a client script so on submit , the values are passed to an array if the checkbox was selected.
I have a rough script , but I've been unable to get it to work .
function onSubmit() {
var wArray = [];
if (producer.tsd_fcm_financial_form.getDisplayValue() == true) {
wArray.push('31ae898e2f74c1104577debcf699b64e');
}
if (producer.cims_information_and_privacy_form.getDisplayValue() == true) {
wArray.push('acbe898e2f74c1104577debcf699b64e');
}
if (producer.office_of_ciso.getDisplayValue() == true) {
wArray.push('a4f80c5297b54d10953ef3f3a253afb4');
}
if (producer.TSD_cloud_concept_form.getDisplayValue() == true) {
wArray.push('bc19085297b54d10953ef3f3a253af2b');
}
var finalResult = wArray.toString();
review.u_are_documents_approved_by_tsd_fcm = finalResult ;
review.update();
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2022 05:45 PM
Hi Mike,
Try the code below.
function onSubmit() {
var wArray = [];
if (g_form.getValue('tsd_fcm_financial_form') == 'true') {
wArray.push('31ae898e2f74c1104577debcf699b64e');
}
if (g_form.getValue('cims_information_and_privacy_form') == 'true') {
wArray.push('acbe898e2f74c1104577debcf699b64e');
}
if (g_form.getValue('office_of_ciso') == 'true') {
wArray.push('a4f80c5297b54d10953ef3f3a253afb4');
}
if (g_form.getValue('TSD_cloud_concept_form') == 'true') {
wArray.push('bc19085297b54d10953ef3f3a253af2b');
}
var finalResult = wArray.join(',');
g_form.setValue('u_are_documents_approved_by_tsd_fcm', finalResult);
}
Execution result:(I've added "return false" at the end to display the result of the script).
What is the script suppose to do? The script is onSubmit and setting a field on the form. If there is not a logic to terminate a submission based on the value, it seems better to create a before business rule to set field "u_are_documents_approved_by_tsd_fcm" based on condition.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2022 11:07 AM
Hi,
You have not defined the variable 'review' anywhere in your script.
If you are writing this script in onSubmit client script then use g_form.getValue() instead of prducer.variable_name.
Please try below:
function onSubmit() {
var wArray = [];
if (g_form.getValue('tsd_fcm_financial_form)== true) {
wArray.push('31ae898e2f74c1104577debcf699b64e');
}
if (g_form.getValue('cims_information_and_privacy_form') == true) {
wArray.push('acbe898e2f74c1104577debcf699b64e');
}
if (g_form.getValue('office_of_ciso') == true) {
wArray.push('a4f80c5297b54d10953ef3f3a253afb4');
}
if (g_form.getValue('TSD_cloud_concept_form') == true) {
wArray.push('bc19085297b54d10953ef3f3a253af2b');
}
var finalResult = wArray.toString();
g_form.setValue('u_are_documents_approved_by_tsd_fcm', finalResult) ;
}
Thanks,
Anil Lande
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2022 05:45 PM
Hi Mike,
Try the code below.
function onSubmit() {
var wArray = [];
if (g_form.getValue('tsd_fcm_financial_form') == 'true') {
wArray.push('31ae898e2f74c1104577debcf699b64e');
}
if (g_form.getValue('cims_information_and_privacy_form') == 'true') {
wArray.push('acbe898e2f74c1104577debcf699b64e');
}
if (g_form.getValue('office_of_ciso') == 'true') {
wArray.push('a4f80c5297b54d10953ef3f3a253afb4');
}
if (g_form.getValue('TSD_cloud_concept_form') == 'true') {
wArray.push('bc19085297b54d10953ef3f3a253af2b');
}
var finalResult = wArray.join(',');
g_form.setValue('u_are_documents_approved_by_tsd_fcm', finalResult);
}
Execution result:(I've added "return false" at the end to display the result of the script).
What is the script suppose to do? The script is onSubmit and setting a field on the form. If there is not a logic to terminate a submission based on the value, it seems better to create a before business rule to set field "u_are_documents_approved_by_tsd_fcm" based on condition.