How to map custom field on space table.

SakeenaF
Tera Contributor

Hi Team,

 

I have a requirement to populate a custom field on the Space table (sn_wsd_core_space) when the space type is set to “Miscellaneous.” When I use reservable.location_type, the location correctly shows as “Miscellaneous,” but when I try to access my custom field using reservable.custom_field_name, it returns empty. I need help understanding where this reservable object is coming from so that I can correctly reference and populate my custom field.

 

Code for Space Type (Miscellaneous):

if (reservable.location_type) {

    var locationDisplay = reservable.location_type.display_value ||
                          reservable.location_type.name ||
                          reservable.location_type;

    var spaceInfoItem = {
        id: 'maintain_space_information',
        field: 'maintain_space_information',

        // keep label for accessibility (tooltip, aria)
        label: 'space',

        icon: 'fa-info-circle',
        iconClass: 'fa fa-info-circle',

        // IMPORTANT: put label inside value
        value: 'Space:' + locationDisplay,

        displayValue: locationDisplay,
        tooltip_value: locationDisplay
    };

    // Insert after Seats
    var inserted = false;
    for (var i = 0; i < obj.body.length; i++) {
        if (obj.body[i].field === 'capacity' || obj.body[i].field === 'seats') {
            obj.body.splice(i + 1, 0, spaceInfoItem);
            inserted = true;
            break;
        }
    }

    if (!inserted) {
        obj.body.push(spaceInfoItem);
    }
}
 
Code for Custom filed on Space table:
if (reservable.cust_type) {

 

    var locationCust = reservable.cust_type.display_value ||
                          reservable.cust_type.name ||
                          reservable.cust_type;

 

    var spaceInfoItem = {
        id: 'maintain_space',
        field: 'maintain_space',

 

        // FORCE label properly
        label: 'Maintain space',

 

        icon: 'fa-info-circle',
        iconClass: 'fa fa-info-circle',

 

        // THESE TWO ARE CRITICAL (Angular uses value)
        displayValue: locationCust,
        value: locationCust,

 

        tooltip_value: locationCust
    };
 
 
Please its quite urgent. Help me.
 
Thanks in advance.
 
@_raj_esh Need your inputs.
1 REPLY 1

SakeenaF
Tera Contributor

SakeenaF_0-1778836212932.png