Mashup JavaScript page actions
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){}})
- 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){}})
- getGadgetInfo
- Retrieves information about a specified gadget.
For example:
pega.web.api.doAction("gadgetName", "getGadgetInfo", {“callback”: function (response){}})
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.
- Prints the contents of the mashup.
For example:
pega.web.api.doAction("myGadget", "print")
Previous topic Mashup attributes Next topic Mashup action objects