Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

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

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,405 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,323 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

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

Product updates

Dynamics 365 release plans