CRUD API for SFDC Custom Object

Preface

This document will articulate the solution design of a restful interface that allows front facing applications create & retrieve worker records  from a salesforce custom object [API Name: worker__c].

Solution Architecture

User Story

  1. Worker App will enable a user to mention the hobby of a worker while creating a record in a custom object in Salesforce .
  2. Worker App will display the list of workers by retrieving the data from a custom object in Salesforce.
  3. Worker API will provide an interface to create, retrieve and delete worker records in the worker custom object in salesforce.

Solution Components

Salesforce – Object Manager

  1. Create a custom object [worker] in Salesforce with field as hobby. 

 

  • Use Salesforce UI to add a worker-1 with hobby as ‘Jogging’.

Worker API

  1. Develop RAML spec using API Designer that will have a  worker as a top level resource with GET method to retrieve the worker,  POST method to create workers and DELETE method to delete the workers.
  2. Implement the API by using Salesforce connector and use query operation to retrieve a worker record and create operation to insert a worker record into the custom object.
  3. Implement the DELETE method by querying the workers records with the name and use the retrieved Ids and delete operation to delete the worker records from the custom object.  

Salesforce Lightning Worker App

  1. Salesforce Platform provides Lightning App Builder which allows developers to build a lightning app on a custom object & also use lightning components.

Demo

  1. Setup initial Data using WorkerApp with worker name as Worker-1 and example hobby like Jogging.

Expected Result

  • WorkerApp will show Worker-1 in the list view.
  • Add 2 workers using the POST Method of Worker API.

Expected Result

  • A new record should be created for each worker in the custom object and ID value should be returned in the response.
  • WorkerApp will show both the workers [John Doe, Jane Doe] in the worker-app list view in Salesforce.
  • Delete 2 workers using the DELETE Method of Worker API.            

Expected Result

  • Worker records for both the workers [John Doe, Jane Doe] specified in the request payload should be deleted from the custom object.
  • WorkerApp will list the initial setup worker of [worker-1] in the worker-app list view in Salesforce.

We use cookies on this site to enhance your user experience. For a complete overview of how we use cookies, please see our privacy policy.