Saturday, May 28, 2016

Building WebAPI Using the Sales force Toolkit for .NET- PART 2 (Interaction with Sales force and ASP.NET WebAPI)

CRUD Operation in sales force's contact through ASP.NET WebAPI using sales force api.

if your client has apps on sales force cloud then something you may require deal with an asp.net /mobile application to interact with their sales force cloud.


This article will show you “How to perform CRUD with sales force api in asp.net”


Let's describe first the step involved:-
  • ·         Create a web api project.
  • ·         Add sales force nuget package.
  • ·         Add new api controller.
  • ·         Start developing get/add/edit/delete operation.
o   Get Operation: get all the contacts
o   Get a contact based on email id.
o   Add new contact.
o   Update contact.
o   Delete contact.


Create a web api project. >> Open visual studio 2010/2012/2013. And add empty solution. Thereafter add a web api project to it


Add sales force nuget package. >> DeveloperForce.Force





Add new API controller. >>




 Start developing get/add/edit/delete operation. >> Trying CRUD for contacts ,view your sales force cloud contact tab first as we are going to perform operations for same.

 Navigate to [Contacts]




Get Operation: get all the contacts. >>

Code:-

Result:-

Let us map result  to class object
Code:-

Result:-

Get contact based on email id. >>


Code:-
Result:-


Add new contact. >>

Code:-
Result:-

View New contact in sales force



Update contact detail. >> updating last name for contact in this example

Code:-

Result:-
View update last name in sales force


Delete contact. >>

Code:-


Result:-

Check in sales force                                                                                                                                                                                                  

compeleted crud operations for contacts similary can use same with little modification for leads opportunities, cutom reports etc..

-
Sunit
@SunitKanyan.in

How to perform CRUD with sales force api in asp.net
t