Skip to main content
2 of 2
added 165 characters in body
Cristi Vulturar
  • 2.3k
  • 2
  • 7
  • 28

Instead of using the string approach written in the sitecore documentation https://doc.sitecore.com/developers/93/sitecore-experience-manager/en/the-restful-api-for-the-itemservice.html when sending the data for the item creation, for example:

xhr.send("{\n \"ItemName\": \"Home\", \n \"TemplateID\": \"76036f5e-cbce-46d1-af0a-4143f9b557aa\",
\n    \"Title\": \"Sitecore\" \n}");

you can use this approach instead to set the sortorder during Create Item:

  var obj = {};
  obj['ItemName'] = "Home";
  obj['TemplateID'] = "76036f5e-cbce-46d1-af0a-4143f9b557aa";
  obj['__Sortorder'] = "you custom sort order value";
  xhr.send(JSON.stringify(obj, null, 4));

Same approach can be used when editing an item, you can set other standard fields as long as you set the correct field names, for example obj['__Final Renderings']

Cristi Vulturar
  • 2.3k
  • 2
  • 7
  • 28