Actions for lists can impact a large amount of data in Microsoft Dynamics GP. For actions that can’t easily be reversed, such as deleting marked items, you will want the user to confirm the action before it is peformed. This is typically done with drop dialogs that appear for buttons in the Action Pane. A typical drop dialog is shown in the following illustration:
If a button on the Action Pane is going to display a drop dialog, the underlying command for the action must have its Button Type property set to Drop Dialog in the Command Definition window. |
You can use the ConfirmAction() function to display a predefined drop dialog. You can also create your own drop dialog to use for an action. To create your own drop dialog, simply create a small window that will contain the content for the drop dialog. In the script for the action’s command, use the as dropdialog clause with the open window command. For example, the following sanScript code opens a drop dialog for the Qualify action:
open window Qualify as dropdialog;
The Button Type for the command that will display the drop dialog must be set to Drop Dialog in the command’s definition. |
Code for the items in the drop dialog window will perform the specific action. Using a drop dialog window for an action allows to user to perform the action without having to open a separate window in Microsoft Dynamics GP. For example, the following drop dialog is used for the Leads list in the sample integrating application to qualify leads:
If you create your own drop dialog for an action, be sure to close the drop dialog before any script code performs the action. If don’t close the drop dialog, it will remain open and active while the action is processed. This would be confusing for the user, since the drop dialog would remain open as a long-running action is processed.
The following is the code for the OK button in the Qualify drop dialog. Notice how it closes the drop dialog before the action is performed.
{Save the source value the user entered} 'Lead Source' of window State = 'Lead Source' of window Qualify; {Close the drop dialog -- so it's not visible while processing is occurring} close window Qualify; {Call the action} call ExecuteListAction of form syCardList, ACTION_QUALIFYLEAD, true, "Qualify Leads";