...
To Fetch Records:
Create a New layout
Table Setup:
Drag and drop a Table component onto layout Designer
Add Table action as New and Refresh
Add row action on Table as Edit and Delete
Assign Model to Table Component:
Assign a model to the Table with the following details:
Type: API
Connection: Choose a connection e.g. Sales Connect
Label gets Auto-populates e.g. Sales Connect
Name gets Auto-populates e.g. Sales Connect
Request:
Method: GET
URL: /services/data/v56.0/query?q=select id,name,site from account
Record Count: Multirecord
Response:
Define or create a schema to fetch the response. This schema will structure the data received from the API call
Code Block { "data": { "records": { "Name": " ", "Id": " ", "Site": " " } } }
In Component Attributes:
Basic:
Model: Select the model e.g. Sales Connect
Schema Source: Select "Response" as the source
Response code: Set the response code to 200
In Fields:
Select data > record
Click on the Table component, and the Model fields will be displayed on the left side
Drag drop the fields on the Table component
Create a new workflow (defining Label and Name)
Show Spinner Action:
Drag and drop the "Show Spinner Action"
Define layout item (e.g., Table), variant, and size
Rest API Action:
Drag and drop the "Rest API Action"
Set the Source API Type to Model
Choose the Model (e.g., Sales Connect) assigned to the Table
Hide Spinner Action:
Drag and drop the "Hide Spinner Action"
Define the layout item
Connect Actions:
Connect the actions in the workflow
Add Condition on Connector Mapping:
After the Rest API Action, set a condition on connector mapping
Condition: Model: Sales Connect, Set Output > Response: data
Save the workflow
Call the workflow on component events
Refresh : tableAction
Select Action as Workflow
Select Config and define Select Workflow: (Select the workflow create for Get e.g. Get and Save)
Save & Run the Layout
Preview:
On preview, click on the Refresh Button.
The Get workflow will be executed, fetching the records
...
To Create Records: POST
Create a New Layout
Form Setup:
Drag and drop a Form component onto layout Designer
Add Form Action as Cancel and Save
Assign Model to Form Component:
Assign a model to the Form with the following details:
Type: API
Connection: Choose a connection e.g. Sales Connect
Label gets Auto-populates e.g. Sales Connect
Name gets Auto-populates e.g. Sales Connect
Request:
Method: Post
URL: /services/data/v56.0/sobjects/Account
Record Count: Single
Body > Schema Designer
Define or create a schema to fetch the response. This schema will structure the data received from the API call
Code Block { "Name": " ", "Site": " " }
Response: No need to define response for POST
In Component Attributes:
Basic:
Model: Select the model e.g. Sales Connect
Schema Source: Select "Response" as the source
Response code: Set the response code to 200
In Fields:
Select data > record
Click on the Table component, and the Model fields will be displayed on the left side
Drag drop the fields on the Table component
Create a new workflow (defining Label and Name)
Rest API Action:
Drag and drop the "Rest API Action"
Set the Source API Type to Model
Choose the Model (e.g., Sales Connect) assigned to the Form
Toaster Action
Drag and drop the "Toaster Action."
Fill Type with "Success" and Message with "Record created successfully!"
Save the Toaster Action
Emit Action
Drag and drop the "Emit Action"
Add the event you have created
Save the Emit Action
Connect Actions:
Connect the actions in the workflow
Add Condition on Connector Mapping:
Before the Rest API Action, set conditions on connector mapping i.e.
Condition 1:
Input Variable: Request :name
Operator: Set
Source Type: Model
Model: Select the model assigned to the form i.e. Sales Connect
Field: Select the field you want to post the record of i.e. Name
Condition 2:
Input Variable: Request :site
Operator: Set
Source Type: Model
Model: Select the model assigned to the form i.e. Sales Connect
Field: Select the field you want to post the record of i.e. Site
Save the workflow
Call the workflow on component events
Click on the form and navigate to Events > Save : Action.
Select Action as Workflow
Select Config and define Workflow: (Select the workflow create for Post e.g. Post and Save)
Save & Run the Layout
Preview:
On preview, check if the record is getting saved by clicking on the Save Button
Note: To execute CRUD for the Rest API go to the layout where you have drag dropped the table
Follow these steps on the layout where you have drag dropped the table
Create a Pop and refresh work flow
Drag and drop POP action and add label and Save
Drag and drop Workflow action and select the workflow created for Refresh Button
Connect the actions and Save the workflow
Click on the table and navigate to Events > New : tableAction
Select Action as Push Modal
Select Config and define Push Modal model
Layout: Choose the layout created for the POST method e.g Connection Post
Modal Header: Create New Records
Modal Size: Large
Event Mapping:
Event: Select the event created on the POST Method layout
Workflow: Select the Pop and Refresh workflow
And Save
Save & Run the Layout
Preview:
To Update Records:
Method: PUT or PATCH (depending on your API)
URL: Set the endpoint for updating records.
Body: Specify the data to be updated using the Model and Schema.
...