web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Find an existing record or create a new one if it doesn't exist, from a workflow

(0) ShareShare
ReportReport
Posted on by

Hi. Somewhat new to CRM Online here. Trying to do something in a workflow that I may end up having to write a plug-in for. Would like to avoid that if possible.

I have a Case form on a portal. I have a custom field on my Case entity called Hospital ID and another one on the Contact entity. When a new case comes in off the portal using this form, it has a dummy customer value on it, a contact I've created. The Hospital ID on the case form is required.

What I want to do in the workflow is:

1. Search for an existing Contact record with the Hospital ID from the Case record.

2. If one exists, set the Customer field on the Case to that Contact record.

3. If it doesn't, create one now and set that as the Customer.

I don't see any way to do the query for the existing customer in the Process tool in CRM Online. Is this possible?

Thanks.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    That's not possible with OOB features of workflow engine in CRM. To make it you will have to develop custom workflow activity that will implement mentioned scenario.

  • Suggested answer
    Clem Profile Picture
    2,541 on at

    Hello Eliot,

    I didn't try but what could be tried is :
    * Create a workflow on the Case, you trigger it when there is an update or whatever you want.
    * This workflow trigger a Custom Action you need to create.
       * this custom action need the Hospital ID and entityreference of the case as Input and is based on the Contact entity
       * you search for a Contact where Hospital ID = your argument input.

    Now you create a second Custom action, as input : The contact entityReference you found, and the Case entityReference.
    * Custom Action with Entity set to Case
    * Update record : the case, with the contact input.

    So 1 workflow + 2 custom actions should do the trick with no custom code i would say.

    Clément

  • Abed Haniyah Profile Picture
    4,287 on at

    There is now way OOB to check if record is exists, you can achieve this by using custom plugin or custom workflow activity :)

  • Eliot Stock Methods Digital Profile Picture
    on at

    Confused by this. What steps would exist in the first Action?

  • Suggested answer
    Community Member Profile Picture
    on at

    HI,

            you will have to go with a Custom Workflow Activity.

    Best Regards

    Shah

  • Suggested answer
    Soroosh Profile Picture
    10 on at

    Hi,

    You can download and install the "Dynamics 365 Workflow Tools" from the github. Then use the "Query Value" to find an existing record with corresponding filters criteria.

    Finally, you can use the results to check if the record exists or not...

    I hope that works for you...

  • Suggested answer
    Wouter Madou Profile Picture
    3,392 on at

    The answer would indeed be to create a plugin for that.

    However, if you are unable to do so and you want other solutions I would go for MS FLOW, no coding needed :).

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
JS-09031509-0 Profile Picture

JS-09031509-0 3

#2
AS-17030037-0 Profile Picture

AS-17030037-0 2

#2
Mark Eckert Profile Picture

Mark Eckert 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans