ServiceNowLearningWithRepo/2c4209629f7322107f44d6013024ab4a/update/sys_script_05bd2737897b22107f446398501e54cc.xml
2025-09-12 15:45:47 +00:00

61 lines
2.6 KiB
XML

<?xml version="1.0" encoding="UTF-8"?><record_update sys_domain="global" table="sys_script">
<sys_script action="INSERT_OR_UPDATE">
<abort_action>false</abort_action>
<access>package_private</access>
<action_delete>false</action_delete>
<action_insert>true</action_insert>
<action_query>false</action_query>
<action_update>true</action_update>
<active>true</active>
<add_message>false</add_message>
<advanced>true</advanced>
<change_fields>false</change_fields>
<client_callable>false</client_callable>
<collection>x_cdltd_loaner_req_loaner_request</collection>
<condition/>
<description/>
<execute_function>false</execute_function>
<filter_condition/>
<is_rest>false</is_rest>
<message/>
<name>Validate Start and End Dates</name>
<order>100</order>
<priority>100</priority>
<rest_method/>
<rest_method_text/>
<rest_service/>
<rest_service_text/>
<rest_variables/>
<role_conditions/>
<script><![CDATA[(function executeRule(current, previous /*null when async*/) {
if (current.end_date < current.start_date) {
gs.addErrorMessage('End date must be later than start date!');
current.end_date='';
current.setAbortAction(true);
// This rejects the submission of the record if you set the end date before the start date
// Food for thought: why was script used here rather than a scriptless business rule?
}
})(current, previous);]]></script>
<sys_class_name>sys_script</sys_class_name>
<sys_created_by>admin</sys_created_by>
<sys_created_on>2025-09-12 15:42:23</sys_created_on>
<sys_domain>global</sys_domain>
<sys_domain_path>/</sys_domain_path>
<sys_id>05bd2737897b22107f446398501e54cc</sys_id>
<sys_mod_count>0</sys_mod_count>
<sys_name>Validate Start and End Dates</sys_name>
<sys_overrides/>
<sys_package display_value="Loaner Request" source="x_cdltd_loaner_req">2c4209629f7322107f44d6013024ab4a</sys_package>
<sys_policy/>
<sys_scope display_value="Loaner Request">2c4209629f7322107f44d6013024ab4a</sys_scope>
<sys_update_name>sys_script_05bd2737897b22107f446398501e54cc</sys_update_name>
<sys_updated_by>admin</sys_updated_by>
<sys_updated_on>2025-09-12 15:42:23</sys_updated_on>
<template/>
<when>before</when>
</sys_script>
<sys_translated_text action="delete_multiple" query="documentkey=05bd2737897b22107f446398501e54cc"/>
</record_update>