Print

Confirm()

Confirm() function shows a confirmation dialog with specified question and specified buttons. It is used in manual rules to check if a given rule should be run or not. See also this articles: Manual rule confirmation – part 1 and Manual rule confirmation – part 2 (articles in Polish).

CAUTION! This function can only be used in a manual rule in „Execute before rule” code.

Syntax

Confirm(confirmData);

Function arguments

  • confirmData – (Object) an object-type argument that stores parameters of the confirmation dialog. These parameters are:
    • confirmData.Title – (String) a title of the confirm dialog;
    • confirmData.Content – (String) [optional] a content (information text) of the confirm dialog;
    • confirmData.HideCancelButton – (Boolean) [optional] if set to true then 'Cancel’ button will not be displayed, only defined buttons will be shown;
    • confirmData.Buttons – (ObjectList) a list of buttons to be displayed in the confirm dialog;
    • confirmButton – (Object) a definition of a button to display in confirm dialog;
    • confirmButton.Text – (String) a text (label) on the button;
    • confirmButton.Type – (String) a color of the button, available values: Primary, Secondary, Success, Danger, Warning, Info, Light, Dark. Values compatible with Bootstrap styles: https://getbootstrap.com/docs/4.0/components/buttons/;
    • confirmButton.Id – (String) an id of the button, this value will be available in a ConfirmResult variable in a rule code when this button is clicked;
    • confirmButton.AddComment – (String) [optional] if set to 'Optional’ or 'Required’ then user will be asked to provide comment, entered text will be available in a UserComment variable;
    • confirmButton.SelectUserFromGroup – (String) [optional] if set then user will be asked to select user from specified group. The selected user will be available in SelectedUser or SelecterUserId variables;
    • confirmButton.DialogTitle – (String) [optional] when for the button either AddComment or SelectUserFromGroup are specified then the dialog box title will have this value, if not set then value from the button text will be displayed.

Return value

This function returns Boolean.
Return true.

Examples

Example 1

This will create a confirm dialog with title, content and buttons. Default cancel button will be hidden. An id of the clicked button will be available in ConfirmResult variable.

conf.Title='Do you accept?';
conf.Content='Do you accept this application?';
conf.HideCancelButton=true;
buttons=";
buttonConfirm.Text='I Accept!';
buttonConfirm.Type='Primary'
buttonConfirm.Id='accept';
AddObjectToList(buttons,buttonConfirm);
buttonReject.Text='Objection!';
buttonReject.Type='Error';
buttonReject.Id='reject';
AddObjectToList(buttons,buttonReject);
conf.Buttons=buttons;
Confirm(conf);

Example 2

This example shows an alternative way to create a confirmation dialog (from the 'Example 1′) with using CreateObject() function.

conf=CreateObject('Confirm.Config','Title','Do you accept?','Content',
'Do you accept this application?');
buttons=CreateObject('ObjectList');
AddObjectToList(buttons,CreateObject('Confirm.Button','Text','I Accept!','Type','Success',
'Id','accept'));
AddObjectToList(buttons,CreateObject('Confirm.Button','Text','Objection!','Type','Error',
'Id','reject'));
conf.Buttons=buttons;
Confirm(conf);

Example 3

This will create a confirm dialog with title, content and buttons. If one selects 'I Accept!’ then they will be prompted to select user from 'HR department’ group. If one selects 'Objection!’ then they will be required to provide a comment. Dialog with the comment or the user selection field will have a title from DialogTitle property. An id of the clicked button will be available in ConfirmResult variable. The provided comment will be available in UserComment variable and selected user will be available in SelectedUser/SelectedUserId variables. AddComment and SelectUserFromGroup options must not be used together with appropriate rule options.

conf.Title='Do you accept?';
conf.Content='Do you accept this application?';
buttons=";
buttonConfirm.Text='I Accept!';
buttonConfirm.Type='Primary'
buttonConfirm.Id='accept';
buttonConfirm.SelectUserFromGroup='HR department';
buttonConfirm.DialogTitle='Select to whom case will be redirected';
AddObjectToList(buttons,buttonConfirm);
buttonReject.Text='Objection!';
buttonReject.Type='Error';
buttonReject.Id='reject';
buttonReject.AddComment='Required';
buttonReject.DialogTitle='Please provide the reason of objection';
AddObjectToList(buttons,buttonReject);
conf.Buttons=buttons;
Confirm(conf);

 

Czy artykuł był pomocny?
0 na 5 gwiazdek
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
How Can We Improve This Article?