Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions AbortDuplicates.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(function executeRule(current, previous /*null when async*/) {

// Add your code here

var gr=new GlideRecord('incident');
gr.addQuery('caller_id',current.caller_id);
gr.addQuery('short_description','CONTAINS','email');
gr.query();
if(gr.next()){
gs.addErrorMessage("You have already created the incident with the similar short description");
current.setAbortAction(true);
}

})(current, previous);
17 changes: 17 additions & 0 deletions Client-Side Components/Client Scripts/ChangeLocation/Location.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}

//Type appropriate comment here, and begin script below

var loc=g_form.getReference('u_location').state;
alert(loc);
if(loc == 'CA'){
alert("state is CA");
g_form.addOption('preferred_language','africa','Africa');
}else{
g_form.removeOption('preferred_language','africa');
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Script Type

Client Script — onChange

This is an onChange client script in ServiceNow that runs automatically whenever the user changes the value of the Location (u_location) field on a form.
It uses the reference value of that location to check its state and dynamically updates the Preferred Language (preferred_language) field options in real time — without needing to reload the form.
Loading