Quantcast
Channel: ServiceNow Community - JavaScript
Viewing all 197 articles
Browse latest View live

Business Rule not running

$
0
0

Question . Do you have to have ITIL roles for business rules to run.

I have a business rule on a process for Facilities Incident that should close all related Incidents when it is closed. Runs fine if I close it(ITIL) but if a non ITIL user closes it , the BR does not seem to fire.

thanks


getting error for the embedded list saying list is undefined.

$
0
0

hi All,

i am getting error on the form for the embedded list saying the list is undefined.

also the problem is this is happening only in the production instance.

Any help would be really appreciated.

Best Regards,
Namrata Jain

Can you change the style if new comments come in on a list of records?

$
0
0

Can you change the style if new comments come in on a list of records?

Say an incident is assigned to a assignee.
OOTB the notification is on that the assignee will receive an email.
We have turned this off because of the many emails. Instead we would like to have the Incident be highlighted or marked with a certain style.

Is that possible? I have been trying to do this by adding an new style, but I do not know how to do this, should be a kind of javascript saying. If the Comments changes then.....

Anyone can help?

Find a code or a character string in the database

$
0
0

I have often a problem analyzing unfamiliar implementation that I don't know, where a function call or a log trace is placed. Because there may be a "couple" of scripts in ServiceNow you can spend hours studying the source code. Unfortunately, there are no global search function for script code.

I would like to share a background script allow you to get all possible scripts implemented in ServiceNow, custom as well, and than look for a {searchstring}.
It is possible to extend the function with Regular Expression search to searchh more complicated search terms.

read more

How to query the Lease Instance table from the Circuit table to get the contract number linked to the ci_item

$
0
0

I am new to SN and need some help with scripting. I have spent several days on this and I think this should be easy, but I am struggling as I don't have a javascript/Ajax background. Support has suggested using Ajax and pointed me to the wiki.

I am trying to get the Contract Number from the Contract Mgmt -> Leases Screen and show it on the CMDB-> Circuit Screen. My understanding is the table Lease Instance (ast_contract_instance) is the table that holds the data for the Related Links at the bottom of the Contracts Screen.

read more

Additional Comments email condition

$
0
0

Does anyone know how to modify the incident events business rule to where it will not send if comments are added if the text #LiveFeed is in the comments? I know it has to be a condition in the first line that somehow says && CURRENT.COMMENTS DO NOT CONTAIN #LIVEFEED.

if (current.operation() != 'insert'&& current.comments.changes()) {
var cmc = current.comments.getJournalEntry(1);
gs.eventQueue("incident.commented", current, gs.getUserID(), cmc);
}

Eval is Evil

$
0
0

I'm writing some record producers to allow users to update configuration items automatically.

The way I've implemented this is by creating change_request record producers, and adding a Script field to the RP table for Fulfillment Script. When the change is created, once it is approved I check back against the record producer to see if it has a script to run, and then I process the script using eval.

This works fine for me, but I've been told by several people at Service-Now and now calgary is telling me it as well that "eval is evil".

read more

Within a client UI action, is it possible to throw focus on a specific tab?

$
0
0

Within a client UI action, is it possible to throw focus on a specific tab?
If I have an error message appearing in a field on a certain section, and if the focus is on another section (another tab), the message is hidden.


Create UI Action

$
0
0

Is there a script out that for UI Action, that will copy all fields on a form into a new record; basically cloning a record, discarding the record number?

Set Priority for user with out of box functionality in ess

$
0
0

Hi,

I am trying to set the severity of incident same as priority for a user with out of box functionality using ess.
But every time i try to do i fail.. i have created a record producer also but it is not working at all. Can anyone please help in fixing it
What code should be given so that it work only for normal users i.e. customers (users with out of box functionality) can any one help.

Documentation for GlideXML objects?

$
0
0

We have a need to parse XML data in some of our javascripts.
I have seen a few references in the wiki to glide helpers such as GlideXMLUtil and GlideXMLDocument in various code samples.

Is there any documentation that provides descriptions of the available methods and parameters for the GlideXML objects?
Thanks in advance,

Query with OR conditions on a reference field

$
0
0

hi everyone,

i'm trying to migrate some users with their time zones. I thought it'd be pretty easy:

var gr =new GlideRecord("sys_user");
var q1 = gr.addQuery('location.getDisplayValue','=','FHU');
q1.addOrCondition('location.getDisplayValue()','=','FMC');
q1.addOrCondition('location.getDisplayValue()','=','FFS');
q1.addOrCondition('location.getDisplayValue()','=','FOM');
q1.addOrCondition('location.getDisplayValue()','=','FSK');
q1.addOrCondition('location.getDisplayValue()','=','FUD');
q1.addOrCondition('location.getDisplayValue()','=','FUI');

read more

Script include runs multiple times in list filter.

$
0
0

Hi Folks,

I have a strange one that I cannot figure out.

I created a script include that has a function to search for CIs that are related to certain types of changes and return an array of CI sys_ids. The script works fine, but when I call it from a list filter it runs 3 times and the filter does not display the results until the 3rd run is finished. Below is the script include and the call I make to it in the list filter. Thanks for any help.

function u_cis_task_suppression(){
//Check for active CHG w/ matching primary CI

read more

Fix Script Changes not Committing

$
0
0

I've been testing this for a few days and am wondering if I'm missing something simple like .update() because the record states are not actually changed. A couple of our workflows closed RITMs with the wrong state. These are relatively simple, with only one task, so the fix script should check if the task is closed complete and also sets the parent RITM to closed complete. It seems to run, and reports the corrected values, but when I browse the sc_req_item records, the state has not updated.

read more

Getting Javascript with eval correct: Fields Changed Loop

$
0
0

I'm working on a bit of code that sets a flag whenever the value of certain fields changes on our Change Request form. When the flag is set, I can reset the workflow. The code used to look like this

if(current.assignment_group.changes()){
      doReset =true;} 
   elseif(current.type.changes()){
      doReset =true;} 
   elseif(current.start_date.changes()){
      doReset =true;}


which was fine, but more and more fields kept on getting added to the list, so it got harder to read and maintain.

read more


Javascirpt - client script

$
0
0

Hello,
Im beginner but active beginner in Javascript - learn by doing. Im sorry if my question is simple, but I need help from somebody as this is not simple for me as I didnt build something like this before.
Actually we have on our record producer form one field which is type Choice list (string). Available values are in choice list.

read more

JQuery Plugin for ServiceNow

$
0
0

We are trying to use Journal field to keep track of all the incoming and outgoing email. It's basically very similar to the email tracking in Activities, minus all the tracking of the field changes. We are currently adding email body to work notes when an email is sent using Email Client. All is good except some users find it very difficult to track email conversation using Activities. I know they can use the filter to turn off some of the tracking but we are trying to find a cleaner way to display just the email conversation.

read more

Display certain choices in fields when another field choice is selected

$
0
0

Hi folks,
We have a field called 'Incident Type' (u_incident_type)
It has a choice list with a few choices.
When Choice 2 is selected we wanted to display an alert which I have working in the below 'onChange' Client Script.
We want to expand on that and also make 2 additional choice fields change when option 2 of the Incident type field is selected too.
The fields are called 'impact' and 'urgency' and we want both their fields to change to choices '2' when choice 2 of the Incident Type field is selected.

read more

How to configure a derived columns in the table

$
0
0

I would like to have derived columns in a table. the value of the column is depending on the other column value. (Example , age which is derived from the data of birth column). please adivse me how to populate the value for the derived column. Thanks in advance..

Five different ways to write a GlideRecord query

$
0
0

customer_script1.png

What you may have noticed using ServiceNow is that there is more than one way to get something accomplished. Let's check out some of different ways you can write a glideRecord query.

read more

Viewing all 197 articles
Browse latest View live