ASP.NET MVC

How To Update And Delete Contact Using Zoho CRM In ASP.NET MVC

Introduction

In this article, we will learn how to update and delete contacts using Zoho CRM in ASP.NET MVC Web application.

Let’s begin

Please read this article first of all here.

If you have not seen How To Get All Contacts Data then I recommend you to see that first. in that article, I described how to get all contacts data using Zoho CRM

C# Code Example

Open the HomeController.cs file and add the below code in it.

Update Contact

public void UpdateContact()
 {
         ZCRMModule moduleInsAccounr = ZCRMModule.GetInstance("accounts"); //module api name
         BulkAPIResponse<ZCRMRecord> responseAccount = moduleInsAccounr.GetRecords();
         List<ZCRMRecord> relatedListsAccount = responseAccount.BulkData;

         List<ZCRMRecord> listRecord = new List<ZCRMRecord>();
         ZCRMRecord record;

         record = new ZCRMRecord("contacts"); //To get ZCRMRecord instance
         record.SetFieldValue("id", contact id);
         record.SetFieldValue("Email", "test@gmail.com"); //This method use to set FieldApiName and value similar to all other FieldApis and Custom field
         record.SetFieldValue(relatedListsAccount[0].CreatedBy.FullName, relatedListsAccount[0].CreatedBy.Id);
         record.SetFieldValue("Company", "KK1");
         record.SetFieldValue("Last_Name", "User1");
         record.SetFieldValue("First_Name", "test1");
         record.SetFieldValue("Phone", "02122020");

         listRecord.Add(record);
         ZCRMModule moduleInslead = ZCRMModule.GetInstance("contacts"); //To get the Module instance
         BulkAPIResponse<ZCRMRecord> responseIns = moduleInslead.UpdateRecords(listRecord); //To call the Update record method
         Console.WriteLine("HTTP Status Code:" + responseIns.HttpStatusCode);
 }

Delete Contact

public void DeleteContact()
  {
      ZCRMRecord record = ZCRMRecord.GetInstance("contacts", contact id);//module api name with record id
      APIResponse response1 = record.Delete();
  }

if you have any questions or issues about this article, please let me know and you can find more details here.

Sagar Rana

Sagar Rana is a Web Developer in Vision Infotech. He has strong skills and knowledge of ASP.NET C#, ASP.NET MVC, .Net Core, Jquery, JavaScript, WEB API, React.js, ADO.Net, Entity Framework, SQL and different integration like Xero, Stripe, Zoho CRM, Square, PayTM, PayKUN, RazorPay, Quickbook Desktop etc.

Recent Posts

Testing hk

Testing

2 years ago

Create and Used PIPE in angular

In this article, we have to show Create and Used PIPE in angular

2 years ago

Operation

Testing

2 years ago

Create and Used PIPE in angular

In this article, we have to show Create and Used PIPE in angular

2 years ago

Create and Used PIPE in angular

In this article, we have to show Create and Used PIPE in angular

2 years ago

TETS NEW

test

3 years ago