B25.FormButton

Overview

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

Example Customizer

1 2 3 4 5 6 7 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

1 2 3 4 5 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)

1 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

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

1 B25.FormButton setClickHandler(B25.FormEventHandler handler)

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

Return value: B25.FormButton

Parameters:

Name

Type

Description

handler

B25.FormEventHandler

The handler to be fired when the button is clicked.


setFlowName

1 B25.FormButton setFlowName(String flowName)

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

flowName

String

The name of the flow to be triggered.


setHideOnNewRecords

1 B25.FormButton setHideOnNewRecords(Boolean value)

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

value

Boolean

The value that you want to set the property to.


setHideOnExistingRecords

1 B25.FormButton setHideOnExistingRecords(Boolean value)

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

value

Boolean

The value that you want to set the property to.


setHideWhenEditing

1 B25.FormButton setHideWhenEditing(Boolean value)

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

value

Boolean

The value that you want to set the property to.


setHideWhenViewing

1 B25.FormButton setHideWhenViewing(Boolean value)

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

value

Boolean

The value that you want to set the property to.


setClosesForm

1 B25.FormButton setClosesForm(Boolean value)

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

value

Boolean

The value that you want to set the property to.


setConfirmationHeader

1 B25.FormButton setConfirmationHeader(String value)

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

value

String

The header of the confirmation dialog to display.


setConfirmationBody

1 B25.FormButton setConfirmationBody(String value)

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

value

String

The body of the confirmation dialog to display.


setConfirmationButtonLabel

1 B25.FormButton setConfirmationButtonLabel(String value)

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

Description

value

String

The label of the confirmation button.

On this page