Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

Code Block
B25.FormButton setClickHandler(B25.FormEventHandler handler)

...

Return value: B25.FormButton

Parameters:

Name

Type

Description

handler

B25.FormEventHandler

The handler to be fired when the button is clicked.

...

setFlowName

Code Block
B25.FormButton setFlowName(String flowName)

...

Return value: B25.FormButton

Parameters:

Name

Type

Description

flowName

String

The name of the flow to be triggered.

...

setHideOnNewRecords

Code Block
B25.FormButton setHideOnNewRecords(Boolean value)

...

Return value: B25.FormButton

Parameters:

Name

Type

Description

value

Boolean

The value that you want to set the property to.

...

setHideOnExistingRecords

Code Block
B25.FormButton setHideOnExistingRecords(Boolean value)

...

Return value: B25.FormButton

Parameters:

Name

Type

Description

value

Boolean

The value that you want to set the property to.

...

setHideWhenEditing

Code Block
B25.FormButton setHideWhenEditing(Boolean value)

...

Return value: B25.FormButton

Parameters:

Name

Type

Description

value

Boolean

The value that you want to set the property to.

...

setHideWhenViewing

Code Block
B25.FormButton setHideWhenViewing(Boolean value)

...

Return value: B25.FormButton

Parameters:

Name

Type

Description

value

Boolean

The value that you want to set the property to.

...

setClosesForm

Code Block
B25.FormButton setClosesForm(Boolean value)

...

Return value: B25.FormButton

Parameters:

Name

Type

Description

value

Boolean

The value that you want to set the property to.

...

setConfirmationHeader

Code Block
B25.FormButton setConfirmationHeader(String value)

...

Return value: B25.FormButton

Parameters:

Name

Type

Description

value

String

The header of the confirmation dialog to display.

...

setConfirmationBody

Code Block
B25.FormButton setConfirmationBody(String value)

...

Return value: B25.FormButton

Parameters:

Name

Type

Description

value

String

The body of the confirmation dialog to display.

...

setConfirmationButtonLabel

...

Return value: B25.FormButton

Parameters:

Name

Type

value

String

...

hide

Code Block
void 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

Code Block
void 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

Code Block
global with sharing class MyFormLogic implements B25.Form.Customizer {
    global void customize(B25.Form form) {
        // add our own custom button
        form.addButton(new B25.FormButton('my-custom-button', 'My Button Label'));
        // trigger when the Reservation Type changes
        form.getField(B25__Reservation__c.B25__Reservation_Type__c).onUpdate(new MyReservationTypeHandler());
    }
    global with sharing class MyReservationTypeHandler() {
        global override void handleEvent(B25.FormEvent event, B25.Form form) {
            Id newReservationTypeId = (Id) event.getNewValue();
            B25__Reservation_Type__c reservationType = [SELECT Name FROM B25__Reservation_Type__c WHERE Id = :newReservationTypeId];
            if (reservationType.Name == 'Super Special Type') {
                form.getButton('my-custom-button').hide();
            } else {
                form.getButton('my-custom-button').show();
            }
        }
    }
}