Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Suggested answer

Changing Child Activity State Before Parent Record

(1) ShareShare
ReportReport
Posted on by

Hi,

I have a campaign that has a campaign activity underneath it.

When the campaign is marked inactive I want it to deactivate the child campaign activity record and then deactivate itself.

I have created a workflow that triggers based on a change in campaign status and should trigger BEFORE the campaign state changes so that I change the campaign activity first and then do the campaign.

I believe I'm hitting some kind of race condition as sometime this works and sometimes it doesn't.

What I would like to see happen;

User clicks "DEACTIVATE" from campaign, campaign activity is set to INACTIVE (via my real-time workflow), CAMPAIGN updates its status accordingly.

User clicks "ACTIVATE" from campaign, campaign activity is set to ACTIVE (via my real-time workflow), CAMPAIGN updates its status accordingly.

Am I missing something?  I would have thought the real-time workflow would have blocked the campaign status change from completing before campaign activity workflow would have changed.

I'm trying to avoid writing a plugin or my own code to handle this.

Thanks - Greg

  • Suggested answer
    prt33k Profile Picture
    prt33k 6,907 on at
    RE: Changing Child Activity State Before Parent Record

    Hi Greg,

    I am not sure what will deactivating child record before parent achieve - since once parent deactivation is 'committed' only then it make sense to deactivate child. Otherwise in cases where deactivation of parent fail - you will end up with all child record deactivated but parent active.

    However, one way you can achieve this via a pre update plugin. Retrieve the child record and deactivate them inside plugin.

    Other option will be to write custom action and use custom deactivate button which call this action. In this custom action you can first deactivate all the child record and then the parent record itself.

    Both of these require custom coding - I don't think the OOB workflow or power automate can help here since these run only after deactivation of parent is committed.

    Thanks,

    Prateek

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Changing Child Activity State Before Parent Record

    Hi IAmGreg,

    Unfortunately, real-time workflow can’t change child status before changing parent status if you set trigger based on parent status change.

    Setting trigger based on parent status change means that the parent record status must have changed if the child record status changes, otherwise, the child record status does not change.

    In other words,Changing the parent record state is a prerequisite for changing the child record state, which is irreversible.

    But if you insist that change child status before parent status, you can create a new field in the campaign form, set trigger based on the new field change, change child campaign activity status firstly, then you can change campaign status by using workflow or clicking button manually.

    But the way can just for active record to inactive record, because inactive record form is read-only, you can’t change field value in the page.

    In summary, parents status change should not be set as a trigger if you want to change child activity state before parent record.

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

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

Announcing Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

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,492 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans