---
schema_version: "1"
id: c7edc3a89738abf137f13fb987b4e96a5ab418d3901013448955d133bdc764d1
title: "Use Case 2: Create a Primary Key Using a Composite Key"
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/data/264-0-0/c360_a_use_case_2.md
canonical_url: https://help.salesforce.com/s/articleView?id=data.c360_a_use_case_2.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 4881d2717e32d4e08b6926dc5f6a52e0bedc8ec3a157dae77cd35b3c629d9936
description: This use case creates a composite key and sets a formula field as the primary object.
products:
  - Data 360
release: "264"
---
# Use Case 2: Create a Primary Key Using a Composite Key

This use case creates a composite key and sets a formula field as the primary object.

An order can have several products, and the same product can exist in multiple orders. Order Confirmation Number and Product ID can also have a many-to-many relationship.

 
| Raw Data | Goal |
| --- | --- |
| The fields Order Confirmation Number and Product ID. The combination of these two fields uniquely identifies a row. | Create the formula field “Unique ID” that concatenates Order Confirmation Number with Product ID. Set the Unique ID as the Primary Key in Object Details. |

1. For Field Label, enter Unique ID.
2. For Formula Return Type, select **Text**.
3. In the syntax editor, enter the formula: CONCAT(sourceField\[‘Order Confirmation Number’\], "\_", sourceField\[‘Product ID’\]).
4. In the test input box, validate the formula using these combinations.
    
    - “Order Confirmation Number” with value of “A43JCT” and “Product ID” with value of “soap” returns “A43JCT\_soap”.
    - “Order Confirmation Number” with value of “A43JCT” and “Product ID” with value of “cookie” returns “A43JCT\_cookie”.
    - “Order Confirmation Number” with value of “PT56CG” and “Product ID” with value of “soap” returns “PT56CG\_soap”.
5. Click **Save**.
6. Verify that “Unique ID” is added as a field.
7. In the Primary Key dropdown, select **Unique ID**.