Test Enterprise-Class Web CMS Scrivito Free for 30 Days
Test Scrivito Free for 30 Days
New in 1.18.0

get(id)

Retrieves the Obj specified by its id, if it is part of the site context.

frenchSite = Scrivito.Obj.onSite('fr');
pageId = Scrivito.load(() => frenchSite.root().children()[0].id());
page = frenchSite.get(pageId);

console.log(page.get("title"));

Params

  • id (String) – The id of the Obj.

Returns

  • Returns the specified Obj, or null if the CMS object with the specified id does not exist or is not assigned to the site of the context.

See also

Obj.get

Examples

Retrieve the object even if it is unknown to which site it is assigned:

objId = "1fc90bb3c80a59dd";
obj = Scrivito.Obj.onAllSites().get(objId);

console.log(obj.get("headline"));