Versions Compared

Key

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


Enables developers
Info
Excerpt

Allows you to find the ids of available dimensions (such as Staff or Resources) that are available for a single given reservation.

This functionality is also available in Lightning (Screen) Flow, see the last section of this page.

This class of the Apex API allows you to find Dimension records that are available for a certain Reservation.

...

Methods

Declaration

java

Description

This method returns a set with dimension ids that are available for the given input.

Signature

Expand
titlefindAvailableDimensionIds
Panel
borderStylesolid
titlefindAvailableDimensionIds(context)
Code Block
language
Code Block
global static Set<Id> findAvailableDimensionIds(B25.AvailableDimensionIds.Context
context
)

Parameters

context (
Code Block
B25.AvailableDimensionIds.Context

Class that contains the input parameters for this method. See the inner class B25.AvailableDimensionIds.Context

Returns

Set<Id>: The

for more details.

Return Type

Code Block
Set<Id>

Set containing all the dimension IDs that would not result in any conflicts, if used for the given Reservation and Dimension Field.

PanelborderStylesolidfindSingleAvailableDimensionIds

is basically the same as findAvailableDimensionIds with a few differences:

  • It is invocable, so it can be called from flows

  • It has a bulkified signature (input list + output list)

  • The result not only contains the complete collection of all available ids, but also a single id for convenience in flows when you just need an arbitrary single value.

Signature

Expand
title
findSingleAvailableDimensionId(context)
findSingleAvailableDimensionIds

Description

This method

checks, in compliance with the conflict detection engine, which dimensions are available for a given reservation, and then returns a single ID of one of the dimensions.

This is an invokable method and can be accessed from flows.

Declaration

Code Block
languagejava
Code Block
@InvocableMethod
global static List<AvailableDimensionIds.Result> findSingleAvailableDimensionId(List<AvailableDimensionIds.Context>
contextList
)

Parameters

contextList (
Code Block
List<B25.AvailableDimensionIds.Context>
) : Only a single context needs to be passes. This property is a list in order to support bulkification.

Returns

  • List<AvailableDimensionIds.Result>: A result object that contains a single dimension ID and a list of dimension IDs that would not result in any conflicts, if used for the given Reservation and Dimension Field. Only a single result object will be returned, this property is a list in order to support bulkification.
Panel
bgColorwhite
titleBGColorlightgray
borderStylesolid
titleInner Classes
Panel
borderStylesolid
titleContext

Context Properties

reservation (B25__Reservation__c, Invocable Variable):Reservation you want to insert.

A list of objects that contain the input parameters for this method. See the inner class B25.AvailableDimensionIds.Context for more details.

Return Type

Code Block
List<AvailableDimensionIds.Result>

List of results, see the inner class B25.AvailableDimensionIds.Result for more details.

Inner Classes

Expand
titleContext

Description

This class wraps the input parameters, most notably the dimension field that you are searching through and the reservation that defines the times as well as any conflict related properties.

Note

The optional properties dimensionIds/dimensionRecordIds narrow down the search scope. If neither is set, the method will query all records of the SObject type defined by dimensionFieldName. This greatly impacts performance and it is therefore recommended to fill one of these parameters when searching in dimensions with a large amount of records.

Properties

Code Block
@InvocableVariable
Reservation__c reservation

Required. Reservation you want to get available dimensions for. B25__StartLocal__c and B25__EndLocal__c need to be set.

Make sure that any fields that influence conflict checking are set (i.e.

the quantity of the reservation, or B25__Status__r.B25__AllowDoubleBooking__c if your Dimension Field is configured to skip conflict checking when this field equals true

the status or the quantity), or the result might not contain all available dimensions.

dimensionFieldName (String, Invocable Variable):
Code Block
@InvocableVariable
String dimensionFieldName

Required. The name of the dimension field you want to search an available ID for. I.e. 'B25__Resource__c'.

Code Block
dimensionIds (Set<Id>):
Set<Id> dimensionIds

Scope of dimension IDs to limit the search to. These have to be of the same SObject type as the dimension field that you are searching in.

dimensionRecordIds (List<Id>, Invocable Variable): Scope of
Code Block
@InvocableVariable
List<Id> dimensionRecordIds

Scope of dimension IDs that the invocable method searches through.

 

This is a duplicate of the dimensionIds Set and is only used for

B25.AvailableDimensionIds.

findSingleAvailableDimensionId.

Code Block
excludedReservationIds (Set<Id>):
@InvocableVariable
Set<Id> excludedReservationIds

Reservation IDs to ignore in conflict checking. This allows you to exclude reservations you are in the process of moving.

note

Return Properties

  • availableDimensionIds (List<Id>): A list of available dimension IDs
  • availableDimensionId (Id) -

    Description

    This class wraps the result, which contains a list of available dimension ids, as well as a single arbitrary available id for convenience.

    Properties

    Expand
    titleResult
    dimensionIds

    The dimensionIds and dimensionRecordIds properties narrow down the search scope. This greatly improves performance for dimensions with many records. It is recommended to fill this parameter when searching in dimensions with a large amount of records.

    Panel
    borderStylesolid
    titleResult
    Code Block
    @InvocableVariable
    List<Id> availableDimensionIds

    A list of all the available dimension IDs

    Code Block
    @InvocableVariable
    Id availableDimensionId

    A single ID of the first dimension

    in 

    in availableDimensionIds list.

    Example

    The following This example shows how you can use B25.AvailableDimensionIds.findAvailableDimensionIds methodthe class in your own code:

    language
    Code Block
    java
    public static Set<Id> getDimensions(B25__Reservation__c reservationInreservation, String dimensionFieldNameIndimensionFieldName, Set<ID>Set<Id> dimensionIdsIndimensionIds) {
        B25.AvailableDimensionIds.Context context = new B25.AvailableDimensionIds.Context();
        context.reservation = reservationInreservation;
        context.dimensionFieldName = dimensionFieldNameIndimensionFieldName;
        context.dimensionIds = dimensionIdsIndimensionIds;
        return B25.AvailableDimensionIds.findAvailableDimensionIds(context);
    }

    GoMeddo Rest API

    In the GoMeddo Rest API, a similar function called findAvailableDimensionIds exists, filtering a list of dimension IDs to retain only those where a specific reservation can be created.

    https://apidocs.gomeddo.com/#/availability/post_findAvailableDimensionIds

    Lightning (Screen) Flow Apex Action

    This functionality is also available as an Apex Action in Lightning Flow, called 'Find available dimension records':

    Set Input Values for the Selected Action

    Dimension Field Name

    Name of the Dimension Field to check

    Dimension Record Ids

    List of IDs of Dimension records to check

    Excluded Reservation Ids

    List of IDs of Dimension records to exclude

    Reservation

    Reservation for which a Dimension record is needed

    Advanced

    > Manually

    > Manually assign variables

    Available Dimension Id

    Variable containing 1 resulting ID

    Available Dimension Ids

    Variable containing 1list of resulting IDs

    Image Removed

    Related articles

    Filter by label (Content by label)
    showLabelsfalse
    max5
    spacescom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@101b6
    showSpacefalse
    sortmodified
    reversetrue
    typepage
    cqllabel = "apexapi" and type = "page" and space = "BPD"
    labelsApexApi

    ...

    hiddentrue

    ...