{"section":"tutorials","requestedLocale":"en","requestedSlug":"sales-associate-code-field-at-checkout","locale":"en","slug":"sales-associate-code-field-at-checkout","path":"docs/en/tutorials/promotions-and-taxes/promotions/sales-associate-code-field-at-checkout.md","branch":"main","content":"On VTEX, you can create a field to add the sales associate code at Checkout. It allows you to:\n- Link a particular order to a sales associate.\n- Give exclusive discounts to the customer.\n- Manage your sales associates' performance, collecting data such as the number of sales / average ticket per sales associate and sales commission ranking.\n\n> ⚠️ The **sales associate code**  field does not replace the **discount coupon** field (native on the VTEX platform). By completing the settings outlined in this article, both can be used to give discounts.\n\nTo create the field and add it to the Checkout page of your store, you need to complete three steps:\n\n1. [Creating a new data entity](#creating-a-new-data-entity)\n2. [Creating a sales associate code promotion](#creating-a-sales-associate-code-promotion)\n3. [Customizing the Checkout UI](#customizing-the-checkout-ui)\n\n## Creating a new data entity\n\nThe **sales associate code** field must be added to [Master Data](/en/docs/tutorials/master-data) as a new entity. To create the data entity, follow the steps below:\n\n1. In VTEX Admin, go to **Store Settings > Storefront > Master Data**, or type **Master Data** in the search bar at the top of the page.\n2. Create a new [data entity](/en/docs/tutorials/data-entity#how-to-set-up) called *salesassociatecode*.\n3. In the new data entity, create the following fields:\n    - **Sales associate code**: with a maximum of 10 characters (Varchar10 type).\n    - **Email**: sales associate email address (Email type).\n    - **Name**: sales associate name (Text type).\n    - **Status**: indicates whether the sales associate is active or inactive (Boolean type).\n    - **Store**: identification of the store where the sales associate works (Text type).\n    - Other fields (as needed).\n\n<blockquote><ui>4. Add the information for each sales associate to the fields you created in the previous step.</ui>\n\n<blockquote><ui>5. Create a [form](/en/docs/tutorials/creating-form-in-master-data) to access the information of the new *salesassociatecode* entity through the Master Data interface.</ui>\n\n## Creating a sales associate code promotion\n\nAfter creating the salesassociatecode entity, you need to link it to a promotion. To create a new promotion, follow the steps below:\n\n1. In the VTEX Admin, go to **Promotions > Promotions**, or type **Promotions** in the search bar at the top of the page.\n2. Create a new [regular promotion](/en/docs/tracks/how-promotions-work). Complete the **Promotion overview** and the **To which items will this promotion apply?** fields.\n\n> ℹ️ Callout Information: If you want to use the sales associate code field to give a discount on the purchase amount, complete the information in the **What is the type and amount of discount?**.\n\n<blockquote><ui>3. In **To which items will this promotion apply?**, click the **utm_campaign** option and type *salesassociatecode*.</ui>\n\n![utm campaign codigovendedor](https://cdn.statically.io/gh/vtexdocs/help-center-content/refs/heads/main/docs/en/tutorials/promotions-and-taxes/promotions/sales-associate-code-field-at-checkout_1.PNG)\n\n<blockquote><ui>4. In **Restrictions and limitations of use**, add the other available restrictions if desired. Select the **Apply with other promotions** option.</ui>\n\n<blockquote><ui>5. Click **Save**.</ui>\n\n## Customizing the Checkout UI\n\nThe last step is configuring the Checkout interface to display the **sales associate code** field.\n\nTo customize this, you need to contact the partner agency that built your store and request that the new field be added, allowing the customer to enter the sales associate code and see their name displayed.\n\nAdditionally, you need to complete the following steps:\n\n1. When simulating a purchase and entering the sales associate code on the Checkout page, make sure that the GET [Search Documents](https://developers.vtex.com/docs/api-reference/master-data-api-v2#get-/api/dataentities/-dataEntityName-/search) call performs the search in the entity `salesassociatecode` and returns all the information added for the sales associate. Example call: https://\\{accountName\\}.\\{environment\\}.com.br/api/dataentities/codigovendedor/search?codigovendedor=12345.\n\n> ⚠️ The **status** field must return **true**, indicating that the sales associate code is valid.\n\n<blockquote><ui>2. Run the [Update orderForm configuration](https://developers.vtex.com/docs/api-reference/checkout-api#post-/api/checkout/pvt/configuration/orderForm) POST call to add the following information to the store [orderForm](https://developers.vtex.com/docs/guides/orderform-fields)</ui>:\n\n<blockquote><blockquote>- **marketingData**: In *\"utmCampaign\"*, enter *\"salesassociatecode\"*. If this information is not described, the promotion (sales associate code) will not be applied to the cart, and the field will not be displayed.\n\n<blockquote><blockquote>- **openTextField** (optional): Add notes or comments (e.g., information for commissioning filters).\n\n> ⚠️ Only the sales associate name should be displayed on the Checkout page.\n\nAfter completing all the above steps, the **Sales associate code** field will be available on the Checkout page.\n\n![Sales associate code](https://cdn.statically.io/gh/vtexdocs/help-center-content/refs/heads/main/docs/en/tutorials/promotions-and-taxes/promotions/sales-associate-code-field-at-checkout_2.png)"}