- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2023 06:58 PM - edited 01-18-2023 08:16 PM
Hello,
Please I need help fixing the below scripts. It's giving me the following error message "Could not save record because of a compiler error: JavaScript parse error."
I have also attached a screenshot displaying the error message in full with my post.
Thank you.
Below are the scripts
function onCondition() {
If(g_form.getvalue('asset_id_number_1') = '') {
g_form.setvalue('user_name_1', "");
g_form.setvalue('bn_for_user_name_1', ");
}
If(g_form.getValueue('asset_id_number_2') = '') {
g_form.setvalue('user_name_2', "");
g_form.setValue('bn_for_user_name_2', ");
}
If(g_form.getvalue('asset_id_number_3') = > ›) {
g_form.setvalue('user_name_3', '');
g_form.setvalue('bn_for_user_name_3 ', '');
}
If(g_form.getvalue('asset_id_number_4') = '') {
g_form.setvalue('user_name_4', ");
g_form.setvalue('bn_for_user_name_4', ");
}
If(g_form.getvalue('asset_id_number_5') = ") {
g_form.setvalue(''user_name_5', ");
g_form.setValue('uic_for_ws_user_name_5', ");
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2023 08:07 PM
Hi @ID NOBLE
Try this.
function onCondition() {
if (g_form.getvalue('asset_id_number_1') == '') {
g_form.setvalue('user_name_1', "");
g_form.setvalue('bn_for_user_name_1', "");
}
if (g_form.getValue('asset_id_number_2') == '') {
g_form.setvalue('user_name_2', "");
g_form.setValue('bn_for_user_name_2', "");
}
if (g_form.getvalue('asset_id_number_3') == "") {
g_form.setvalue('user_name_3', '');
g_form.setvalue('bn_for_user_name_3 ', '');
}
if (g_form.getvalue('asset_id_number_4') == '') {
g_form.setvalue('user_name_4', "");
g_form.setvalue('bn_for_user_name_4', "");
}
if (g_form.getvalue('asset_id_number_5') == "") {
g_form.setvalue('command_name_of_ws_user_name_5', "");
g_form.setValue('uic_for_ws_user_name_5', "");
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2023 07:03 PM
Hi @ID NOBLE ,
1. if should be in small case specifically "if" not If
2. You have not closed the main function "}"
3. In if condition it needs to be either "==" or !=" or ">=" and it can't be just a "="
Please mark correct if my response has solved your query.
Cheers,
Mohammed Basheer Ahmed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2023 07:18 PM - edited 01-18-2023 07:18 PM
Which line in the scripts should I fix for your number 2 correction please? You have not closed the main function "}"
Thank you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2023 07:35 PM - edited 01-18-2023 07:57 PM
In the end line
After this line g_form.setValue('uic_for_ws_user_name_5', ");
there should be 2 } } instead you've just given 1 }
Please mark correct if my response has solved your query.
Cheers,
Mohammed Basheer Ahmed.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2023 08:02 PM
Hi @ID NOBLE ,
Did these things solve your problem?
Please mark correct if my response has solved your query.
Cheers,
Mohammed Basheer Ahmed.