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 :
Customer experience | Sales, Customer Insights,...
Suggested Answer

How to notify users based on changing value

(0) ShareShare
ReportReport
Posted on by 8

Hi,

I have the scenario as:

Given:

Two entities "ITEM" and a related entity "SUB-Item"  relationship 1:N.

On ITEM entity form I have given users a related sub-grid so they are able to add as many SUB-item as are applicable.

I also have an option set field  "X" displayed on entity ITEM

X= High, Low, Medium, None etc which users can select value and save.

Required:

1) When there is no SUB-Item, set X = None

2) Each time when a SUB-item is created users should be prompted to review the value in X and set it accordingly, they could also delete the SUB-item and again because it is a change in the number of SUB-item they should be warned to re-evaluate the value in field X

3) As per the 1) requirement above when there is no SUB-item X is set to None, hence when user changes the value of X from None to any other value of X,  they should get a warning that without adding a SUB-item they cannot change the value..

Thanks,

PS

I have the same question (0)
  • Suggested answer
    Wahaj Rashid Profile Picture
    11,321 on at

    Hi,

    Thank you for your query.

    There are multiple approaches to design this logic and all of it requires write some code.

    Furthermore, you cannot use roll-up field (for the count) because you need real-time validations.

    I would recommend following:

    • Create a numeric field on Item entity to hold count of Sub-Items. Place it on the form and keep it hidden or locked (if needed).
    • Create a custom code activity (custom workflow step) to get the count of the sub items (out argument should be a numeric value).
    • Create a rea-time workflow to which triggers on Create of Sub-Item, gets the count of all Sub-items (based on the related Item) and updates the count in Item (new field we created).
    • Because, your main form is not aware of count change, you need to refresh the form based on subgrid changes.
    • Add a Business Rule or Javascript on the Item form to prevent user from selecting X = None when count is 0, if it s not zero prompt the user to change the value.

    Another approach is to use JavaScript totally to get the count using WebApi and set X value appropriately. The benefit of this approach is that you do not need to refresh the form on subgrid changes, and you will have all the values in real-time. However, Javascript won't trigger when a Sub item is added or deleted by a Process, Plugin or API.

    Here are few links for your reference:

    Obtaining count of child records using WebAPI:

    https://community.dynamics.com/crm/f/microsoft-dynamics-crm-forum/256849/using-odata-in-crm-to-determine-whether-specific-entity-has-children-or-not/719553

    Creating a custom code activity:

    https://docs.microsoft.com/en-us/powerapps/developer/data-platform/workflow/tutorial-create-workflow-extension

    Refresh form based on sub-grid:

    https://stackoverflow.com/questions/59929848/reload-form-on-reload-refresh-of-subgrid-in-dynamics-365-crm-unified-interface

    Evaluate your options, and feel free to discuss further.

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 > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 202 Super User 2026 Season 1

#2
CU11031447-0 Profile Picture

CU11031447-0 100

#3
NeerajPawar Profile Picture

NeerajPawar 70

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans