问题
In javascript, I have written Xrm.Page.ui.getFormType();
.
This code does not work when form is read-only. Even though on the form it is written read-only on the bottom of the record, it is giving me formtype as 2.
even Onload shows formtype 2
回答1:
Edit:
Sounds like a bug in CRM 2016 (v8.2) - credit goes to @Alon in above comment.
I was able to test it quickly, like below.
First scenario: Users' security role don't have Edit/Update privilege for that particular entity record. So the footer says, the record is Active and the form mode is Read only
alert(Xrm.Page.ui.getFormType());
says 3
Second scenario: That particular entity record is deactivated/disabled. So the footer says, the record is Inactive and the form mode is Read only. Applies to completed Activity record too.
alert(Xrm.Page.ui.getFormType());
says 4
On a side note, Xrm.Page
is deprecated. Have to re-write them using formContext
.
formContext.ui.getFormType();
Read more
来源:https://stackoverflow.com/questions/58754305/formtype-not-returning-proper-value-on-dynamics-crm-2016