Params
attributes
(Object) – The custom attributes and their values of the new CMS object.
Throws
ArgumentError
– If a given attribute is invalid.
Returns
The created Obj
.
See also
Example
Create an object belonging to every site:
Creates a new Obj
with the given attributes
and assigns it to the site.
frenchPost = Scrivito.getClass("BlogPost").onSite('fr');
frenchPost.create({ title: "Salut tout le monde!" });
Params
attributes
(Object) – The custom attributes and their values of the new CMS object.Throws
ArgumentError
– If a given attribute is invalid.Returns
The created Obj
.
See also
Example
Create an object belonging to every site:
BlogPost = Scrivito.getClass("BlogPost");
sharedObj = BlogPost.onAllSites().create({ title: "Available from all sites" });
objId = sharedObj.id();
await sharedObj.finishSaving();
console.log({
en: BlogPost.onSite('en').get(objId).get("title"),
fr: BlogPost.onSite('fr').get(objId).get("title")
});