embedded list field validation on submission of form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2017 10:51 PM
Hi I have two embedded lists in a form, a field name called uni_number in both the embedded lists, on submission of form or on saving of form, it should throw a notification or error message that uni_number should be 12 digits.... this i have done on the individual tables of embedded lists but it didn't work when user enters data in embedded list....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2017 11:09 PM
yeah i have written business rule
var pur= new GlideRecord("x_rtp_sv_pdi_pack_size_purchase");
pur.addQuery("upc_code", current.upc_code);
pur.query();
if(pur.next()){
var upc=pur.upc_code;
if(upc.length!=12){
gs.addErrorMessage("UPC length should be 12 digits");
}
}
var sal= new GlideRecord('x_rtp_sv_pdi_pack_size_sales');
sal.addQuery('upc_code', current.upc_code);
sal.query();
if(sal.next()){
var upc1=sal.upc_code;
if(upc1.length!=12){
gs.addErrorMessage("UPC length should be 12 digits");
}
}
but its not validating... even though I given 12 digits getting error message as UPC length should be 12 digits

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2017 11:43 PM
how about if you set the field length to only enter 12 char from dictionary level then in that case you don't need to write any script. max length 12
now coming to your script would you try to set some log in your script and check what are you getting when using ups.length.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2017 11:01 PM
Hello Hemanth,
Can you please give more details on how you have implemented your solution i.e " this i have done on the individual tables of embedded lists "
FYI: In case you are validating via client script, this won't be triggered on list view unless it is a OnCellEdit CS.
Please let me know if you have any questions.
P.S: The other solution will be to write a BEFORE business rule on the table and abort the form submission per your logic.