Quantcast
Channel: ServiceNow Community - ServiceNow Scripting
Viewing all 208 articles
Browse latest View live

Could you please advice how to update the ServiceNow Groups Hirarchy?

$
0
0

Hi WorkGroupMgmt, Could you please help me on below? Thank you!

We are “Domestic Loyalty” team and we have 4 ServiceNow groups in our portfolio.
NAISV21
NAISV25
LYLTSVS
OLETDEV

I want update our groups Hierarchy Information’s with correct SME , Owner and mobile details. When I was trying to update my group information in “ServiceNow” site its not allowing me to do it.
Update option is disabled in my service login page

read more


Chat error dialog

$
0
0

Hi
PFA the image and see there is a title "Error" on the top of dialog, if the current chat queue is not available. i just want to change this title. may i know how this can be done???

Create a file server-side with a business rule / script include.

$
0
0

I am digging deep into SN trying to find how to interact with SN APIs so I can create a file server-side and attach said file to a record. I found a function under UI Context menu for "Export" which points to a built-in function called "GwtPollDialog". I'd like to see the raw code that runs this function, but I don't think I can.

Has anyone had experience with dynamically creating files server-side?

If statements by role on a record producer

$
0
0

I am trying to modify an incident record producer, to change the contact type of the incident depending on the role of the user submitting the record producer.

This is the code I am trying out:

var roleITILorRequestedby = g_user.hasRoleFromList("itil, requested_by");
if (roleITILorRequestedby){current.contact_type = "phone";}
else
{current.contact_type = "self-service";}

Doesn't seem to be working. Am I missing something? My syntax checks out.

Thanks!

Cascade fields from Task to Task Time Worked

$
0
0

We're creating Task Time Worked from Incidents and Catalog Task. We'd like to cascade the Caller or Requested For over to the Task Time Worked - Request For field. We'd also like to copy over the Short Description over to the Comments field on the Task Time Worked. I'm having trouble getting a Business Rule to cascade the data over when creating a New Task Time Worked.

Track when a user logins

$
0
0

Created a new u_user_login table that wanting to track everytime a user logs in. I need to run reports to see how many times a person/dept is logging inot the instance.

I created a business rule on the new table with the following settings:
When:after
Insert:yes
Active:yes
Script
var gr = new GlideRecord("u_user_login");

if (current.operation() == 'login')
{
gr.sys_created_by = event.parm1;
gr.sys_created_on = event.parm2;
}

I used the default columns that were created with the table as I just need to track the user and the date.

read more

Making a custom field mandatory on High Priority calls

$
0
0

Hi all, this might seem a simple thing to do for some but im not very clued up in the scripting part of things.

What i am needing:

I created a custom field on our incident form. I want this field(dropdown) only to be visible and mandatory if the incident is a P1 or P2 incident. How do I go about doing this? I would assume a UI script would be best but not sure how to do the scripting.

Thanks in advance.

Survey - script to put in Introduction to display the INC# and the Date the INC was opened.

$
0
0

In the introduction of the survey would like to display the INC# and short description with the date the Incident was opened. Do I do a Client Script and set the introduction field to the text needed?

Thank you for contacting the Service Desk on [DATE].
Please take a moment and rate your recent interaction regarding Incident [NUMBER]: [SHORT DESCRIPTION].


Requery results from the beginning after completed gr.next()

$
0
0

I am trying to find a method of going back to the beginning of a gr.query() after I have already looped through it using while(gr.next()).

//Example START
var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('sysapproval', current.sys_id);
gr.query();

var approved = false;

while(gr.next()) {
if(gr.state == 'approved') {
approved = true;
break;
}
}

//Want to go back to the beginning of same query again here.

while(gr.next() && approved == false) {
if(gr.state == 'requested'&& current.state == 3) {
gr.state = 'not_required';

read more

Client Script not executing on extended table

$
0
0

I am having an issue where a client script that is assigned at the task table will execute on Incident And Change records but when we extended the table for HR records it does not execute at all (and it did work at one time). My script is updating an assignment group when a business service is applied to the form. Any thoughts?

Move from Availabe to selected by default in List collecter

$
0
0

Hello,

Here is my Problem statement which I seek your help for.

I have a List collecter used in a Catalog Item that provides me with filtered list of all software assigned to a user, in our Leaver Request we want to by default be able to move all the item from the available section to the selected section on load so requester doesnt has to manually choose the software (trying to eliminate the possibility of user not selecting certail software while submitting their request), I am looking for your help to achieve this.

read more

Date xxx days from now

$
0
0

Anyone have any thoughts or examples of how to get ServiceNow to take any of the gs.(date records) like Now() and add say 2 days to it? What I'm attempting to to do is make it so that the default date that is presented on a request form shows a date that is at least 2 days in the future? Many of the other tools I support and work with I would just do something simple like Now()+2, however from a ServiceNow perspective all that yeilds is the value for today?

read more

Tabbing order

$
0
0

Hi,

I am new to ServiceNow and would like to know how to change the tabbing order. It is configured in our system such that pressing a tab key takes you to the next field rather than the search icon or knowledge icon next to it. I had a look in the ServiceNow Public Sandbox and the tabbing functionality there is what is expected in our system.

I have a requirement wherein the press of the tab key takes me to the knowledge icon next to the 'Short description' field rather than going to the next field.
Any help will be much appreciated.

Assignment Rules

$
0
0

I would like to use an assignment rule to assign an incident to the correct service desk group based on the callers geo location contained in the users record.

Any help on how to script this would be greatly appreciated - all my attempts have failed.

Mobile Application Field Style

$
0
0

Is there a way to modify the field style of a field being accessed via a record producer using a mobile device.

I have the following script that works on the desktop version, however not the mobile.

--- Client Script ---

function onLoad() {
//Type appropriate comment here, and begin script below
//var field = document.getElementById("IO:b4b5f641c5d911007272015be5c38a91");

var field = gel("IO:b4b5f641c5d911007272015be5c38a91");
field.style.height='50px';

}

Thanks in advance


Create Template from Script

$
0
0

Hi,

Does anyone know if there is anyway that I can create a template "sys_template" from a business rule populating the template field using values from a from on a table?

I have created an "Event Management" Table with an Event Task table. Sometimes event tasks need to be schduled so I need to be able to create a scheduled job (Which I have managed to do via a business rule) and create a template for "Event Task" and fill in the template fields.

Thanks in advance for any help
Dan

Need a solution to print variables to approval request form

$
0
0

Hey all - I'm not big on Jelly but I have a pressing need to express the variables that are expressed on my HR table to my sysapproval_approver table.

I'm just not sure how to get any existing Jelly UI macro to write these variables to the approval table like it does to the hr table. Using the formatter application to create a component that uses " com.glideapp.questionset.DefaultQuestionEditor " works for the HR table and I can use that no problem.

read more

Automate ITIL Licence Removal

$
0
0

We currently have a manual process whereby the ITIL Licence is supposed to be manually removed from an ITIL user if their account is made inactive however because it is a manual process our access management team forget out this step from time to time.
What I would like to do is create a script of some sort that checks if the user has any Roles when the Active flag is unchecked, it then pops up a message warning the person unchecking it, and prompts them to OK or Cancel. OK continues deactivating the account and removes any Roles, Cancel, does just that, Cancels the action.

read more

Approval Activity details (Show admin or System name instead of developer name for Schedule script)

$
0
0

Hi All,

I have created a schedule Job (Automatically run a Script).
In include script I am using a eventQueue and cancelRequest function.

Like

gs.eventQueue(event, current, gs.getUserID(), gs.getUserName());
 
_cancelRequest:function(reqNum){ 
    var scReq =new GlideRecord("sc_request");
    scReq.addQuery('number',reqNum);
    scReq.query();
    if(scReq.next()){ 
        scReq.state=4;
        scReq.stage='closed_incomplete';
        scReq.request_state='closed_cancelled'
        scReq.update();
    } 
}

read more

To hide a form Section based on User role and Order Guide Value

$
0
0

I created a Client Script to show a Form Section on a Request only for someone with the role 'hr' and if the Order guide is "New Hire".
I have created the entry 'New Hire' in the Catalog for the order guide, I have written the Client script and it works for the 'hr' role, but I want it to display only if they are 'hr' and they selected 'New Hire' from order guide (2 conditions) and it would hide the form section if any of the conditions are not met:

function onLoad() {
//to hide the "new hire checklist" form section if role is not hr and Order guide is not Nexio New Hire

read more

Viewing all 208 articles
Browse latest View live