Mashup action objects
If you want your mashup to perform custom actions, or if several mashups on your web page need to interact with one another, you configure mashup action objects inside the mashups. A mashup action object is defined as an object literal that is assigned to a JavaScript variable with the same name as the mashup.
The attributes and parameters that constitute a mashup action object have the following components:
var PegaGadgetSample = { actionDefinitions: [ { action: "", actionMapping:"", target: { type:"", name:"" } config: { systemID:"", appName:"" thread:"" } pageURL: "", params: { harnessName: "", className: "", model: "", flowName:"", page: "", readOnly:"", key:"", workID:"", UserDefinedName:"" }, popup:{ options:"" gadgetReference:"", } } ] }
With the actionDefinitions
section, you can define the following
tasks:
- Specify an array of actions. For the list of possible actions, see the "Mashup object actions" section.
- Map an action to another action, typically in another mashup, with the actionMapping attribute. For the list of possible target types, see the "Mashup object target types" section.
- Use the config attribute to specify the systemID, appName, and thread values for the target mashup. Specify $INHERIT as the value for each parameter to make the value in the target gadget the same as in the current mashup.
- Repeat the same action multiple times with the same or different targets.
In the params
section, the listed parameters are action-specific.
The parameters match the action-specific attributes for the mashup. For more
information, see Mashup attributes.
Mashup object actions
The following actions can be defined inside a mashup object:
- openNewWorkItem
- Opens a new work item.
- createNewWork
- Navigates the mashup to the new harness specified in the starting flow.
- closed
- Runs when the harness indicates that a user closed the harness. You cannot use the closed action as the action in an action mapping, only as a source action.
- confirm
- Runs when the system loads the harness. You cannot use the confirm action as the action in an action mapping, only as a source action.
- display
- Shows the harness that is specified by the harnessName and className parameters.
- getNextWorkItem
- Navigates the mashup to the work item selected by the GetNextWork feature.
- loaded
- Runs when the system finishes loading the harness. You cannot use loaded as the action in an action mapping, only as a source action.
- openAssignment
- Navigates the mashup to the specified assignment and displays it in the harness that is specified in the assignment.
- refresh
- Reloads the mashup by using the most recent mashup action. The refresh action reloads or reprocesses any data references in the mashup.
Mashup object target types
The target types for the action definitions include the following items:
- _self
- The same mashup.
- _gadget
- The mashup specified by name with the name attribute.
- _popup
- The pop-up defined with the popup attribute.
- _top
- The web page that hosts the mashup.
- _page
- The web page that is specified with the pageURL attribute.
Mashup action object example
In this example, a mashup that the host page displays as GadgetA opens an assignment in another mashup that the host page displays as GadgetB. When the assignment is finished, GadgetB refreshes the work list in GadgetA.
<div id="PegaGadgetA" style="overflow:auto" data-pega-gadgetname="PWGadgetA" data-pega-action = "display" data-pega-harnessName = "PegaWebAssignList" data-pega-classname = "Assign-Worklist" data-pega-isreadonly = "true" data-pega-threadname = "ThreadA" data-pega-applicationname = "AutoClaim" > <script> var PWGadgetA = { actionDefinitions: [ { action: "openAssignment", target: { type: "_gadget", name: "PWGadgetB" } } ] }; </script> </div> | <div id="PegaGadgetB" style="overflow:auto" data-pega-gadgetname ="PWGadgetB" data-pega-threadnamePegaThread = "ThreadB" data-pega-applicationnamePegaAppName = "AutoClaim" > <script> var PWGadgetB = { actionDefinitions: [ { action: "confirm", actionMapping: "refresh", target: { type: "_gadget", name: "PWGadgetA" } } ] }; </script> </div>
Previous topic Mashup JavaScript page actions Next topic Best practices for using mashups