Working Code

Asked a question
How do I add an icon next to a field in ServiceNow?

Add the following code to the field's attributes: ref_auto_completer=AJAXTableCompleter,ref_contributions=<strong>teams_icon</strong>. Also, create a UI Macro named teams_icon. ...

May 2, 2025 2
Asked a question
Script to only display Variables with an answer from a Record Producer

[apcode language="php"] var gr = new GlideRecord("sc_req_item"); if (gr.get("d5ba793987e39e1093e30d490cbb35f9")) {     var getRole = '';     var variables = gr.variables.getElements();...

April 28, 2025 2
Asked a question
End date should be always greater than start date

[apcode language="php"] function onChange(control, oldValue, newValue, isLoading) { if (isLoading || newValue == '') { return; }  //Type appropriate comment here, and begin script below var...

March 7, 2025 2
Asked a question
How to check if a date aligns with the schedule in ServiceNow?

[apcode language="php"] var date = new GlideDateTime("03-03-2025"); var schedRec = new GlideRecord('cmn_schedule'); schedRec.get('1f64a8c6c3b3169041791485e0013234'); gs.addInfoMessage('Checking...

March 6, 2025 2
Asked a question
Difference between two dates in business duration using ServiceNow schedule

[apcode language="php"] var startDateTime = new GlideDateTime("2025-03-01 09:00:00"); //enter employee start date here   // Instantiate a new GlideDateTime object which has the current date...

March 6, 2025 2
Asked a question
Upload tests and test sets from excel into test management 2.0

This was imported into the "Test Version" (sn_test_management_test_version) table. I mapped the following fields: Test Name → Short Description (on the Test Version table) Owner → Owner (used...

March 4, 2025 2
Asked a question
How To convert an "&" symbol into HTML code on a UI page ServiceNow

Replace & to $[AMP]

February 26, 2025 2
Asked a question
How to Set Up Notifications on the Bell Icon in ServiceNow

Steps: Navigate to All > System Notification > Provider > Notifications. Select New. On the form, fill in the fields.Notifications form Field Description Name Name of the notification....

February 25, 2025 2
Asked a question
Advanced reference qualifier script shows assignment groups based on who is assigned to

[apcode language="php"] var assignedTo = current.assigned_to.toString(); // Important: Convert to string     var userGroups = [];     var grMember = new GlideRecord('sys_user_grmember');...

February 22, 2025 2
Asked a question
Virtual Agent to Create an Incident via User Input ServiceNow

1. Create Virtual Agent Topic: Go to Virtual Agent Designer (/VA in the Application Navigator). Create a new Topic for incident creation, for example: "Create an Incident." 2. Define Dialog Actions:...

February 21, 2025 2
Asked a question
Auto-Assign Incident to a Group Based on the Category ServiceNow

. Create a Business Rule: Name: Auto Assign Incident Group Table: Incident (incident) When: After Insert [apcode language="php"] (function executeRule(current, previous /*null when async*/) {...

February 21, 2025 2
Asked a question
How to display different choices on a Catalog Item based on the user's Language?

Add the following code in the advanced reference qualifier. [apcode language="php"] javascript: var session =gs.getSession(); var userLanguage = session.getLanguage(); if(userLanguage == 'en'){...

February 19, 2025 2
Asked a question
Restrict Specific Users from the Impersonation List in ServiceNow

In ServiceNow, there may be situations where you need to restrict certain users from appearing in the impersonation list. This feature can help maintain security and enforce organizational policies, ensuring...

February 11, 2025 2
Asked a question
Querying a Decision Table from a Client Script

Client Script: [apcode language="php"] function onChange(control, oldValue, newValue, isLoading, isTemplate) {     if (isLoading || newValue === '') {         return;     }      var...

February 6, 2025 2
Asked a question
How to use gsftSubmit on Workspace ServiceNow

User GlideAjax Native View Code [apcode language="php"] function checkMandatoryFields() {      if (g_form.getValue('doa_type') == '' || g_form.getValue('doa_level')...

February 5, 2025 2
Asked a question
Core Features of Virtual Agent and What's New in the Xanadu Release

Core Features of Virtual Agent Natural Language Understanding (NLU): Detects user intent and processes queries using NLU models. Supports multi-language interactions. Out-of-the-Box Topics:...

January 9, 2025 2
Asked a question
How to install Virtual Agent in ServiceNow?

Step 1: Install Virtual Agent Plugins Prerequisite: Ensure you have admin access to your ServiceNow instance. Navigate to Plugins: Go to System Applications > All Available Applications > All....

January 9, 2025 2
Asked a question
Code replicate Export as Excel in incident from list view ServiceNow

[apcode language="php"] function exporttoExcel() {                                  var sysparm_rows = g_list.grandTotalRows;                                 var...

December 20, 2024 2
Asked a question
How to Returns the name of the user for whom the current cart is requested using CartJS

[apcode language="php"] var cart = new sn_sc.CartJS(); var userName = cart.getRequestedForDisplayName(); gs.info(userName);

December 20, 2024 2
Asked a question
How to get the cart details using CartJS ServiceNow

var cart=new sn_sc.CartJS();  console.log (cart.getCartDetails());

December 20, 2024 2
Load More
Scroll to top