I have an Email form containing a business rule to unlock a field if the Email activity status is Completed:
The field is a lookup to the Subject entity:
In the classic view, the business rule is successful in unlocking the field and allowing the user to edit the value:
However, the same business rule on the same form in the new Unified Interface does not unlock the field:
I also tried unlocking the field in JavaScript but this doesn't work either.
Does anyone know why this might be?
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.
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...
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.
Any ideas on how I can achieve this?
Thank you Andrew, I think this is probably a form design issue. I'm going to try redesigning the forms.
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.
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.
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?
André Arnaud de Cal...
292,160
Super User 2025 Season 1
Martin Dráb
230,962
Most Valuable Professional
nmaenpaa
101,156