# Prevent Duplicates While Creating or Updating Records using Workflow

Suppose you are setting up a workflow for generating **“New Account”** records and you want to find if there are duplicate account records existing in your CRM system. Then, no worries, you can find duplicates using our action in workflow.

Here we’re going to execute duplicate detection from Workflow. For the current scenario, we’re using an on-demand workflow, but we can execute or trigger the same for all triggering stages of the workflow.

* Navigate to **Advanced Settings --> Processes --> New Process --> Fill the fields -->** Click on **OK**.

<figure><img src="/files/S2eImR4IFElzNPdhGjPg" alt="Creating or Updating Records using Workflow"><figcaption></figcaption></figure>

* **Scope:** Select **‘Organization’.**
* Check on **‘As an on-demand process’.**

<figure><img src="/files/32mNRAb5kXFpnzG6srIP" alt="Creating or Updating Records using Workflow"><figcaption></figcaption></figure>

* Click on ‘**Add Step’** and select **‘Perform Action’.**

<figure><img src="/files/uWj0G0R4m5xeClcOvIy1" alt="Creating or Updating Records using Workflow"><figcaption></figcaption></figure>

* **Action:** Select **“InogicDeDupeDGetDuplicateRecordsCount”** action.
* **Entity:** Select **“None (global)”.**

<figure><img src="/files/whH3tgg645mavJnY4HW6" alt="Creating or Updating Records using Workflow"><figcaption></figcaption></figure>

* Click on **‘Set Properties’.**

<figure><img src="/files/9zeEH5Fy7MsJDd4Fh81p" alt="Creating or Updating Records using Workflow"><figcaption></figcaption></figure>

* Fill in the details inside or input parameters, which will then be captured by Action.
  * **PrimaryEntityDetails:** Here we’re passing the values of PrimaryEntityDetails in json format,

    Ex: {"Attributes":{"name":"Parker"},"EntityId":"","PrimaryIdAttribute":"accountid"}
  * **PrimaryEntityName:** Account
  * **MatchingEntityName:** Account
* Click on **‘Save and Close’.**

{% hint style="info" %}
**Note: While creating a record, EntityId should be empty and while updating a record, EntityId should be the record ID that is being updated!**
{% endhint %}

<figure><img src="/files/fOr2eT8kTlRh8KvnLF3f" alt="Creating or Updating Records using Workflow"><figcaption></figcaption></figure>

* Click on **‘Add Step’** and **‘Check Condition’.**

<figure><img src="/files/7hjejAf8MvPuV9M0Lxcy" alt="Creating or Updating Records using Workflow"><figcaption></figcaption></figure>

* Here, we will check the condition whether the duplicate record count is equal to 0. Similarly, you can define any condition.

<figure><img src="/files/neOXM6e6sCrZiUbgBsrD" alt="Creating or Updating Records using Workflow"><figcaption></figcaption></figure>

* Click on **‘Save and Close’.**

<figure><img src="/files/CYL7RxQM3LP9dWcIXeeK" alt="Creating or Updating Records using Workflow"><figcaption></figcaption></figure>

<figure><img src="/files/xj1kIn2h0a4DezVQOygd" alt="Creating or Updating Records using Workflow"><figcaption></figcaption></figure>

* Add another step under the above-added step and select **‘Create Record’.**

<figure><img src="/files/RywWwCjfRjxnqn5s37p6" alt="Creating or Updating Records using Workflow"><figcaption></figcaption></figure>

* Now the workflow will run and create a new account record since no duplicate records are found inside the account entity.

<figure><img src="/files/h1bjAPMjFwGWvgzYolo0" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.inogic.com/deduped/features/duplicate-prevention/prevent-server-side-duplicate-records/prevent-duplicates-while-creating-or-updating-records-using-workflow.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
