How To write simple JavaScript in Servicenow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
I am embarrassed to ask this question.
I am on lesson 15 of Chuck Tomasi Learn JavaScript on the Now Platform. Trying to work Lab 4. I have a PDI.
My problem is that I don't know what Navigator App or Module to select in order to start writing the simple JavaScript such as the below:
Any help appreciated
// Lab 4:
// Create a script that takes a string variable "Hello world"
// and translates it to at least 3 different languages
// based on a 'language' variable.
// Make the default language English if a match isn't found.
var language = 'German';
var fromString = 'Hello world';
var toString = '';
switch (language) {
case 'German':
toString = 'Hallo Welt';
break;
case 'French':
toString = 'Bonjour le monde';
break;
case 'Spanish':
toString = 'Hola Mundo';
break;
default:
toString = 'Hello, world';
}
gs.info(fromString + ' in ' + language + ' ==> ' + toString);
StacyLen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago - last edited 3 hours ago
Hi StacyLen,
You can run this using 'Fix Scripts' or 'Scripts - Background' in the left nav. Other examples in this video series will use Business Rules, Script Includes, Client Scripts, or scripted REST API. He will direct you in the videos when to use each of these.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi @StacyLen ,
You can also try "ServiceNow snd_xplore.do" as well. Xplore is used to improve development activities and support for instances.
Please mark helpful if it helps.
Thanks,
Aparna