All Collections
Integrations
Building Integrations Using Zapier
Pass Opportunity Metrics to a Company Record
Pass Opportunity Metrics to a Company Record

Pass Opportunity Metrics to a Company Record

Success at Copper avatar
Written by Success at Copper
Updated over a week ago

To duplicate the steps in this article, you will need a trial, professional or business Copper account

Zapier can be used to take data from a Copper record and store it on a related record. Because Copper does not currently support cross record filtering this can be automatically push information to a related record when a specific Trigger happens. For this example Close Date, Value, and number of closed Opportunities will be passed to the Primary Company when an Opportunity is Won.

This Zap will use the following custom fields on a Company Record:

LTV - Currency

Last Order Date - Date

Order Count - Number

You'll want to create these Custom Fields inside of Copper on your Company records

Requirements:

This Zap uses the Copper API via a Zapier Webhook. This means Professional and Business customers can utilize this Zap, as it requires our API. This Zap is intended to log information from an Opportunity to the Primary Company related to the Opportunity. It will not work if there is no Company related, or if there are multiple Companies related it will only log the information on the Primary Company. Copper considers the first Company related to an Opportunity to be the Primary.

Step 1 - Trigger: Updated Opportunity Status

You'll want to create the following Custom Fields inside of Copper on your Company records:

LTV - Currency

Last Order Date - Date

Order Count - Number

For the example, you'll want to have those fields already filled out on one Company that has a related Opportunity. This will allow us to test the automation.

This Zap starts off by selecting Copper as the Trigger App then selecting the Trigger: Updated Opportunity Status. Proceed by connecting your account and testing the connection in the Test this Step section. This is done by updating the status of the Opportunity related to a Company that already has the above Custom Fields filled out. This may take several updates to be captured.

Step 2 - Filter: Only continue if...

A filter is used to ensure that only certain Opportunities will have their metrics logged on the related Company. For this example we are logging sales metrics so Opportunities in the Sales Pipeline with status changed to 'Won' should be passed.

Click the plus button below the Trigger to add another action. Select Zapier Filter for the Action App and Only continue if… for the Filter.

Now under Edit Options select the below criteria for the Zap to Only continue if…

Criteria 1:

Status

(Text) Exactly matches

Won

AND

Criteria 2:

Pipeline Name

(Text) Exactly matches

Sales

Step 3 - Action: Numbers

Before we update the related Company we need to use Formatter by Zapier to add the new Opportunity data from each field to the existing data on the related Company record. Select Formatter by Zapier for the Action App then Numbers for the Action for Order Count field.

In Edit Template:

Set Transform to Perform Math Operation.

Set Operation to Add.

Map the first value for Input to the Copper Company Custom Fields Order Count output from Step 1.

Click the plus button and set the second value for Input to 1.

Step 4 - Action: Numbers

Another numbers action is required for the LTV field. Select Formatter by Zapier for the Action App then Numbers for the Action.

In Edit Template:

Set Transform to Perform Math Operation.

Set Operation to Add.

Map the first value for Input to the Copper Company Custom Fields LTV output from Step 1.

Click the plus button and map the second value for Input to the Copper Value output from Step 1.

Step 5 - Action: Custom Request

The final step in this Zap is to use the Copper API via Zapier’s Webhooks to update the Related Company with the close date from the Trigger and the Outputs of the Numbers Actions. Select Webhooks by Zapier for the Action App and then select Custom Request for the Webhooks by Zapier Action.

Proceed to the Edit Template section.

Set Method to Put.

Delete <COMPANY_ID> from the URL and Map the Copper Company ID output from Step 1.

Set Date Pass-Through? to no.

With a Custom Request, the Data section will contain your custom Json request. This is a very sensitive portion of the Zap where a single syntax out of place will send an error. You'll need the Custom Field ID of the Company fields used in this Zap. These ID’s can most easily be obtained by exporting a single Company record via the Export Data option under System Settings. Here is an example of the export file we used. The Custom Field ID is the value following the cf_ in the three highlighted fields.

Below is a copy of the Json code, which you can copy into the Data section of your Zap then map the appropriate values for Expected to Close, Output from Step 3, and the Output from Step 4 to the your corresponding Custom Field IDs.

{

"custom_fields": [

{

"custom_field_definition_id": CF ID for Last Order Date,

"value": "Map to Expected to Close output from Step1"

},

{

"custom_field_definition_id": CF ID for Order Count,

"value": "Map to Output from Step 3"

},

{

"custom_field_definition_id": CF ID for LTV,

"value": "Map to Output from Step 4"

}

]

}

Set Unflatten to yes.

Leave Basic Auth blank.

Finally enter the four key value pairs for Headers detailed below. Note that the order does not matter, but the left and right fields must stay aligned. The API Key can be generated in Copper by following these instructions and the User Email that generated it will be listed in the Creator column.

Your Edited Template should match the example below before proceeding to Test this Step.

Testing:

In order to test any Zap you will need to complete the Test this Step section for the Trigger, each Filter, and each Action. Once you successfully tested all steps select Finish and toggle your Zap on!

Did this answer your question?