ASP.NET MVC

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

Introduction

In this article, we will learn how to update and delete lead 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 Leads Data then I recommend you to see that first. in that article, I described how to get all leads data using Zoho CRM.

C# Code Example

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

Update Lead

public void UpdateLead()
 {
         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("leads"); //To get ZCRMRecord instance
         record.SetFieldValue("id", lead 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("leads"); //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 Lead

public void DeleteLead()
{
    ZCRMRecord record = ZCRMRecord.GetInstance("leads", lead 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