Question

Best place to include javascript function?
If I want my javascript function available through out the application.
What would be the best place where I can include my js file?
Which I will be able to call directly from a html rule, or through run script.
P.S
I am using Pega 7.1.7, IE 11 browser
-
Like (0)
-
Accepted Solution

How about including the bundle desktopwrapper • script ?
After which the function is available throught the application.
Is this way ok? or including it in the harness should be the standard way?
Both the method seems working. Is the first method , i.e the Bundle way seems ok?

Portal harness. Refer JS rule in 'Scripts and Styles' tab.

Then I need to put that in all the portal harness.
So if someone creates a new portal harness and forgot to use that then the script wont work.
It will be a additional thing that has to be kept under observation.
Is there any other place where if we include, then we need not any where in the system ?

so we're attempting to apply this js by default? if that's the case - would customizing HTML fragment 'UserWorkForm' helps? Please share your thoughts/comments, Thank you!

Will try and share the result, Is there any other way. I thought there might be some bundle where I need to add my js

If you truly need it on every screen without fail, then UserWorkForm is the place to add it. Keep in mind this will impact every portal - including Designer Studio.
I don't think that adding it to individual portal harnesses is too much of an ask, and is in my opinion the safer location. I have never seen an application with more than 3-4 individual portals, and you typically don't want developers creating them on a regular basis in your application. Any new portal should be thoroughly vetted to ensure it's necessary and planned out before build.

I wanted to make this js available through out the application, so that I can call the script in them from anywhere in the application. From a button click using runscript, from a custom html rule and so on..
Accepted Solution

How about including the bundle desktopwrapper • script ?
After which the function is available throught the application.
Is this way ok? or including it in the harness should be the standard way?
Both the method seems working. Is the first method , i.e the Bundle way seems ok?

Thanks for the Confirmation âº

this rule should be kept under observation while upgrade, right?
As the bundle rule may be upgraded in prpc upgrade, and we need to make sure to include our rule in the latest bundle.

>>> this rule should be kept under observation while upgrade, right?
yes

Thanks for the confirmation âºâº