Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

Create new record if id is unique

(0) ShareShare
ReportReport
Posted on by 5

Hi all,

New to CRM, looking for some help!

I'm trying to create a process workflow that creates a new record in my "scan" entity when a new "portal event" record is created, IF it is has an ID that hasn't been seen before (ie. ID already exists in the "scan" entity).

I've created the following process:

Screenshot-2020_2D00_11_2D00_12-at-15.13.24.png

This successfully creates a new Scan record every time a portal event is created - but it does not follow the desired criteria.  Instead, a new scan record is created for every portal event record, regardless of if it is unique or not.

Can anyone advise on how I can fix this?

Ultimately I want to create a solution which creates a new "scan" if the event ID is new; and updates if the event ID already exists.

  • Guido Preite Profile Picture
    Guido Preite 54,073 Moderator on at
    RE: Create new record if id is unique

    if you set the field you want to be unique as an alternate key inside dynamics, it will fail the creation when you try to create a record with the same key.

    more info on the alternate key here:

    docs.microsoft.com/.../define-alternate-keys-entity

    hope it helps in your scenario

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,961 Moderator on at
    RE: Create new record if id is unique

    Hi,

    You don't need to fetch all records. You can put filter condition in List Record. See below I create Flow on Create of Account record, it will chekc if any contact exist with Account EMail Address. If exist update the record else create.

    cq76.PNG

    cq77.PNG

    Condition expression is - 

    length(body('list_records')?['value'])
    filter condition in List Records make sure you put correct schema name and value should in single quote

    Please mark my answer verified if i were helpful

  • nj_09291 Profile Picture
    nj_09291 5 on at
    RE: Create new record if id is unique

    I attempted to do this in Flow, but when I ran it, it seemed to break the data import of our Portal Events (not sure why this would be).  Are you able to help with what the basic flow steps should be?  This was my attempt:

    Screenshot-2020_2D00_11_2D00_13-at-08.39.18.png

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,961 Moderator on at
    RE: Create new record if id is unique

    Hi,

    This can not be achieved using OOB workflow.

    As sugested in above post, you will have to write custom workflow / Plugin code to achieve your requirement.

    docs.microsoft.com/.../tutorial-write-plug-in

    Please mark my answer verified if i were helpful

  • Suggested answer
    Fubar Profile Picture
    Fubar 2,752 on at
    RE: Create new record if id is unique

    You will either need to write a custom workflow activity (to check if already exists), or if the workflow/process  doesn't need to be real-time then you can do it in Power Automate / Flow.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,407 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans