OnCellEdit() how can i write validation based on any other field value?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2018 09:26 AM
Hi All,
FIELD VALIDATION:
As per the requirement I need to populate state field value based on country value in list view. i have made state field value dependent on country field.
now the problem is State field shows all the dropdown options when country is empty in the list view. i am writing the oncelledit script to resolve this issue. basically if country is empty script will not allow state value submission.
Now the challenge I am facing is that i am unable to get the country value within the onCellEdit script. g_form.getValue is not working. Is there any alternate ways to resolve it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2018 06:38 AM
Hello,
Can't you do it using onchange client script? I guess you can. What do you mean by g_form.getValue() is not working? Please share the code to understand more.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2018 06:54 AM
onCellEdit doesn't have access to the form, it gives you some control over fields on a list but you can't do conditional stuff like this. To fulfill your requirement you can use a before insert/update business rule, set the condition to 'country is empty' and then in the actions tab tick the abort action box and add a message to your users.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2018 06:59 AM
You might want to take a look at TechNow Ep 33 and use a GlideAjax call in your onCellEdit() client script. You can retrieve the current value of the country field.
BTW, as mentioned, when you are in a list, g_form (which works on the FORM) isn't available, that's why it doesn't work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2022 11:49 AM
Hello,
I am trying to use an onCellEdit client script to take an action when the state field of the alm_hardware table is updated in the list view. Because the substate is dependent on the state field the two fields are changed at the same time on the list view and my onCellEdit client script appears to be calling the AJAX script include just fine, but the state/substate does not change. I have a very similar onCellEdit client script that does work for the substate field on its own and it calls the same script include.
Is there anything special required for onCellEdit to handle dependent field list edits?
Regards,
Eloy Bayona