Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

JavaScript methods in web embed

Updated on October 21, 2022
Applicable to Cosmos React applications

The host page can use JavaScript (JS) to invoke methods that support querying or manipulating the web embed. This functionality provides you with the tools to meet the needs of your particular use case.

Note: For Cosmos React web embeds, you invoke the JavaScript API directly by accessing the element and calling the method. For example:

document.getElementById("theEmbed").load();

JS API methods

Web embeds support the following JS methods:

load
Used in conjunction with the deferLoad=true attribute to delay the load of the embed until this API is invoked.

Arguments: None

reload
Used to return the web embed to its original attributes. You can use this method to get the user back to the first page that loaded.
For example, if a page contains links to work objects, and the user opens those objects, the embedding displays the case screen associated with the object. The reload method provides a way to return to the original page. This method is similar to the load method, but when the action is createCase, this method remaps the embed to an openAssignment action. In this case, the system uses the ID from the prior createCase invocation for the openAssignment call.

Arguments: None

getEmbedData
Gets the value of a specified property.

Arguments: propName

setEmbedData
Sets the value of a specified property.

Arguments: propName, value

getEmbedInfo
Returns a structure with information about the loading outcome and uncommitted properties.

Arguments: None

logout
Ends the active server session by revoking tokens and removing the content in the web embed. This method also releases open object locks.

Arguments: None

updateTokens
Passes the token object returned from a OAuth token endpoint back to the embedding when popupReauth is specified as “false”.

Arguments: token

  • getEmbedData

    Gets the value of a specified property.

  • setEmbedData

    Sets the value of a specified property.

  • getEmbedInfo

    Returns a structure with information about the loading outcome and uncommitted properties.

  • updateTokens

    Passes the token object returned from a OAuth token endpoint back to the embedding when popupReauth is specified as “false”.

Have a question? Get answers now.

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

Did you find this content helpful?

Want to help us improve this content?

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

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us