LinkedIn
Copied!

Table of Contents

Mashup JavaScript page actions

Version:

Only available versions of this content are shown in the dropdown
Applicable to Theme Cosmos applications

The host page JavaScript can perform actions inside a mashup with the doAction() function: pega.web.api.doAction(). This functionality provides you with the tools to meet your particular use case needs.

The parameter signature of the doAction() function has the following components:

  • Gadget name
  • Action name
  • Parameters for specified action
  • Optional user parameter object

For example:

function onCloseFunc(sID) {
            pega.web.api.doAction("PegaGadgetA", "refresh");
            return true;
}

Host page actions that you can define for mashups include:

load
Loads a specified gadget by running the default action.

For example: pega.web.api.doAction("myGadget", "load")

refresh
Refreshes the gadget by running the last gadget action and not the default gadget action.

For example: pega.web.api.doAction("myGadget", "refresh")

reload
Reloads the currently displayed harness that was created by using the default mashup action. A new work object is not created.

For example: pega.web.api.doAction("myGadget","reload")

log off
Logs off the session.

For example: pega.web.api.doAction("gadgetName", "logoff", harnessName, className, paramObject, configObject)

harnessName, className, paramObject, and configObject are all optional parameters. If you do not specify these parameters, the mashup returns the log-off screen. If you define the parameters, the script ends the session but does not refresh the page.

getGadgetData
Retrieves a property value from the gadget. The property must be referenced in the harness that is currently displayed in the specified gadget, or the harness component rules.

For example: pega.web.api.doAction("myGadget", "getGadgetData", "[gadget/myGadget/primarypage.pxCreateOpName]", {“callback”: function (response){}})

For Pega Platform 7.3 and later, include the callback function. For more information, see the support article Mashup: getGadgetData, setGadgetData, getGadgetInfo not working.
setGadgetData
Sets the value of a property or a field on the form that the gadget displays. The property must be referenced in the harness that is currently displayed in the specified gadget, or the harness component rules.

For example: pega.web.api.doAction("gadgetName", "setGadgetData", "primarypage.propertyReference", strValue, {“callback”: function (response){}})

For Pega Platform 7.3 and later, include the callback function. For more information, see the support article Mashup: getGadgetData, setGadgetData, getGadgetInfo not working.
getGadgetInfo
Retrieves information about a specified gadget.

For example: pega.web.api.doAction("gadgetName", "getGadgetInfo", {“callback”: function (response){}})

For Pega Platform 7.3 and later, include the callback function. For more information, see the support article Mashup: getGadgetData, setGadgetData, getGadgetInfo not working.

The action returns the following information about the gadget:

  • Application
  • Thread
  • System
  • isDirty
  • isLoaded

The return object contains the mashup information in the following format: {application:"", thread:"", system:"", isDirty:"", isLoaded:""}

You can process the data by splitting the information at the comma delimiters.

print
Prints the contents of the mashup.

For example: pega.web.api.doAction("myGadget", "print")

For Pega Platform 7.3 and later, include a callback function. For more information, see the support article Mashup: getGadgetData, setGadgetData, getGadgetInfo not working.
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.