Make fields mandatory by using workspace classes
Important
The finance and operations (Dynamics 365) mobile app and platform have been deprecated. For more information, see Removed or deprecated platform features.
When you use the mobile app designer to select fields for actions, some properties can be inferred. These properties include the field length, the type, and whether the field is mandatory. The workspace classes can be used to update these properties. For example, you might want to specify that the Name field is mandatory when a customer record is created, as shown in the following images.
Follow these steps to make the Delivery terms field mandatory by using the workspace class.
Get the control name by using the app designer. In this example, the control name is DynamicDetail_DlvTerm.
Add the following code to set the Mandatory property for the control. This code uses the reflection-based setProperty method to set the Mandatory property.
public SysAppWorkspaceMetadata getWorkspaceMetadata() { SysAppWorkspaceMetadata appMetadata; appMetadata = super(); var createCustAction = appMetadata.getAction("createCust"); this.setCustAccountMandatory(createCustAction); return appMetadata; } private void setCustAccountMandatory(SysAPpActionMetadata _createCustAction) { var custAccount = +createCustAction.getControl("DynamicDetail_DlvTerm"); custAccount.setProperty("Mandatory", true); }
Build the solution, and then update the app metadata on the mobile app.
The Delivery terms field is now marked as Mandatory, as shown in the following illustration.
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應