Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The second use case in the ZohoCRM business scenario is processing sales. This page describes the related tasks and the operations you use in the ZohoCRM connector and the other ESB connectors. 

Overview

The flow for processing sales is illustrated in the following diagram. The ESB connectors for ZohoCRM and QuickBooks will be used to connect to each service. 

...

  1. In this use case, you initiate the sales process by creating quotes in ZohoCRM using the insertRecords operation. You then use the getRecordsById operation to retrieve these quotes, and then create them as estimates in QuickBooks using the createEstimate operation.
  2. Retrieve the quotes in "confirmed" status using getRecordsById and create sales orders using insertRecords in ZohoCRM. Retrieve corresponding estimates from Quickbooks using query and create sales receipts using createSalesReceipt.  
  3. Update the status of sales orders as "Closed won" using updateRecords in ZohoCRM.
  4. For these "Closed won" sales orders, create invoices in ZohoCRM using insertRecords , and also create invoices for them in QuickBooks using createInvoice. (Using QuickBooks as an accounting API helps to record book-keeping functionalities by mapping relevant financial details such as customers, invoices, and sales orders in ZohoCRM.)
ZohoCRM operations
QuickBooks operations
Notes

When publishing a ZohoCRM quote in QuickBooks as an estimate, or publishing a ZohoCRM sales order in Quickbooks as a sales receipt, note the following:

...

  • The parameter "zohoSalesOrderId" is taken from ZohoCRM and the parameter "qbSalesReceiptId" is taken from QuickBooks to create invoices.
  • The parameter value takes the form of {<zohocrm-quoteId>:<quickbooks-estimateId>}.

Samples

Code Block
languagexml
titleSample Template for Creating and Retrieving Quote Details
<!-- createAndRetrieveQuoteDetails template is used to create a quote in ZohoCRM and retrieve details -->
<template name="zohocrm-createAndRetrieveQuoteDetails" xmlns="http://ws.apache.org/ns/synapse">
	<parameter name="zohoScope" description="Specify the value as crmapi" />
	<parameter name="zohoAccessToken" description="Encrypted alphanumeric string to authenticate the Zoho credentials" />
	<parameter name="zohoApiUrl" description="The api url" />
	<parameter name="zohoIsApproval" description="To keep the records in approval mode" />
	<parameter name="zohoWfTrigger" description="The wfTrigger parameter is used to trigger the workflow rule while inserting record into CRM account" />
	<parameter name="zohoNewFormat" description="The newFormat, an integer determine weather null valus should be excluded(1) or included(2)" />
	<parameter name="zohoVersion" description="The API version" />
	<parameter name="zohoDuplicateCheck" description="Checking the duplicate records and throw an error response" />
	<parameter name="zohoXmlData" description="The xml string containing the data to be inserted" />
	<sequence>
		<property name="uri.var.zohoScope" expression="$func:zohoScope" />
		<property name="uri.var.zohoAccessToken" expression="$func:zohoAccessToken" />
		<property name="uri.var.zohoApiUrl" expression="$func:zohoApiUrl" />
		<property name="uri.var.zohoIsApproval" expression="$func:zohoIsApproval" />
		<property name="uri.var.zohoWfTrigger" expression="$func:zohoWfTrigger" />
		<property name="uri.var.zohoNewFormat" expression="$func:zohoNewFormat" />
		<property name="uri.var.zohoVersion" expression="$func:zohoVersion" />
		<property name="uri.var.zohoDuplicateCheck" expression="$func:zohoDuplicateCheck" />
		<property name="uri.var.zohoXmlData" expression="$func:zohoXmlData" />
		<property name="uri.var.zohoModuleType" value="Quotes" />
     <zohocrm.init>
        <scope>{$ctx:uri.var.zohoScope}</scope>
        <accessToken>{$ctx:uri.var.zohoAccessToken}</accessToken>
        <apiUrl>{$ctx:uri.var.zohoApiUrl}</apiUrl>
      </zohocrm.init>	  
      <zohocrm.insertRecords>
	    <moduleType>{$ctx:uri.var.zohoModuleType}</moduleType>
        <duplicateCheck>{$ctx:uri.var.zohoDuplicateCheck}</duplicateCheck>
        <xmlData>{$ctx:uri.var.zohoXmlData}</xmlData>
        <isApproval>{$ctx:uri.var.zohoIsApproval}</isApproval>
        <wfTrigger>{$ctx:uri.var.zohoWfTrigger}</wfTrigger>
        <newFormat>{$ctx:uri.var.zohoNewFormat}</newFormat>
        <version>{$ctx:uri.var.zohoVersion}</version>
      </zohocrm.insertRecords>	  
	  <!-- Retrieving the id of the new quote-->
      <property name="uri.var.zohoQuoteId" expression="json-eval($.response.result.recorddetail.FL[0].content)"/>	
		<call-template target="responseHandlerTemplate">
			<!-- parameter values will be passed on to a sequence template -->
			(
			<with-param name="activityName" value="zohocrm_createQuote" />
			|
			) *
		</call-template>		
		<filter source="boolean(get-property('uri.var.zohoQuoteId'))" regex="false">
			<then>
				<loopback/>
			</then>
	    </filter>	  
	 <!-- Retrieving information about the quote-->  
      <zohocrm.init>
        <scope>{$ctx:uri.var.zohoScope}</scope>
        <accessToken>{$ctx:uri.var.zohoAccessToken}</accessToken>
        <apiUrl>{$ctx:uri.var.zohoApiUrl}</apiUrl>
      </zohocrm.init>	  
	  <zohocrm.getRecordsById>
        <id>{$ctx:uri.var.zohoQuoteId}</id>
        <newFormat>{$ctx:uri.var.zohoNewFormat}</newFormat>
        <version>{$ctx:uri.var.zohoVersion}</version>
	    <moduleType>{$ctx:uri.var.zohoModuleType}</moduleType>
      </zohocrm.getRecordsById>	  
	  <property name="uri.var.errorOutput" expression="json-eval($.response.error)"/>	  
		<call-template target="responseHandlerTemplate">
			<!-- parameter values will be passed on to a sequence template -->
			(
			<with-param name="activityName" value="zohocrm_getQuoteById" />
			|
			) *
		</call-template>		
		<filter source="boolean(get-property('uri.var.errorOutput'))" regex="true">
			<then>
				<loopback/>
			</then>
	    </filter> 		
	</sequence>
</template>

...