In ServiceNow,
when user clicks on Reference icon, for e.g. on Asset related interface, just to see the referred
record, for e.g. Configuration
Item, it redirects the user to the interface of referred record. Having
said this, if user again navigates back to the Asset interface, auto save for Asset record
is triggered even though no field modification is done on either interface.
This type of behavior is often seen for Reference icon click in ServiceNow. This creates
unintended confusion of record being modified by user who just tried to view
records (for e.g. Asset to Configuration
Item record navigation).
In this scenario, there is no way to stop the update action once
it is initiated on Reference icon click. We can’t call autoSysFields(false) for current record in any business
rule and expect to stop the update of audit fields like Updated and Updated
By. Because autoSysFields(false) is called before update action is
initiated.
If the root cause of update action is known, then as a workaround,
if possible, that logic can be tried to shift from client script to business
rule in ServiceNow. For
e.g. if u_view field is set in any client script for OnLoad event, every time it set the value of u_view field which in turn mark the current
record to modified status. This initiate the update action when Reference icon
is clicked for any referred record. It tries to first update the current Asset
record and then navigates to interface of referred record. In this case, it
looks like user has not modified any field and auto save has been triggered on
Reference icon. To avoid the update action in this case, client script logic
can be moved to a business rule.
For example below script can identify the view name in business
rule (before update), if view name is needed internally for some business
logic.
var transaction =
GlideTransaction.get();
var viewName =
transaction.getRequestParameter("sysparm_view");
Once view name is identified, it can be used for desired purpose
and client script just to set value of u_view field can be deactivated and tested.
If no auto save trigger on Reference icon click, then it means the issue has
been addressed. If not, then it means some other field also changes internally
which in turn trigger update action. Sometime it is not known which field value
changes internally. In that situation below script can be used in business rule
(before update).
var actionName =
action.getActionName();
gs.addInfoMessage('Action performed: ' + actionName);
if (actionName == 'sysverb_check_save'){
if (typeof GlideScriptRecordUtil != 'undefined')
var gru = GlideScriptRecordUtil.get(current);
else
var gru = Packages.com.glide.script.GlideRecordUtil.get(current);
var changedFields = gru.getChangedFields();
gs.addInfoMessage('Fields changed: ' + changedFields.toString());
}
Above code patch will provide the list of fields modified for which
update action initiate on Reference icon click. For e.g. Some financial field
like ‘Cost’ on Asset side, which stores value in currency is initialized at
runtime. By default its value is blank. When form is loaded, its value is
changed to ‘$0.00’ which marks the current record has been modified. In such
scenario, those can be updated with default value as ‘$0.00’ for blank in
existing records and at table level such field can be set to default value as
‘$0.00’ so that it is not blank at the time of record creation. Once this
activity is addressed, try to test and see if Reference icon click trigger
update action.
If it is not possible to move any field logic from client script
to business rule, then it is not possible to avoid the record save on Reference
icon click. As an alternate option, users can be notified that some fields on
the interface has been modified by validating g_form.modified in onSubmit event for actionName == 'sysverb_check_save' and provide an appropriate message by returning false. That will cancel the update
action on Reference icon click. But it will also stop the user from navigating
to the interface of referred record.
Otherwise glide.ui.reference.readonly.clickthrough property value can be changed in UI
properties, if business users have no issue to have the impact on all
interfaces wherein Reference icon no longer appear.
Another workaround is to change glide.ui.clickthrough.popup property to open a new tab every time
user click on Reference icon (instead of opening the referred record interface
in same window). However this change will apply to all interfaces and Reference
icon will also appear in different way.
It is excellent, with full details. For any other depth information training, and free tutorials, demo can visit....
ReplyDeleteCheck this site Tekslate for indepth Servicenow Training
Go here if you’re looking for information on Servicenow Training
Service Now | 21st Century Software Solutions
ReplyDeletewww.21cssindia.com/servicenow
Introduction to Service Now. Introduction to service now instances & Process; b) SNC Navigations; c) SNC Applications and Modules; d) Forms,Lists and Tables ...
Training is an costly Affair …….But what if it is done Online at the convenience of the Trainer & the Trainee sitting in any part of the World……….
Thats what 21cssindia Makes Possible.
. send ur enquiry to contact@21cssindia.com. or Call +917386622889
ServiceNow - Layman Learning
ReplyDeletelaymanlearning.com/servicenow Cached
ServiceNow Training Courses: ServiceNow Accredited Administration Training ITIL® Accredited Training & Certification ITSM (Apollo) Simulation ISO20000 COBIT Six ...
Are you trying to make money from your websites by popup advertisments?
ReplyDeleteIn case you are, did you take a look at Pop Cash?
Thanks for sharing useful information. Very nice article.
ReplyDeleteservicenow training
servicenow training
servicenow certification
Thanks for your valuable information. Looking for further blogs from you.
ReplyDeleteservicenow training
servicenow certification
salesforce online course
ReplyDeletehadoop online course
Data Science online course