Usecase: Use custom buttons in Zoho CRM to do the following:
- Push (create/update) a Zoho CRM contact to Zoho FSM. If the contact has an associated account, create that account as a company in FSM.
- Push (create/update) a Zoho CRM account as a company to FSM.
Follow the steps below to implement this usecase:
Step 1: Create a connection for Zoho FSM in Zoho CRM
Step 2: Create a custom button
Step 3: Create a custom function
Step 1: Create a connection for Zoho FSM in Zoho CRM
To create a connection for Zoho FSM that can be used in Zoho CRM for invoking the Zoho FSM APIs, do the following:
- Log in to Zoho CRM.
- Navigate to Setup > Developer Space > Connections and click Create Connection.
- In the Create Connection page, select the Custom Services tab and click Create New Service.
- In the Create Service page, enter the following details and click Create Service.
- Service Name: Zoho FSM
The Service Link Name will be automatically populated. - Authentication Type: OAuth2
- Parameter Type: Header
- Generated Client ID, Client Secret
- Authorize URL: https://accounts.zoho.com/oauth/v2/auth?access_type=offline&prompt=consent
- Access Token URL: https://accounts.zoho.com/oauth/v2/token
- Refresh Token URL: https://accounts.zoho.com/oauth/v2/token
- Scope: ZohoFSM.modules.all
Provide values for Scope Display Name.
- Click Create Connection.
- Do the following and click Create And Connect:
- Connection Name: FSMConnection
- Select the Scopes ZohoFSM.modules.all
- Click Connect in the authentication page.
- Click Accept in the authorization page.
In the
custom function, where FSM APIs are used via the invokeURL task, use this
Connection Link Name.
Create a custom button in the Contacts module to push a CRM contact and its associated account as Contact and Company in FSM respectively. If the contact is already present in FSM, then update the record details.
To create a custom button:
- Navigate to Setup > Customization > Modules and Fields and click the Contacts module.
- Select the Links and Buttons tab and click Create Your First Button.
- In the Create Your Button page, do the following and click Save:
- What would you like to name the button?: Create_Update Contact in ZFSM
- Where would you like to place the button?: Details Page
- What action would you like the button to perform?: Writing Function
Create a custom function.
Similarly, create a button in the Accounts module to push an account as Company in FSM. If the company is already present in FSM, then update the record details.
Step 3: Create a custom function
- In the Create New Function popup, enter the following and click Create.
- Function Name: CreateUpdateCustomerInZFSM
- Display Name: CreateUpdateCustomerInZFSM
- In the Deluge Script Editor, click Edit Arguments.
- In the Edit Arguments popup, do the following:
- Enter the argument name as contact_id.
- For the argument value, type # and select Contacts - Contact Id and click Done.
When you create the custom function for the Accounts module, add an argument account_id and map it to Account Id of Accounts.
- Click Save.
- Add the script and click Save.
Follow similar steps to create a custom function that will add a CRM Account as Company in FSM. Use
this script.
Testing the use case
Click the Create_Update Contact in ZFSM button in a Contacts record.
A new Contact and the associated Company (if present) will be created in FSM if not already present. If the Contact is already present, then the details will be updated.
Similarly, you can push an Account in CRM as a Company to FSM.