In Dynamics 365, Business Process Flow attributes are just like Form attributes. You can use most of the controls in the same way as you normally do for Form attributes. Let’s look at the most common ones together.
Get Business Process Flow attribute control using Javascript
To get attributes Add “header_process” before schema name of field. Let’s say your attribute schema name is “cm_myattribute“.
1 2 3 4 5 | function BpfControls(executionContext) { var formContext = executionContext.getFormContext(); var bpfControl = formContext.getControl( 'header_process_cm_myattribute' ); var bpfAttribute = bpfControl.getAttribute(); } |
Set attribute value for Business Process Flow using Javascript
1 2 3 4 5 6 7 8 9 | function BpfControls(executionContext) { var formContext = executionContext.getFormContext(); var bpfControl = formContext.getControl( 'header_process_cm_myattribute' ); var bpfAttribute = bpfControl.getAttribute(); if (bpfAttribute != undefined) { bpfAttribute.setValue( "myValue" ); } } |
Hide field in a Business Process Flow using Javascript
1 2 3 4 5 6 | function BpfControls(executionContext) { var formContext = executionContext.getFormContext(); var bpfControl = formContext.getControl( 'header_process_cm_myattribute' ); bpfControl( "header_process_cm_myattribute" ).setVisible( false ); } |
Set field Required in a Business Process Flow using Javascript
1 2 3 4 5 6 7 8 9 | function BpfControls(executionContext) { var formContext = executionContext.getFormContext(); var bpfControl = formContext.getControl( 'header_process_cm_myattribute' ); var bpfAttribute = bpfControl.getAttribute(); if (bpfAttribute != undefined) { attribute.bpfAttribute( "required" ); } } |
Set field Disable in a Business Process Flow using Javascript
1 2 3 4 5 | function BpfControls(executionContext) { var formContext = executionContext.getFormContext(); var bpfControl = formContext.getControl( 'header_process_cm_myattribute' ); bpfControl.setDisabled( true ); } |
No comments:
Post a Comment