Skip to main content
LinkedIn
Copied!

Table of Contents

Adding JavaScript code to Pega Platform applications

Version:

Only available versions of this content are shown in the dropdown

Customize how your offline offline-enabled mobile app stores and synchronizes data by adding JavaScript code to your Pega Platform application.

For example, you can decrease the default synchronization frequency to limit battery consumption and network usage.
  1. Create a branch in your application so that you can later add the file that contains the JavaScript code to your application.

    For more information, see Adding development branches to your application.

  2. Specify how you want to customize your app by creating corresponding JavaScript code.

    For more information, see JavaScript APIs for offline-enabled mobile apps.

    Creating a text file that holds the JavaScript code

  1. In the header of Dev Studio, click Create Technical Text File .

  2. On the Create Text File tab, in the Text File Record Configuration section, configure the text file:

    1. In the Label field, enter a name for the text file.

    2. In the App Name (Directory) field, enter webwb.

    3. In the File Type (extension) field, enter js.

  3. In the Context section, specify the branch and ruleset for the file.

  4. Click Create and open.

  5. Adding the JavaScript code to the text file

  6. On the Main tab, in the text field, enter the JavaScript code that you want to include in your application.

  7. In the upper-right corner of the screen, click Save.

  8. Adding the text file to your application

  9. In the navigation pane of Dev Studio, click Records.

  10. Expand the Technical category, and then click Static Content Bundle.

  11. In the Bundle Name column, open the configuration tab for the rule by clicking pypega_ui_userscripts_offline.

  12. On the Definition tab, click the Add item icon.

  13. In the added row, add the JavaScript code to the UI rule:

    1. In the App name field, enter webwb.

    2. In the File extension field, enter js.

    3. In the File name field, enter the name of the text file that contains the JavaScript code.

  14. Check out the pypega_ui_userscripts_offline rule to your development branch:

    1. Click the arrow next to the Private edit button, and then select Check out to branch.

    2. In the Check Out to Branch dialog box, in the Branch menu, select the branch that you created.

    3. Click Check out to branch.

  15. In the upper-right corner of the screen, click Save.

Merge the branch that contains the checked-out pypega_ui_userscripts_offline into the target ruleset of your application. For more information, see Merging branches into target rulesets.
Suggest Edit
Did you find this content helpful?

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Ready to crush complexity?

Experience the benefits of Pega Community when you log in.

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us