Can we create a static method in servicenow?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2023 04:28 AM
How to create a static method in script include in servicenow?
Let us take a simple example written in JavaScript.
class Car {
constructor(name) {
this.name = name;
}
static hello() {
return "Hello!!";
}
}
constructor(name) {
this.name = name;
}
static hello() {
return "Hello!!";
}
}
So how should I write this in ServiceNow?
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2023 04:57 AM
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2023 10:32 PM
Hello @Voona Rohila I could not understand from that article's example.
Like if I do this
StaticFunction: function () {
gs.addInfoMessage("StaticFunction() Called");
},
so here StaticFunction is just a name I think like any name.
Could you please help.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2023 11:23 PM
so here StaticFunction is just a name I think like any name - Yes
