REST API Use Case: Create, update and delete records from Oracle

Now you can view, create, edit and delete data from external sources in Salesforce. Skuid’s done the hard work so you can set it all up declaratively (aka without writing any code). In this example, we’ll be using Skuid’s REST data source type to pull in info from an employee database in Oracle.

Step 1: Create a new data source.

image0

  1. Navigate to Configure > Data Sources > Data Sources.
  2. Click New Data Source.

image1

  1. Name this data source.
  2. Choose REST as the Data Source Type.
  3. Click Next Step.
  4. Enter the URL of the service.
  5. Click Save.

Click OK and Skuid will create the Remote Site Setting for you.

image2

Click OK and Skuid will create the Remote Site Setting for you, if you don’t already have one for this URL. If you click Cancel, you will have to create the Remote Site Setting yourself.

Step 2: Go to the page where you want to add this model or create a new page.

image3

Click Compose to view a list of all Skuid Pages, or Compose > New Page to create a new one.

Step 3: Create a New Model.

image4

  1. Click Models.
  2. Click to add a new model.
  3. Choose REST as the Data Source Type.
  4. Choose the Data Source you created earlier in this tutorial.
  5. Choose whether this model should be Read-Only or Read/Write.
  6. Enter a Label and Plural Label for this model.

A. Add Methods.

image5

  • If you selected Read/Write, you have to specify which methods you would like to use.
  • If you choose Read-Only, then you can specify the Data Source URL and Data Source HTTP Verb in the Basic model properties screen.

B. Query Method

image6

The Data Source URL will be added on to the URL you’ve specified for this Data Source in Step 1. You can use {{merge syntax}} to include fields from other models, or values that you want to use in URL Merge Conditions.

C. Insert Method

image7

  1. Use the Insert method if you want to create records for this Data Source.
  2. The Data Source URL will be added on to the URL you’ve specified for this Data Source in Step 1.
  3. Choose how to send the new field values back to this service - as JSon, in request headers, or in URL Parameters.
  4. Specify the details of how headers will be mapped to fields, what constitutes success for this method, and how to handle responses.

D. Update Method

image8

  1. Use the Update method if you want to edit records for this Data Source.
  2. The Data Source URL will be added on to the URL you’ve specified for this Data Source in Step 1. In this case we’re adding the Employee Number field using Merge Syntax (see Step 5 below) map the updates to the correct Employee Record.
  3. Choose how to send the new field values back to this service - as JSon, in request headers, or in URL Parameters.
  4. Specify the details of how headers will be mapped to fields and what constitutes success for this method.

E. Delete Method

image9

  1. Use the Delete method if you want to delete records from this Data Source.
  2. The Data Source URL will be added on to the URL you’ve specified for this Data Source in Step 1. In this case we’re adding the Employee Number field using Merge Syntax (see Step 5 below) map the updates to the correct Employee Record.

Step 4: Choose the fields you want to show in your page.

image10

  1. Click Fields.
  2. Check the boxes next to the fields you want to include.

Best Practice: Always include the external ID field. In this example it is the Employee Number field.

Drag and drop these fields into any Skuid component you want.

image11

Just make sure that component is connected to the right model!

If you want to use the Table Search box on this data, then set it to search Client-side.

image12

  1. Click on your table.
  2. Click Filters & Search in the Properties Pane.
  3. Click Search Properties.
  4. Select Client as the Search Method.

Step 5: Click Save, then click Preview to open your page in a new tab.

image13

Success! You are now able to search, update, create, and delete records from your Oracle Database right from Salesforce.

image14

Notice that there’s no visual difference between this table and any other Skuid table on data from Salesforce or any other source, so you can view your data as a cohesive whole, regardless of where it comes from. Feel free to add a Title Component to this page though, to remind yourself, like I did, that “This Data comes from Oracle!”

Troubleshooting Tips