Skip to main content

Layers

getGalleryLayers

List available gallery layers.

Parameters: None

Usage:

const gallery = await control.getGalleryLayers();
Response
[
{
"layerId": "d9ba522d-f7ef-4147-9a85-0d14b15f38ca",
"layerName": "Contact",
"layerType": "DataverseLayer",
"layerDescription": "Person with whom a business unit has a relationship, such as customer, supplier, and colleague.",
"subLayers": [
{
"sublayerId": "7b406359-6d7f-4109-8179-37d62a89638d",
"sublayerName": "My Active Contacts",
"sublayerDescription": null
},
{
"sublayerId": "a5e611d9-b6b4-431a-816b-cc6eca6d52b8",
"sublayerName": "All Contacts",
"sublayerDescription": null
}
]
}
]

getSublayerAttributes

Gets all sublayers details

Parameters:

FieldTypeRequiredDescription
sublayerIdstringYesId of a sublayer returned by getGalleryLayers().

Usage:

const attributes = await control.getSublayerAttributes(sublayerId);
Response
{
"sublayerId": "7b406359-6d7f-4109-8179-37d62a89638d",
"sublayerName": "My Active Contacts",
"sublayerDescription": null,
"subLayerAttributes": [
{
"fieldName": "contactid",
"displayName": "Contact",
"displayType": "String",
"isFilterable": true,
"orderNumber": 1,
"type": "guid",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "emailaddress1",
"displayName": "Email",
"displayType": "String",
"isFilterable": true,
"orderNumber": 2,
"type": "string",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "fullname",
"displayName": "Full Name",
"displayType": "String",
"isFilterable": true,
"orderNumber": 3,
"type": "string",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "parentcustomerid",
"displayName": "Company Name",
"displayType": "Object",
"isFilterable": true,
"orderNumber": 4,
"type": "object",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "telephone1",
"displayName": "Business Phone",
"displayType": "String",
"isFilterable": true,
"orderNumber": 5,
"type": "string",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "mtrcore_latitude",
"displayName": "Latitude",
"displayType": "Number",
"isFilterable": true,
"orderNumber": 262,
"type": "number",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "mtrcore_longitude",
"displayName": "Longitude",
"displayType": "Number",
"isFilterable": true,
"orderNumber": 263,
"type": "number",
"value": "",
"visibility": true,
"enabled": true
}
]
}

createSublayerInstance

Enable a sublayer based on enabled layers

Parameters:

FieldTypeRequiredDescription
sublayerIdstringYesId of a sublayer returned by getGalleryLayers().

Usage:

await control.createSublayerInstance(sublayerId);

createSublayerInstanceWithFilter

Enable a sublayer with an initial filter based on enabled layers

Parameters:

FieldTypeRequiredDescription
sublayerIdstringYesId of a sublayer returned by getGalleryLayers().

Usage:

await control.createSublayerInstanceWithFilter(sublayerId, {
type: 'ui',
expressions: [{ field: 'status', operator: 'equals', value: 'Active' }],
matchType: 'all'
});

getEnabledSublayerInstances

Return an array of currently enabled (instantiated) sublayer instances.

Parameters: None

Usage:

const enabled = await control.getEnabledSublayerInstances();
console.log(enabled);
Response
[
{
"sublayerInstanceId": "fba870dc-284d-4b7d-a37f-84ed3a9ada8d",
"sublayerId": "81c285b6-5962-437c-8ae4-a1312441809d",
"sublayerName": "Active Accounts",
"subLayerAttributes": [
{
"fieldName": "accountid",
"displayName": "Account",
"displayType": "String",
"isFilterable": true,
"orderNumber": 1,
"type": "guid",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "address1_city",
"displayName": "Address 1: City",
"displayType": "String",
"isFilterable": true,
"orderNumber": 2,
"type": "string",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "name",
"displayName": "Account Name",
"displayType": "String",
"isFilterable": true,
"orderNumber": 3,
"type": "string",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "_primarycontactid_value",
"displayName": "Primary Contact Id",
"displayType": "String",
"isFilterable": true,
"orderNumber": 4,
"type": "lookup",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "_primarycontactid_value@OData.Community.Display.V1.FormattedValue",
"displayName": "Primary Contact",
"displayType": "String",
"isFilterable": true,
"orderNumber": 4,
"type": "string",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "telephone1",
"displayName": "Main Phone",
"displayType": "String",
"isFilterable": true,
"orderNumber": 5,
"type": "string",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "accountprimarycontactidcontactcontactid.emailaddress1",
"displayName": "Email",
"displayType": "String",
"isFilterable": true,
"orderNumber": 1,
"type": "string",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "mtrcore_latitude",
"displayName": "Latitude",
"displayType": "Number",
"isFilterable": true,
"orderNumber": 180,
"type": "number",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "mtrcore_longitude",
"displayName": "Longitude",
"displayType": "Number",
"isFilterable": true,
"orderNumber": 181,
"type": "number",
"value": "",
"visibility": true,
"enabled": true
}
]
},
{
"sublayerInstanceId": "ab27366c-9450-4d1b-9b56-a883b4380212",
"sublayerId": "a5e611d9-b6b4-431a-816b-cc6eca6d52b8",
"sublayerName": "All Contacts",
"subLayerAttributes": [
{
"fieldName": "contactid",
"displayName": "Contact",
"displayType": "String",
"isFilterable": true,
"orderNumber": 1,
"type": "guid",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "emailaddress1",
"displayName": "Email",
"displayType": "String",
"isFilterable": true,
"orderNumber": 2,
"type": "string",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "fullname",
"displayName": "Full Name",
"displayType": "String",
"isFilterable": true,
"orderNumber": 3,
"type": "string",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "parentcustomerid",
"displayName": "Company Name",
"displayType": "Object",
"isFilterable": true,
"orderNumber": 4,
"type": "object",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "statecode",
"displayName": "Status",
"displayType": "Object",
"isFilterable": true,
"orderNumber": 5,
"type": "object",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "telephone1",
"displayName": "Business Phone",
"displayType": "String",
"isFilterable": true,
"orderNumber": 6,
"type": "string",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "mtrcore_latitude",
"displayName": "Latitude",
"displayType": "Number",
"isFilterable": true,
"orderNumber": 264,
"type": "number",
"value": "",
"visibility": true,
"enabled": true
},
{
"fieldName": "mtrcore_longitude",
"displayName": "Longitude",
"displayType": "Number",
"isFilterable": true,
"orderNumber": 265,
"type": "number",
"value": "",
"visibility": true,
"enabled": true
}
]
}
]

showSublayerInstance

Once a sublayer is available in layer panel then you can toggle its visibility

Parameters:

FieldTypeRequiredDescription
subLayerInstanceIdstringYesId of the enabled sublayer instance to make visible.

Usage:

await control.showSublayerInstance(sublayerInstanceId);

hideSublayerInstance

Once a sublayer is available in layer panel then you can toggle its visibility

Parameters:

FieldTypeRequiredDescription
subLayerInstanceIdstringYesId of the enabled sublayer instance to hide.

Usage:

control.hideSublayerInstance(sublayerInstanceId);

removeSublayerInstance

Removes the layer instance from the layer panel and the map. This action fully disables the layer until it is re-added.

Parameters:

FieldTypeRequiredDescription
subLayerInstanceIdstringYesId of the enabled sublayer instance to remove entirely.

Usage:

control.removeSublayerInstance(sublayerInstanceId);

Pans and zooms the map to the geographic extent of the specified enabled layer instance.

Parameters:

FieldTypeRequiredDescription
subLayerInstanceIdstringYesId of the enabled sublayer instance whose extent to navigate to.

Usage:

control.navigateToSublayerInstance(sublayerInstanceId);

filterSublayerInstance

Apply or replace a filter on an existing sublayer instance. Each call overwrites the previous filter of the same filter type.

Parameters:

FieldTypeRequiredDescription
subLayerInstanceIdstringYesTarget enabled sublayer instance.
filterFilterYesObject with type, expressions[], matchType ('all' or 'any'). Overwrites previous filter of same type.

Usage:

control.filterSublayerInstance(instanceId, {
type: 'ui',
expressions: [{ field: 'priority', operator: 'greaterThanOrEquals', value: 3 }],
matchType: 'all'
});
tip

Use distinct type values (e.g. ui, search, action) to layer multiple logical filters if supported.


clearFilterFromSublayerInstance

Removes any filter applied to an active sublayer in the panel

Parameters:

FieldTypeRequiredDescription
subLayerInstanceIdstringYesId of the enabled sublayer instance to clear filters from.

Usage:

control.clearFilterFromSublayerInstance(sublayerInstanceId);

updateSublayerInstanceOpacity

Change the visual opacity (transparency) of a sublayer instance.

Parameters:

FieldTypeRequiredDescription
subLayerInstanceIdstringYesId of the enabled sublayer instance to modify.
opacitynumberYes0 (transparent) to 100 (opaque). Values outside range are clamped.

Usage:

await control.updateSublayerInstanceOpacity(instanceId, 50);

getVisibleSublayerInstanceData

Retrieve a paged set of features currently within the map view for a given instance.

Parameters:

FieldTypeRequiredDescription
subLayerInstanceIdstringYesInstance whose visible features to fetch.
pageNumbernumberYes1-based page index.
pageTokenstringOptionalContinuation token from prior call if paging further.

Usage:

const page1 = await control.getVisibleSublayerInstanceData(instanceId, 1);
if (page1?.nextPageToken) {
const page2 = await control.getVisibleSublayerInstanceData(instanceId, 2, page1.nextPageToken);
}
Response
{
"features": [
{
"id": "1757988822653",
"geometry": {
"type": "Point",
"coordinates": [
121.85909,
-27.4556179
]
},
"properties": {},
"centroid": {
"x": 121.85909,
"y": -27.4556179,
"z": 0
},
"extent": {
"xmin": 121.85909,
"ymin": -27.4556179,
"xmax": 121.85909,
"ymax": -27.4556179,
"zmin": 0,
"zmax": 0,
"spatialReference": {
"wkid": 4326,
"latestWkid": 4326
}
},
"totalCoordinateCount": 1,
"levelOfDetail": 0,
"layerInstanceId": "fba870dc-284d-4b7d-a37f-84ed3a9ada8d"
},
{
"id": "1757988822654",
"geometry": {
"type": "Point",
"coordinates": [
122.1263031,
-27.636399
]
},
"properties": {},
"centroid": {
"x": 122.1263031,
"y": -27.636399,
"z": 0
},
"extent": {
"xmin": 122.1263031,
"ymin": -27.636399,
"xmax": 122.1263031,
"ymax": -27.636399,
"zmin": 0,
"zmax": 0,
"spatialReference": {
"wkid": 4326,
"latestWkid": 4326
}
},
"totalCoordinateCount": 1,
"levelOfDetail": 0,
"layerInstanceId": "fba870dc-284d-4b7d-a37f-84ed3a9ada8d"
}
],
"allDataReturned": true
}

getAllSublayerInstanceData

Retrieve paged features ignoring current map extent (full dataset slice for the instance, subject to server limits).

Parameters:

FieldTypeRequiredDescription
subLayerInstanceIdstringYesInstance whose full dataset slice to fetch.
pageNumbernumberYes1-based page index.
pageTokenstringOptionalContinuation token from prior call if paging further.

Usage:

control.getAllSublayerInstanceData(sublayerInstanceId, 1);

showVisibleDataTabForSublayerInstance

Displays the data tab for the specified sublayer instance, automatically filtering the table to show only the features currently visible within the user's map view. Parameters:

FieldTypeRequiredDescription
subLayerInstanceIdstringYesInstance whose data tab should display filtered to current map view.

Usage:

control.showVisibleDataTabForSublayerInstance(subLayerInstanceId);

showAllDataTabForSublayerInstance

Displays the data tab for the specified sublayer instance, displaying all data for that sublayer.

Parameters:

FieldTypeRequiredDescription
subLayerInstanceIdstringYesInstance whose full data tab should display (ignores current view extent).

Usage:

control.showAllDataTabForSublayerInstance(subLayerInstanceId);

hideDataTabForSublayerInstance

Hides the data tab for the specified sublayer instance.

Parameters:

FieldTypeRequiredDescription
subLayerInstanceIdstringYesInstance whose data tab should be hidden.

Usage:

control.hideDataTabForSublayerInstance(subLayerInstanceId);

hideAllDataTabs

Hides all data tabs on the map.

Parameters:

FieldTypeRequiredDescription
subLayerInstanceIdstringYes(Optional usage) Provided if API supports targeted hide; otherwise hides all tabs regardless.

Usage:

control.hideAllDataTabs(subLayerInstanceId);