Skip to main content

Notifications

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Business Rule does not unlock field for Email with Completed status on Unified Interface form

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have an Email form containing a business rule to unlock a field if the Email activity status is Completed:

pastedimage1598960263569v1.png

The field is a lookup to the Subject entity:

pastedimage1598960369334v2.png


In the classic view, the business rule is successful in unlocking the field and allowing the user to edit the value:

pastedimage1598960518016v3.png


However, the same business rule on the same form in the new Unified Interface does not unlock the field:

pastedimage1598960636731v4.png

I also tried unlocking the field in JavaScript but this doesn't work either.

Does anyone know why this might be?

  • Linn Zaw Win Profile Picture
    Linn Zaw Win 3,407 on at
    RE: Business Rule does not unlock field for Email with Completed status on Unified Interface form

    Normally, creating a Case without Subject would not throw an error like that. Seems like it is the custom validation.

    You can either look into that custom validation for such exceptional cases or populate the SubjectId with the default value if there is no Subject value in the email.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Business Rule does not unlock field for Email with Completed status on Unified Interface form

    Hi Andrew, 

    We are using Subjects (Subject Tree) to categorise Cases. We have JavaScript triggered via a custom button to convert an Email to a Case.  This passes the RegardingId from the Email (and previously the SubjectId) to xrm.WebApi.createRecord.  It should then create a new Case, set the RegardingId of the Email to the new Case and open the Case...

    pastedimage1599055666218v1.png

    Since we are unable to unlock the Subject field, I tried removing it from the Email form - however, the createRecord fails because the Subject is required on creating a Case.

    pastedimage1599055888642v2.png

    Any ideas on how I can achieve this?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Business Rule does not unlock field for Email with Completed status on Unified Interface form

    Thank you Andrew, I think this is probably a form design issue.  I'm going to try redesigning the forms.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Business Rule does not unlock field for Email with Completed status on Unified Interface form

    Hi Zoe,

    I try to write following code and add it to onLoad event of the form.

    And also create a business rule to unlock it.

    function unlockfield(executionContext) 
    {
        const form = executionContext.getFormContext();
        const headerControl = form.getControl('header_statecode');
        var status = headerControl.getAttribute().getText();
        if(status=="Sent")
        {
            Xrm.Page.getControl('new_subjectforcaseid').setDisabled(false);
            Xrm.Page.getControl('subject').setDisabled(false);
            Xrm.Page.getControl('to').setDisabled(false);
        }
    }
    

    The general field ‘subject’ and lookup field ‘To’ unlock successfully, they can be edited, only the ‘subject for case’ can’t be edited,which is a special lookup field.

    pastedimage1599036655489v1.png

    In my opinion, it can’t unlock in UCI,which is by-design.

    Regards,

    Leah Ju

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

  • Verified answer
    a33ik Profile Picture
    a33ik 84,325 Most Valuable Professional on at
    RE: Business Rule does not unlock field for Email with Completed status on Unified Interface form

    Hello,

    When email is received - it's in "Completed" state so it's readonly and you would not be able to unlock that field in supported way. You will have to look for alternative way to implement your scenario and to give any advice would be great to understand it. Can you please describe it?

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…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans