gpt-3.5-turbo-1106· OpenAI
Arena Human Preference 55K
write a servicenow business rule in javascript that aborts an update to the sys_user…
- User
write a servicenow business rule in javascript that aborts an update to the sys_user table if the email field is changed and is a duplicate of another record
- Assistant
Certainly! You can use the following JavaScript code to create a ServiceNow business rule to achieve this:
(function executeRule(current, previous /*null when async*/) { if (current.email.changed) { var email = current.email.getDisplayValue(); // Get the new email value var gr = new GlideRecord('sys_user'); gr.addQuery('email', email); gr.addQuery('sys_id', '!=', current.sys_id); // Exclude the current record gr.query(); if (gr.next()) { gs.addErrorMessage('Another user with the same email already exists.'); current.setAbortAction(true); // Abort the update } } })(current, previous);
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.