script include response return null
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2024 11:57 PM
Hi All,
I'd like to validate multiple fields, all of which must be unique. I handle the validation on Onsubmit event. Below are my settings on the client and backend.
I can't get things to function, and the response from the server side returned null.
What's wrong with my code and settings?
Code on client side
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2024 12:25 AM - edited 01-19-2024 12:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2024 12:40 AM
Thanks Jagadish, I don't see any differences between the code with my code.
I tried and it did not work. alert(answer); <-- return a null

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2024 12:39 AM
Hi @chet shian your script include is returning null due to below error.
your gliderecord has object gr, but below queries your passing gr_cc_personnel. It must be gr.
var gr = new GlideRecordSecure('x_wohp_new_hire_ap_nac_c_cc_personnel');
gr_cc_personnel.addQuery('personnel_type', personneltype);
gr_cc_personnel.addQuery('employee_id', employeeid);
gr_cc_personnel.addQuery('project_site', projectsite);
gr_cc_personnel.query();
if (gr_cc_personnel.next()) {
answer = true;
}
return answer;
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2024 12:44 AM - edited 01-19-2024 12:45 AM
I am getting null return after I replaced gr_cc_personnel with gr
@Harish KM wrote:Hi @chet shian your script include is returning null due to below error.
your gliderecord has object gr, but below queries your passing gr_cc_personnel. It must be gr.
var gr = new GlideRecordSecure('x_wohp_new_hire_ap_nac_c_cc_personnel');
gr.addQuery('personnel_type', personneltype);
gr.addQuery('employee_id', employeeid);
gr.addQuery('project_site', projectsite);
gr.query();
if (gr.next()) {
answer = true;
}
return answer;