Can we create a static method in servicenow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2023 04:28 AM
constructor(name) {
this.name = name;
}
static hello() {
return "Hello!!";
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2023 04:57 AM
Hi @dev115415
Refer below link https://www.servicenow.com/community/developer-forum/what-are-the-implications-of-creating-a-script-...
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- 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.
- 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
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP