The Confirm method offered by the Interop external object prompts a message dialogue and makes it possible to execute actions according to the user's confirmation or denial of the message.
The method prompts a message dialogue with two buttons for the user to tap: one button to confirm and another button to cancel.
If the method is executed inside a Composite command and the user confirms the prompted message, the following actions in the Composite command are going to be executed. Otherwise, the execution of the Composite command stops.
The method can be called with one parameter or with three parameters.
In the first case, the buttons' captions are not specified. In the second case, you can send the buttons' captions as parameters.
Below is an example of how the method is used and its behavior depending on the selected option. For this purpose, the LightCRM KB is used.
Suppose the insertion of a meeting has to be confirmed every time the user wants to do so. In this case, the Confirm method is going to be called in the same Event that is used for inserting new meetings.
First, in the WorkWith tab of the Meeting Transaction object, select the Section(General) node under the Detail node. Next, select the Events section.
Since user confirmation is required when saving, edit the 'Save' event as shown below:
Event 'Save'
Composite
Interop.Confirm("Confirm this meeting?")
GeneXus.SD.Actions.Save()
return
EndComposite
EndEvent
An alternative option (with specific buttons) may be as follows:
Event 'Save'
Composite
&HasConfirmed = Interop.Confirm("Confirm this meeting?", "Yes, sure", "No, thanks")
If &HasConfirmed
GeneXus.SD.Actions.Save()
return
Else
Msg("Your meeting was not saved")
EndIf
EndComposite
EndEvent