Invoke Connector Task
After a connector is published and associated with an extension or vertical solution, it can be invoked whenever necessary. You can invoke a connector using a custom function.
Syntax
<Response> = zoho.crm.invokeConnector("<ConnectorAPI Unique Identifier>", <parameterMap>);
where,
<Response> is the task response returned as a Map.
parameterMap is used to map any dynamic value present in the connector with user inputs.
ConnectorAPI Unique Identifier refers to the connector API you want to use.
You can find details of the Connector API unique identifier in the List Of APIs page (screenshot below). Navigate to this page by clicking Connectors in the left pane, clicking the Associated Connectors tab, then clicking View All APIs for the desired connector.
In the List Of APIs page, click the name of the API that you want to use. The API Unique Identifier will be displayed in a pop-up as shown below.
Example
Post data from extension or vertical solution to your third party account.
Suppose you want to add the contacts from your extension or vertical solution to Google Contacts whenever a new contact with India as the mailing country is added. To achieve this, you need to write a custom function to invoke the connector and associate the custom function to a workflow rule.
Create a workflow rule with the following inputs:
Module: Contacts
Rule Trigger: A Record Action whenever a record is created
Rule Criteria: Mailing Country is India
Actions: Call Functions
The script for the custom function to be added is:
Fnam = input.contact.get("First_Name");
Lnam = input.contact.get("Last_Name");
mail = input.contact.get("Email");
Mob = input.contact.get("Mobile");
map = {"Fname" : Fnam, "Lname" : Lnam, "Email" : mail, "Mobile" : Mob};
response = zoho.crm.invokeConnector("googledrive.contacts",map);
For more details on how to create a connector and invoke it in a custom function, click here.