Skip to main content
All CollectionsFlatfile Data Exchange PlatformGeneral
Is It Possible to Access Space-Level Metadata Using the Record Hook Plugin?
Is It Possible to Access Space-Level Metadata Using the Record Hook Plugin?
Elisa Dinsmore avatar
Written by Elisa Dinsmore
Updated over a year ago

This article is for the latest version of the Flatfile Data Exchange Platform.

It is! The Record Hook Plugin includes the event parameter which can be used to gather context about the current space, including the spaceId. This can be used with the API to gather space-level metadata.

Example:

listener.use(
recordHook("Employees", async (record, event) => {
//grab spaceId from the event context
const spaceId = event.context.spaceId;

//grab space information
const meta = await api.spaces.get(spaceId);

//set variable from metadata
const userId = meta.data.metadata.user;

//use variable in recordHook
setLastName(record, userId);
return record;
})
);
Did this answer your question?