B25.FormButton

Overview

Represents a button on the form.

Buttons allow you to fire your own custom logic by defining a https://gomeddo.atlassian.net/wiki/spaces/BPD/pages/1875116052 for them. You can add buttons inside your B25.Form.Customizer using the B25.Form.addButton method.

Example Customizer

global with sharing class MyFormCustomizer implements B25.Form.Customizer { global void customize(B25.Form form) { form.addButton(new B25.FormButton('say-hello', 'Say Hello!') .setClickHandler(new MyButtonHandler()) ); } }

Example Handler

global with sharing class MyButtonHandler extends B25.FormEventHandler { global override void handleEvent(B25.FormEvent event, B25.Form form) { form.getField(B25__Reservation__c.B25__Title__c).updateValue('Hello World!'); } }

Example Result

 

Constructors

FormButton(name, label)

global B25.FormButton(String name, String label)

Creates a new FormButton with the given name and label. The name should be a unique value and is used internally to recognize the button. The label is the text on the button that is displayed to the user.

Parameters:

Name

Type

Description

Name

Type

Description

name

String

A unique name for the button, not displayed to the user.

label

String

The text on the button, displayed to the user.

Methods

setClickHandler

Sets a B25.FormEventHandler to fire when this button is clicked.

Return value: B25.FormButton

Parameters:

Name

Type

Description

Name

Type

Description

handler

B25.FormEventHandler

The handler to be fired when the button is clicked.


setFlowName

Sets the name of the flow which will be triggered when the button is clicked. The event handler passes the current record to the specified flow and expects an updated version of the current record from the flow. A compatible flow for the event handler can be created using the Default Reservation Flow Template.

Return value: B25.FormButton

Parameters:

Name

Type

Description

Name

Type

Description

flowName

String

The name of the flow to be triggered.


setHideOnNewRecords

If this property is set to ‘true’, the button will not be visible on new records (so only on existing records). The default value is ‘false’.

Return value: B25.FormButton

Parameters:

Name

Type

Description

Name

Type

Description

value

Boolean

The value that you want to set the property to.


setHideOnExistingRecords

If this property is set to ‘true’, the button will not be visible on existing records (so only on new record). The default value is ‘false’.

Return value: B25.FormButton

Parameters:

Name

Type

Description

Name

Type

Description

value

Boolean

The value that you want to set the property to.


setHideWhenEditing

If this property is set to ‘true’, the button will not be visible when editing a record (so only when viewing a record). The default value is ‘false’.

Return value: B25.FormButton

Parameters:

Name

Type

Description

Name

Type

Description

value

Boolean

The value that you want to set the property to.


setHideWhenViewing

If this property is set to ‘true’, the button will not be visible when viewing a record (so only when editing a record). The default value is ‘false’.

Return value: B25.FormButton

Parameters:

Name

Type

Description

Name

Type

Description

value

Boolean

The value that you want to set the property to.


setClosesForm

If this property is set to ‘true’, form will be closed when the button is clicked. The default value is ‘false’.

Return value: B25.FormButton

Parameters:

Name

Type

Description

Name

Type

Description

value

Boolean

The value that you want to set the property to.


setConfirmationHeader

If this property is set, the button will display a confirmation dialog when the button is clicked, prompting the user to confirm before the button action is executed. This property controls the dialog header text. This property is not set by default.

Return value: B25.FormButton

Parameters:

Name

Type

Description

Name

Type

Description

value

String

The header of the confirmation dialog to display.


setConfirmationBody

If this property is set, the button will display a confirmation dialog when the button is clicked, prompting the user to confirm before the button action is executed. This property controls the dialog body text. This property is not set by default.

Return value: B25.FormButton

Parameters:

Name

Type

Description

Name

Type

Description

value

String

The body of the confirmation dialog to display.


setConfirmationButtonLabel

If this property is set, the button will display a confirmation dialog when the button is clicked, prompting the user to confirm before the button action is executed. This property controls the confirmation button label text. This property is not set by default.

Return value: B25.FormButton

Parameters:

Name

Type

Name

Type

value

String


hide

Hides the button on the reservation form. Can be called from inside another handler, for example to hide buttons when the user selects a specific reservation type.


show

Makes the button visible again if it was hidden. Can be called from inside another handler, for example to show previously hidden buttons when the user selects a specific reservation type.

Example