You can use button on a form to run an outbound web service action. You can add a button to a form in these ways:

  • Dynamic button
    Use a dynamic button to manually start an outbound web service action from a form.
  • Action menu item
    Use a custom action menu item to manually start an outbound web service action from a form. For the action menu item, custom coding is required.


Application Consultant Application Consultant Start Start How to run a  web service action  from a button? How to run a  web service action  from a button? Run web service action from dynamic button Run web service action from dynamic button 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. Procedure 1. Go to Connectivity studio > Setup > Dynamic action setup > Dynamic action setup. 2. Click New. 3. 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. In the Sequence field, enter a number. 7. In the Data source name field, enter or select a value. 8. Sub-task: Define the execution settings. 9. Expand the Execution section. 10. 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. 11. Select Yes in the Hide field. 12. 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. 13. 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. 14. In the Batch group field, enter or select a value. 15. In the Company ID field, enter or select a value. 16. Sub-task: Define the display settings. 17. Expand the Display section. 18. In the Label field, type a value. 19. In the Caption field, type a value. 20. Sub-task: Define who can use the button. 21. Expand the Assignment section. 22. Click Add assignment. 23. 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. 24. In the Name field, enter or select a value. 25. Sub-task: Define to which data the button applies. 26. 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. 27. 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. 28. Click Add condition. 29. In the Field name field, enter or select a field of the defined data source. 30. 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 31. Sub-task: Translate display settings. 32. Click Translations. 33. Click Edit. 34. Click Add to open the drop dialog. 35. In the list, find and select the desired language. 36. Click OK. 37. In the Translated text - Label field, type the label translation. 38. In the Translated text - Caption field, type the caption translation. 39. Close the page. 40. Close the page. Notes To run the message or outbound, web service action: Open the form to which the dynamic button is added. Depending on the dynamic button setup, select no, one, or several records. 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. Run web service action from action menu item Run web service action from action menu item You can use a custom action menu item to manually start an outbound web service action from a form. As a result, for a selected record, you can manually run the web service action from the form to which you added the action menu item.Example: Create an action menu item and add it to the Sales orders form. On the Sales orders form, you can select a record and click the action menu item button. This starts a web service action to post a sales order. The web service action is processed, and the selected sales order is posted. Procedure 1. Create the custom menu item. The action menu item must be of type class and must be linked to the 'BisWsCmdActionRunWebservice' class. To avoid best practice warnings, in the menu item setup, define the permissions for the roles who can use the action menu item. Note: As the action menu item is not linked to a RunBase class, you cannot run it in batch. 2. Add the action menu item to the form from where you want to start the web service action. For example, the Sales orders form to post a sales order. 3. Make sure, the users, who must be able to run the web service action with the menu item, are assigned to the 'Message run (BisMessageRun)' role. 4. For the desired web service action, on the Web service action form, in the Custom section, in the Action menu item name field, enter the name of the action menu item. For example, a web service action to post a sales order. Note: Make sure, you link the menu item to only one web service action. 5. Test the menu item. Does it run the web service action with the desired result? End End Dynamic  button Action menu  item

Activities

Name Responsible Description

Run web service action from dynamic button

Application Consultant

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.

Run web service action from action menu item

Application Consultant

You can use a custom action menu item to manually start an outbound web service action from a form. As a result, for a selected record, you can manually run the web service action from the form to which you added the action menu item.
Example: Create an action menu item and add it to the Sales orders form. On the Sales orders form, you can select a record and click the action menu item button. This starts a web service action to post a sales order. The web service action is processed, and the selected sales order is posted.

Provide feedback