lightning/stateManagerObjectInfos

This state manager retrieves metadata about multiple objects. The response includes metadata describing each object’s fields, child relationships, record type, and theme.

Syntax 

ObjectInfo details depend on only the developer (API) names of the objects.

1import { LightningElement } from 'lwc';
2import smObjectInfos from "lightning/stateManagerObjectInfos";
3
4export default class Example extends LightningElement {
5
6  const myObjectInfos = smObjectInfos({
7    objectApiNames: string[] // array of object names
8  });
9}

Configuration Functions 

setConfig()

Provide the entire configuration as an object. This function is equivalent to the factory function when you create the state manager.

setObjectApiNames()

Set the object API (developer) names for the objects to retrieve metadata for. Provide an array of strings that represent supported object names.

State Manager Properties 

status

The current status of the state manager. See status for details.

data

When status is "loaded", a results object with Object Info metadata and status codes. See the example response later in this topic.

error

When status is "error", this property contains details. See error for details.

Example Response 

Get the object metadata using data.results. The object metadata is returned in the same order that they’re requested. If a requested object contains an error, the error code and message are returned in data.results[].result. The error object is returned only if the server call fails.

1{
2  "results": [
3    {
4      "result": ObjectInfo1,
5      "statusCode": 200
6    },
7    {
8      "result": ObjectInfo2,
9      "statusCode": 200
10    },
11    {
12      "result": [
13                {
14                    "errorCode": "FORBIDDEN",
15                    "message": "You don't have access to this record. Ask your administrator for help or to request access."
16                }
17        ],
18        "statusCode": 403
19    }
20  ]
21}

See Also