1. ServiceNow Scripting
  2. ServiceNow Scripting Objects
  3. ServiceNow Scripting API
  4. Client Script Requirement
  5. Business Rule Requirments
  6. Inbound Action
  7. Requirement Sheet
  8. Only Admin should be able to see Resolution Information tab
  9. From P3 & P4 user can’t derectly set to P1 but from P2 they can set P1
  10. Directly P1 Incident can’t be created
  11. Child Incident should close once parent Problem close
  12. Populate list type of fields in servicenow in Incident Form
  13. For Critical Priority, font will be bold and background will be red
  14. Create a field on Incident form called Expected Data, if incident move to Pending this date will be add 7 days from current date

Client Script Requirement

Requirement 1:

On incident form we have caller field which is an reference field i want to create 4 more field which is in read only i.e. his Mobile Number,Email id, First Name, Last name. When ever we select the caller, it will autopopulate the above calller details.(using Glideajax and script include)

Object: Onload Client Script

Method: GlideAjax & GlideRecord & GlideForm



Client Script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
g_form.setReadOnly('u_custom_mobile', true);
g_form.setReadOnly('u_first_name', true);

alert('Script Run ' + g_form.getValue('caller_id'));
var gx = new GlideAjax('UserDetails');
gx.addParam('sysparm_name', 'callernameandphone');
gx.addParam('sysparm_user', g_form.getValue('caller_id'));

function getData(response) {
var answer = response.responseXML.documentElement.getAttribute('answer');
if (answer) {
var tempValue = answer.toString().split('|');
g_form.setValue('u_custom_mobile', tempValue[0]);
g_form.setValue('u_first_name', tempValue[1]);


Server Side Script:
var UserDetails = Class.create();
UserDetails.prototype = Object.extendsObject(AbstractAjaxProcessor, {
callernameandphone: function() {
var usrId = this.getParameter('sysparm_user');
var gr = new GlideRecord('sys_user');
return gr.getValue('mobile_phone')+'|'+gr.getValue('first_name');

type: 'UserDetails'

No responses yet

Leave a Reply

Your email address will not be published. Required fields are marked *