findOrCreateLabel( )


Retrieves a label with a given name, or creates one if it doesn't exist.

The findOrCreateLabel() function returns a Promise that resolves when the specified label is found or created.

Successful calls to findOrCreateLabel() always return a label, which can be passed to subsequent function calls.

To find an existing label without potentially creating a new one, use getLabel() or queryLabels().

Note: Only visitors with Manage Contacts permissions can find or create labels. You can override the permissions by setting the suppressAuth option to true.

Method Declaration
Copy
Method Parameters
displayNamestringRequired

Label display name to retrieve or create.

If an existing label is an exact match for the specified display name, the existing label is returned. If not, a new label is created and returned.


optionsAuthOptions

Authorization options.

Returns
Return Type:Promise<FoundOrCreatedLabel>
Was this helpful?
Yes
No