问题
Microsoft Dynamics 365 Version 1612 (8.2.2.1862) (DB 8.2.2.1862) online
I want to be able to set the Currency field on the Contract. However, on the main Contract form the field is locked and cannot be unlocked.
In the form editor the field is not disabled but the padlock appears next to it.
Running Xrm.Page.getControl('transactioncurrencyid').setDisabled(false)
on the client has no effect for this field, i.e. the field remains locked.
I have noticed that there is a Mapping on the contract_customer_contact Relationship from the contact.transactioncurrencyid to the contract.transactioncurrencyid and wonder wether this might be related?
Other fields that cannot be unlocked are OriginatingContract and Cancellation Date.
回答1:
I quickly checked in a vanilla instance. These are my observations.
Actually there are 2 kind of padlocks.
Red padlocks in form editor. This will not show padlock in rendered form.
This will appear next to field label in editor when system enabled it as system required. Trying to remove them from Form will give you message. Eg. Contract Template, Bill To Customer, etc.
The field you are trying to remove is required by the system or business.
The same Red padlock appears for fields in form editor, when System Customizer locked that particular attribute under Field properties - Locking
. Trying to remove that field from Form says:
The field you are trying to remove is locked and cannot be removed.
Black padlocks in browser rendered form. This field's control appears blue in color on form editor.
For system fields like CreatedOn, All Rollup fields, All Calculated fields this will appear.
This will appear next to control (textbox, lookup) while rendering when the field is set as read-only under Field Properties - Field Behavior
. Same applies to script disabled fields.
Fields like auto-generated ContractID, Currency, Originating Contract, Discount will be locked by system as changing these after record creation does not make sense. Also this will impact the business pipeline.
来源:https://stackoverflow.com/questions/50874388/dynamics-crm-currency-field-on-the-contract-is-locked-disabled-and-cannot-be