You can add a dynamic button to a form to run a message or an outbound web service action from the form.
To add a dynamic button, no coding is required.
The dynamic button is added to the Business integration tab of the ActionPane of the form.


Standard procedure

1. Go to Connectivity studio > Setup > Dynamic action setup > Dynamic action setup.
2. Click New.
3. Define to which form the dynamic button is added.
  In the Form name field, enter or select a value.
4. Define the message that is run with the dynamic button.
Usually, you use a message that is related to the form and its defined data source.
  In the Message field, enter or select a value.
 

Note: You either define a message or an outbound web service action.

5. Define the outbound web service action that is run wit the dynamic button.
Usually, you use an outbound web service action which request message is related to the form and its defined data source.
  In the Web service action field, enter or select a value.
 

Note: You either define a message or an outbound web service action.

6. The dynamic button is added to an ActionPane tab of the form, called Business integration. If several dynamic buttons are added to the same form, you can define the sequence in which these buttons appear on the Business integration tab of the ActionPane.
  In the Sequence field, enter a number.
7. Define to which data source of the form the message or web service action applies.
Usually, you select the data source that is the root record of the message or of the request message of the web service action.
  In the Data source name field, enter or select a value.
8. Sub-task: Define the execution settings.
  8.1 Expand the Execution section.
  8.2 Define how the message or web service action is run:
- Direct: The message or web service action is run immediately. If you clicked the dynamic button, you must wait till the message or web service action is processed before you can proceed with your work.
- Background: The message or web service action is run (almost) immediately in the background. If you clicked the dynamic button, you can proceed with your work while the message or web service action runs.
- Batch: The message or web service action is run in batch. If you clicked the dynamic button, you can proceed with your work. The message or web service action is scheduled and run by the batch framework.
  In the Run mode field, select an option.
 

Note: If the Run mode is Background or Batch, you must also define the batch group.

  8.3 If you define conditions for the dynamic button, you can use the Hide option.
If you select Yes, the dynamic button is shown only for the records that meet the defined conditions.
  Select Yes in the Hide field.
  8.4 Define for which records the message or web service action is run:
- No: The message or web service action is run for all records in the data source.
- Yes: The message or web service action is run only for the current record.
  Select Yes in the Current record field.
 

Note:
- If you select several records, the dynamic button is disabled.
- The Current record option is applied only if you have defined a data source for the dynamic button.

  8.5 If you have selected Yes for the Current record field, you can also indicate if the message or web service action can run for only one or for several selected records:
- No: The message or web service action is run only for the current record.
- Yes: The message or web service action is run for all selected records. For each selected record, the message or web service action is run separately.
  Select Yes in the Multiple record field.
 

Note: The Multiple records option is applied only if you have defined a data source for the dynamic button.

  8.6 If you have selected the run mode Async or Batch, define the batch group that is used to run the message or web service action.
  In the Batch group field, enter or select a value.
  8.7 Define if the dynamic button applies to all companies in your D365 FO environment or to a specific company.
If the dynamic button applies to:
- All companies, do not fill in the Company field.
- A specific company, enter the company in the Company field.
  In the Company ID field, enter or select a value.
9. Sub-task: Define the display settings.
  9.1 Expand the Display section.
  9.2 Define the name with which the dynamic button is shown on the form.
  In the Label field, type a value.
  9.3 Define the text that is shown as tooltip for the dynamic button.
  In the Caption field, type a value.
10. Sub-task: Define who can use the button.
  10.1 Expand the Assignment section.
  10.2 Click Add assignment.
  10.3 Define how to assign users to the dynamic button:
- User: A specific user can use the dynamic button.
- Team: All users that are linked to the defined team can use the dynamic button.
- Role: All users with the defined role can use the dynamic button.
Make sure, the defined users, at least, are assigned to the 'Message run (BisMessageRun)' role.
  In the Type field, select an option.
 

Note:
If you define:
- No assignment, each user with the right role can use the dynamic button.
- An assignment, only the assigned users with the right role can use the dynamic button. For other users, the dynamic button is not shown.

  10.4 Define the user, team, or role for the assignment.
  In the Name field, enter or select a value.
11. Sub-task: Define to which data the button applies.
  11.1 You can define to which data the dynamic button applies. You can only use the dynamic button for the records that meet the conditions.
If you do not define conditions, the dynamic button applies to all records of the data source.
  Expand the Field condition section.
 

Note:
- You can only define and apply conditions if you have defined a data source for the dynamic button.
- If you select Yes in the Hide field, the dynamic button is shown only for the records that meet the defined conditions.

  11.2 You can initialize the conditions that apply to the dynamic button. The initialization is based on the:
- Data source as defined for the dynamic button.
- Record and field setup of this data source in the source document of the relevant message.
If the source document type is:
- D365 FO or a journal, each range, as defined in the source document for the data source, is added as condition.
- Staging, the staging journal type, as defined in the source document for the data source, is added as condition.
  Click Initialize condition.
 

Note: You can change or remove the initialized conditions.

  11.3 You can manually add conditions. Make sure, the defined conditions are relevant for the message or web service action request message.
  Click Add condition.
  11.4 In the Field name field, enter or select a field of the defined data source.
  11.5 In the Condition field, enter or select the field values to which the condition applies.
 

Note: Examples of values that you can use to define a condition:
- ..Item1: Item1 and smaller
- Item1..: Item1 and greater
- Item1,item5..item10: Item1 or item5 till item10
- Item1,item2: Item1 or item2
- !123: Not 123
- “”:Empty
- !””: Not empty
- curExt(): Used to apply a condition with the current company

12. Sub-task: Translate display settings.
  12.1 You can translate the label and caption as defined in the display settings.
If translations exist, depending on the D365 FO environment language settings, the dynamic button is shown in the relevant language.
  Click Translations.
  12.2 Click Edit.
  12.3 Select and add the language into which you want to translate the display settings.
  Click Add to open the drop dialog.
  12.4 In the list, find and select the desired language.
  12.5 Click OK.
  12.6 In the Translated text - Label field, type the label translation.
  12.7 In the Translated text - Caption field, type the caption translation.
  12.8 Close the page.
13. Close the page.

Notes

To run the message or outbound, web service action:

  1. Open the form to which the dynamic button is added.
  2. Depending on the dynamic button setup, select no, one, or several records.
  3. On the ActionPane, on the Business integration tab, click the dynamic button.

The message or outbound web service action is run in the way as defined by the run mode.

Provide feedback