Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum

Differentiate between creation and deletion on Workflow

Posted on by 790

dear all

i have a new workflow that should run on creation or deletion of a record of an entity, i need to do two different logics based on type (creation or deletion), but i dont know how to distinguish between creation and deletion when i build the criteria.

for example, i need to send an email (upon deletion), and i need to do assign based on creation, but i cant build the criteria for both scenarios.

can you help please?

thanks,

  • Ahmad Saud Profile Picture
    Ahmad Saud 790 on at
    RE: Differentiate between creation and deletion on Workflow

    thanks Ravi and Goutam, i think i can check if the created on is greater than or equal execution-time-1min , then i can consider this a creation, otherwise, if execution-time is greater than created_on, then it is a deletion.

  • RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Differentiate between creation and deletion on Workflow

    I don't think so. I believe Modified On changes everytime you perform an action. So when the workflow hit delete the modified on would be different than the created On. I have tried this before suggesting and it worked for me. You can refer the above shared screenshot and create the similar workflow and see if it works for you.

  • gdas Profile Picture
    gdas 50,085 on at
    RE: Differentiate between creation and deletion on Workflow

    Yes Ravi, that's correct for the Crete condition , but if same record without modifying user want to delete, next time when workflow execute for delete workflow  again meet create condition instead of delete condition as created on and modified on value does not change for this record , if my understanding is correct.

  • RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Differentiate between creation and deletion on Workflow

    Its a system functionality wherein you will initially get the created on value on the modified on field i.e. when you create a record, it sets the same date on CreatedOn & ModifiedOn.  

  • gdas Profile Picture
    gdas 50,085 on at
    RE: Differentiate between creation and deletion on Workflow

    Hi Ravi,

    What happen if record never get modified and user wants to delete the record?

  • Verified answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Differentiate between creation and deletion on Workflow

    Hi Ahmad,

    There is no out of box method to distinguish between create & delete but when you create a record the createdon & modified on fields holds the same value so you can check like below

    CreateTaskWorkflow.png

    Hope this helps.

  • Verified answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Differentiate between creation and deletion on Workflow

    Hi Ahmad ,

    Is there any specific reason you are doing both the action in same workflow?

    I don't think you can get the event in which condition workflow triggerred sitting on OOB workflow steps  as the event are nothing but the condition when your workflow is triggering.Its predefined and based on the condition you are aware which action need to be done.

    However using plugin or custom workflow context messages you could get this information.

    Here is one old thread which you can refer using child workflow.

    [View:https://community.dynamics.com/crm/f/117/t/193008]

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans