Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Business Rule Sets Fields as 'Business Required' with Differing Results

Posted on by Microsoft Employee

We have a business rule defined on the Account entity with a scope of 'Entity'. The business rule sets the Name and a custom field to 'Business Required'. If two Account records are imported where one record has a blank name and the other a blank value in the custom field, the record with the blank name is rejected and the record with the blank custom field is not. I would expect both records to be rejected or neither.

Other fields on other entities with similar business rules all behave like the custom field: importing blank values on mandatory fields are allowed.

Does anyone have any ideas why it works differently for the Account Name field?

*This post is locked for comments

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Business Rule Sets Fields as 'Business Required' with Differing Results

    I think I have it figured out now. The following rule works:

    IF  Organization Name does not contain data OR Address 1: Country does not contain data

    THEN

    Set Organization Name as Business Required

    Set Address 1: Country as Business Required

    It can also be broken out into 2 rules as you suggest, Adrian: one for Organization Name and one for Country. 

    I think the problem was that the business rule WASN'T executing every time even though the condition would be always be true if evaluated. Or to be more exact, I suspect that the system generates a list of the fields used in any conditions of the business rule, and if any of those fields have changed, then the business rule checks all of the conditions and executes the appropriate steps.  If the condition contains only one field, say the account (organization) name, then the system does not execute the business rule if that field does not change even if other fields changed (like the Country).

    I told Ravi that I had tested the problem on a new entity, but the condition on the business rule was not checking any of the right fields in the condition. Instead it was checking another field that was not changing.  So even though the condition should evaluate to true, it wasn't running the business rule when the field did not change.

    Thanks to both Adrian and Ravi for your help.

  • Suggested answer
    Adrian Begovich Profile Picture
    Adrian Begovich 21,009 Super User 2024 Season 2 on at
    RE: Business Rule Sets Fields as 'Business Required' with Differing Results

    Hi Chris13,

    In its current state, your Business Rule will always execute. This may be the cause of your issue. I recommend this approach instead:

    Business Rule 1

    1. If Organization Name is not Business Required
    2. Set Organization Name as Business Required

    Business Rule 2

    1. If Address 1: Country is not Business Required
    2. Set Address 1: Country as Business Required

    Alternative Solution

    • Set the Field Requirement values of Organization Name and Address 1: Country to Business Required from the field customisation screen.
  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Business Rule Sets Fields as 'Business Required' with Differing Results

    Hi Adrian,

    Here is a screen shot of the import log that I am referring to. 

    6204.zztest.JPG

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Business Rule Sets Fields as 'Business Required' with Differing Results

    Hi Adrian,

    The error message is displayed in the import job log for the record with the blank name.  I assume the message is coming from the Business Rule because if I turn off the rule, I can import the record. I'm not sure if that answers your first question.  

    The condition on the business rule should always evaluate to TRUE. Here is the business rule (Note: we renamed Account to Organization which is why you see the word Organization in the rule):

    IF Organization Name does not contain data OR Organization Name contains data

    THEN

    Set Organization Name as Business Required

    Set Address 1: Country as Business Required

  • Suggested answer
    Adrian Begovich Profile Picture
    Adrian Begovich 21,009 Super User 2024 Season 2 on at
    RE: Business Rule Sets Fields as 'Business Required' with Differing Results

    Hi Chris13,

    That is odd behaviour, are you sure that the error is an import error and not a Business Rule error? Are there any conditions on your Business Rule or does it just have an action that sets the Name and a custom field to Business Required?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Business Rule Sets Fields as 'Business Required' with Differing Results

    Hi Adrian, if I remove the business rule, I can import an account with a blank name. But the fact that Microsoft designed the Account entity may factor into this.  I was just hoping the reason would be apparent based on some attribute that was set or there is some other rule that I was not aware of.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Business Rule Sets Fields as 'Business Required' with Differing Results

    Hi Ravi,

    That is what I thought. But if I remove business rule, then the name is not required on import. So then I thought it was a combination of the business rule and the primary name field.  So I created a custom entity with a primary name field that is required and a business rule that also said it is required.  The import still did not require a value in that field. I might try that whole scenario again from scratch in case I missed something, but I don't think I did.

  • Suggested answer
    Adrian Begovich Profile Picture
    Adrian Begovich 21,009 Super User 2024 Season 2 on at
    RE: Business Rule Sets Fields as 'Business Required' with Differing Results

    Hi Chris13,

    It works on the Account Name as Microsoft designed the Account entity so that the account name field is required when creating an account record. This is the case irrespective of the Field Requirement value or your Business Rule.

    This documentation explains that the name field on the account entity is Application Required.

  • RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Business Rule Sets Fields as 'Business Required' with Differing Results

    I guess account name being the primary name field. This is why.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Business Rule Sets Fields as 'Business Required' with Differing Results

    Hi Adrian, so why does it work on the Account Name?

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans