Reuse Client Script with Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2017 03:01 PM
Hello
I was watching the discussion
Now I want to reuse client scripts for catalog items that will work under Service Portal. But we have the issue that the functions declared at the onLoad client scripts, are not recognized by the other client scripts, the functions seems to be mising when are called by other client scripts,
we have the function getNumberOfNights at the OnLoad Client Script BDA Recalc Totals-OnLoad, the mentioned function is being called at a onChange Client Script BDA recalc-Check-in
I am getting this error at the browser(Chrome) debug console
Despite I am using Varset as proposed at the mentioned discussion, I am still getting the error below (when is running under Service Portal)
js_includes_sp.jsx?v=03-22-2017_2340&lp=Wed_Jul_05_10_02_00_PDT_2017&c=12_202:64225 (g_env) [SCRIPT:EXEC] Error while running Client Script "BDA recalc-Check-in": ReferenceError: getNumberOfNights is not defined
How can we work with shared Client Script functions, when we are under Service Portal?
Adding Jim Coyne to the loop
Thanks!
Jesús
- 2,496 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2017 06:48 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-21-2017 07:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2017 07:30 AM
Is your problem addressed? I have a similar issue. It is terrible from a maintenance perspective to write the same functions in all client scripts. There has to be a way to write re-usable code for Service Portal...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2017 12:15 PM
Ritesh
I didn't find a solution for this, the work around that I applied was to replicate the functions at the client scripts. And part of the logic I was stored as ajax script includes to be called in each client script.
The advantage of this work around is that the logic at the Ajax side is not replicated at the client scripts.
Regards
Jesus