57 lines
2.3 KiB
XML
57 lines
2.3 KiB
XML
<?xml version="1.0" encoding="UTF-8"?><record_update sys_domain="global" table="sys_script_client">
|
|
<sys_script_client action="INSERT_OR_UPDATE">
|
|
<active>true</active>
|
|
<applies_extended>false</applies_extended>
|
|
<condition/>
|
|
<description>Automatically set location to be used field value based on user location</description>
|
|
<field/>
|
|
<global>true</global>
|
|
<isolate_script>true</isolate_script>
|
|
<messages/>
|
|
<name>Set Loaner Location</name>
|
|
<order/>
|
|
<script><![CDATA[function onLoad() {
|
|
|
|
// This uses the dotwalking superpowers of the Scratchpad to use the requestor's city & state as the default location to be used. Make sure whomever you use for testing has values in their user record for this!
|
|
|
|
if (g_form.getValue('location_to_be_used') != '') {
|
|
return;
|
|
}
|
|
|
|
var city = g_scratchpad.city;
|
|
var country = g_scratchpad.country;
|
|
|
|
if (city && country) {
|
|
g_form.setValue('location_to_be_used', city + ', ' + country);
|
|
} else if (city) {
|
|
g_form.setValue('location_to_be_used', city);
|
|
} else if (country) {
|
|
g_form.setValue('location_to_be_used', country);
|
|
}
|
|
|
|
if (city || country) {
|
|
g_form.showFieldMsg('location_to_be_used', 'Value set automatically - you may override by editing', 'info');
|
|
}
|
|
}]]></script>
|
|
<sys_class_name>sys_script_client</sys_class_name>
|
|
<sys_created_by>admin</sys_created_by>
|
|
<sys_created_on>2025-09-12 15:31:07</sys_created_on>
|
|
<sys_domain>global</sys_domain>
|
|
<sys_domain_path>/</sys_domain_path>
|
|
<sys_id>f32bab7f893b22107f446398501e54d1</sys_id>
|
|
<sys_mod_count>0</sys_mod_count>
|
|
<sys_name>Set Loaner Location</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_client_f32bab7f893b22107f446398501e54d1</sys_update_name>
|
|
<sys_updated_by>admin</sys_updated_by>
|
|
<sys_updated_on>2025-09-12 15:31:07</sys_updated_on>
|
|
<table>x_cdltd_loaner_req_loaner_request</table>
|
|
<type>onLoad</type>
|
|
<ui_type>10</ui_type>
|
|
<view/>
|
|
</sys_script_client>
|
|
</record_update>
|