How To Create Campaigns Using Zoho CRM In ASP.NET MVC

Introduction

In this article, we will learn how to create Campaigns using Zoho CRM in ASP.NET MVC Web application.

Let’s begin

Please read this article first of all here.

C# Code Example

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

public void Createcampaigns()
 {
     try
     {
         ZCRMModule moduleInsAccounts = ZCRMModule.GetInstance("accounts"); //module api name
         BulkAPIResponse<ZCRMRecord> responseAccount = moduleInsAccounts.GetRecords();
         List<ZCRMRecord> relatedLists = responseAccount.BulkData;
         List<ZCRMRecord> listRecord = new List<ZCRMRecord>();
         ZCRMRecord record;

         record = ZCRMRecord.GetInstance("campaigns", null); //To get ZCRMRecord instance

         record.SetFieldValue(relatedLists[0].CreatedBy.FullName, relatedLists[0].CreatedBy.Id);
         
         record.SetFieldValue("Campaign_Name", "User12 test12");
         record.SetFieldValue("Customfield", "CustomFieldValue");
         listRecord.Add(record);

         ZCRMModule moduleIns = ZCRMModule.GetInstance("campaigns");
        
         BulkAPIResponse<ZCRMRecord> responseIns = moduleIns.CreateRecords(listRecord); //To call the create record method

         Console.WriteLine("HTTP Status Code:" + responseIns.HttpStatusCode);
     }
     catch (Exception ex)
     { 

         
     }

 }

 

Get All Campaigns Data

public void GetAllCampaignsData()
{
    ZCRMModule moduleCampaigns = ZCRMModule.GetInstance("Campaigns");
    BulkAPIResponse<ZCRMRecord> responseCampaigns = moduleCampaigns.GetRecords();
    List<ZCRMRecord> records = responseCampaigns.BulkData;
}

 

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

 

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe

Select Categories