How can I use local storage to store a variable using script include?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2021 11:24 PM
Hello,
I want to set a variable value using a script include and use the value in another script include.
Can I do this using a local variable?
If yes can anyone provide a simple example?
- Labels:
-
Script Debugger
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2021 11:28 PM
Hi,
each script include when invoked has it's own scope.
You can pass value from one script include function of Script Include 1 to another script include function of Script Include 2
What is your business requirement
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2021 11:34 PM
Hi Ankur,
Consider two script include A and B.
I want a function in B to be executed only one time depending on the flag value set in A.
In simple terms I want a local storage variable that can be accessed by both A and B.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2021 11:42 PM
Hi,
to invoke the function of script include B from script include A you will have to initiate the object and call the function
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2021 11:44 PM
Hi,
I don't want to invoke function in B from A, I want the code in B to be excecuted depending on value of flag set in A.