Built-in Actions
VB Studio provides a set of built-in actions that you use to create your action chain.
Each action performs a specific function and requires you to set different properties. For example, when you add the Call REST endpoint action to your action chain, you need to specify the endpoint and other details about the response to the Call REST endpoint action. Similarly, when you add the Navigate action to an action chain, you are required to select a page that the action navigates to, as shown here:
Regarding an action's output, an action can have multiple potential outcomes (such as success or failure, or a branch), and it can return results. For more details, refer to Action Results in the Oracle Visual Builder Page Model Reference guide.
Use this section to learn more about the steps particular to a built-in action.
Note:
Some built-in actions might be deprecated over time. To view actions deprecated in the latest release of VB Studio, use the Show Deprecated option in the Actions palette's menu. The actions will show up in the actions palette, but won't be updated any more. The Show Deprecated option gives you time to move away from deprecated actions in your action chains.Add an Assign Variables Action
You add an Assign Variables action to an action chain to map the source of some value to a variable. The variable can be used by other action chains or bound to a component.
For example, if your action chain sends a request to a GET endpoint, you can use the Assign Variables action to map the response to a page variable bound to a page component. Or, suppose you want to capture the ID of an item selected in a list. You could use a Selection event to start an action chain that assigns the selected item’s ID to a variable.
To add an Assign Variables action to an action chain:
- Open the Action Chain editor for the page.
- Create an action chain, or open an existing action chain to add the action in the editor.
- Drag Assign Variables from the Actions palette into the action chain.
You can drag the action onto the Add icon (
) in the action chain, or between existing actions in the chain. The properties pane opens when you add the action to the chain.
Description of the illustration action-chain-editor-assignvariable.pngThe Assign Variables action is badged with a warning icon when no variables have been assigned.
- Update the ID field in the Properties pane to make the action more easily identifiable.
- Click Assign in the properties pane to open the Assign Variables window to map the source of the value to a page variable.
- Drag the sources of the values in the Sources pane onto targets in the Targets pane. Click Save.
Each target can only be mapped to one source, but you can use the action to assign multiple variables. For example, you might want to map a value from the Chain in the Sources pane, such as an input variable or the result of an action, to a Page variable or to the input of another action in the Target pane. When you select the variable in the Target pane, the expression editor in the dialog box displays the expression for the source.
If you need to define the variable, use the + icon to open a dialog where you can define a variable for the artifact (action chain, page, flow, or application).
Description of the illustration action-chain-editor-assignvariable-mapdialog.png
Use Filter Builder to Create Filter Criteria for an SDP
If you're using an SDP to provide a table or list's data, and you'd like to filter out rows, you can use the Assign Variable action to create and assign the filter criteria to the SDP's filterCriterion property. For further details about using an SDP to filter a table or list's rows, see Filter Data by Filter Criteria
When the Assign Variable action's Variable property is set to an SDP's filterCriterion property, the Filter Builder appears under the Variable property for you to create the filter criterion.
- In the Properties pane, click Assign to open the Assign Variables window:
- In the Target pane, open the node for the SDP that's connected to your table or list, and select its filterCriterion property.
When an SDP's filterCriterion property is selected in the Target pane, the Filter Builder appears for you to create the filter criterion. Alternatively, you can expand the SDP's filterCriterion property in the Target pane and build your filter by specifying values for the
attribute
,op
, andvalue
properties.To directly work with the code, click the Code button. For details, see Filter Builder's Code Editor.
Description of the illustration filter-builder-assign.png
To use the Filter Builder to create the filter criterion for the SDP:
- Click the Filter Builder's Click to add condition link. To create the filter criterion:
- For the first Attribute textbox, enter the name of the column (record field) that you want to compare its values against the user's inputted value.
- For the Operator drop-down list, select the operator for the criterion.
- For the second Attribute textbox, select the page variable that was bound to the Input Text component.
- To add another condition, click the Add Condition link to add a condition with an AND or OR operator, or click the Add Group link to add a group of conditions that are to be evaluated together (conditions enclosed in brackets). To combine conditional expressions with the AND operator, select Match All, and to combine them with the OR operator, select Match Any:
- Click Done when you're finished.
Filter Builder's Code Editor
You can use the Filter Builder's Code tab to view and edit the filter's code. After defining a condition on the Builder tab, you will see that the Code tab contains an attribute
, op
and value
property.
Here's an example of a filter with two conditions combined by an AND operator:
{
"op": "$and",
"criteria": [
{
"op": "$eq",
"attribute": "name",
"value": "{{ $page.variables.filterVar }}"
},
{
"op": "$eq",
"attribute": "id",
"value": "{{ $page.variables.idVar }}"
}
]
}
- The Oracle JET operator is "
$eq
" (it must include the dollar sign (“$
”)). - The
attribute
property is set to the name of the field (column) that you want to be evaluated against thevalue
property. - The
value
property ($page.variables.customerListSDP.filterCriterion.criteria[0].value
) is mapped to a page variable ($page.variables.filterVar
) that holds the value to be evaluated against each field (column) value.
Add a Call Action Chain Action
You add a Call Action Chain action to an action chain to start a different action chain. The action can call other action chains defined in the same page, parent flow, or App UI.
Note:
You can call a JSON action chain from a JavaScript action chain using this action; however, you can't call a JavaScript action chain from a JSON action chain.To add a Call Action Chain action:
Add a Call Component Action
You add a Call Component action to an action chain to call a method on a component.
To add a Call Component action to an action chain:
Add a Call Function Action
You add a Call Function action to an action chain to call a function defined for the current page, current flow, or the application. You create and edit module functions in the JavaScript editor.
To add a Call Function action to an action chain:
Add a Call REST Action
When you add a Call REST action to an action chain, you might need to specify input parameters for the endpoint request or create variables for the endpoint response that you can bind to page components.
When you add the Call REST action to an action chain, the endpoint that you select will depend upon the functions that are available. Depending on the function, you might also need to create some variables to map to the action’s parameters, such as input parameters and the action’s results. For example, an endpoint might require an ID to identify a record. In this case, you will need to create a page variable that stores the ID, and that variable needs to be mapped to the action’s input parameter. If you did not create the variables before creating the action chain, you can create a variable during the process of creating the action chain; you can also edit the action chain after creating the variables you need.
You will use the Call REST endpoint action in action chains that perform typical functions such as creating, updating, and deleting records, and any time you want to display the details of a record in a page. You can use the Quick Starts to help you create the action chains and variables for these functions.
Type of Endpoint | Typical Requirements |
---|---|
POST |
When you call a POST endpoint, you will typically need:
|
GET |
When you call a GET endpoint, you will typically need:
When you want to send a request to a GET endpoint to retrieve a collection, you will typically use a page variable of the type ServiceDataProvider. |
DELETE |
When you call a DELETE endpoint, you will typically need:
|
PATCH |
When you call a PATCH endpoint, you will typically need:
|
To add a Call REST endpoint to an action chain:
Add a Call Variable Action
You add a Call Variable action to an action chain to call a method on an InstanceFactory variable defined for the current container (flow, page, or application). You can use this action to call any method on the current instance associated with the InstanceFactory variable, including asynchronous ones.
Note:
Because actions are by design synchronous, it will wait for the asynchronous call to resolve before proceeding to the next action in the chain.Before you use a Call Variable action in an action chain, make sure an InstanceFactory type variable is already defined for the application. See Create a Type From Code.
To add a Call Variable action to an action chain:
Add a Fire Data Provider Event Action
You add a Fire Data Provider Event action to dispatch an event on a data provider to reflect changes to your data. For example, a component using a particular ServiceDataProvider may need to render new data because new data has been added to the endpoint used by the ServiceDataProvider.
To add a Fire Data Provider Event action to an action chain:
Add a Fire Event Action
You add a Fire Event action to invoke a custom event that you have defined in your application.
A custom event can be defined in an application, flow or page, and can be used to perform some action, such as navigating to a page. A custom event can carry a payload that you define when you create the event. The Events editor displays a list of the custom events available in the context.
To add a Fire Event Action:
Add a Fire Notification Action
You add a Fire Notification action to display a notification to the user in the browser window.
There are four types of notifications: Info, Error, Warning and Confirmation. The notifications display a summary and a message underneath:
Description of the illustration jac-notification-type-examples.jpg
To add a Fire Notification action:
Add a Get Location Action
You add a Get Location action to get a user’s live location. This action requires the user's consent. As a best practice, it should only be fired on a user gesture, so users can associate the system permission prompt for access with the action they just initiated.
To add a Get Location action to an action chain:
Add a Reset Variables Action
You add a Reset Variables action to reset variables to their default values, as specified in the variable definitions.
To add a Reset Variables action to an action chain:
Add a Scan Barcode Action
You can add the Scan Barcode action when you want your application to decode information such as URLs, Wi-Fi connections, and contact details from QR codes and barcodes.
Note:
The Scan Barcode action relies on browser APIs and is supported only on Chrome for VB Studio apps.To add a scan barcode action to an action chain:
Add a Share Action
You add a Share action to share content with other applications, such as Facebook, Twitter, Slack, and SMS, by invoking the native sharing capabilities of the host platform. This action requires the user's consent. As a best practice, it should only be fired on a user gesture, such as a button click.
Note:
Web apps require the web browser running the app to support the Share action. Currently, not all browsers support this native feature.To add a Share action to an action chain:
Add a Take Photo Action
The Take Photo action, used to access the camera or the image gallery on the device where your application is installed, is deprecated. Use the JET file upload component, or the camera component in the Components palette which uses the JET file upload component.
To add a Take Photo action to an action chain:
Add a For Each Action
You add a For Each action to execute another action for each item in an array. The action in the loop will be executed once for each item in the array.
To add a For Each action to an action chain:
Add an If Action
You add an If action to evaluate an expression based on conditions and return a 'true' outcome if the expression evaluates to true, and a 'false' outcome otherwise. You use this action typically to execute custom logic, say to validate data before you actually call REST APIs in your action chain.
To add an If action to an action chain:
Add a Return Action
You add a Return action as the final action of a chain to control the outcome and payload of that chain. It's particularly useful in a Call Action Chain action to control the payload resulting from calling that action chain.
To add a Return action to an action chain:
Add a Run In Parallel Action
You use the Run In Parallel action to run multiple action chain paths in parallel, wait for their responses, and produce a combined result.
Add a Switch Action
You add a Switch action when you want to evaluate an expression and create an outcome with that value. An outcome of "default" is used when the expression does not evaluate to a usable string.
Add a Navigate Action
You add a Navigate action to navigate to a specific page and optionally pass parameters to activate that page.
To add a navigation action to an action chain: