Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. // The idea is to create a master item visualisation from
  2. // an existing dashboard object
  3. // If the requirement is to create a master item from json (exported from another app)
  4. // the first step is to create the source object first and the use it
  5. // to create the master item and then drop the source (if needed)
  6.  
  7. // Create empty object with type of masteritem
  8. let myMasterItem = await qDoc.createObject({
  9. "qInfo": {
  10. "qId": "my-id",
  11. "qType": "masterobject"
  12. },
  13. "qExtendsId": "",
  14. "qMetaDef": {"tite": "", "description": "", "tags": []},
  15. "qStateName": ""
  16. }
  17. )
  18.  
  19. // Copy the properties from an existing object
  20. await myMasterItem.copyFrom("my-source-object")
  21.  
  22. // Get the masteritem properties and update the meta definition
  23. // setting the title and description
  24. let myMasterItemProperties = await myMasterItem.getProperties()
  25. myMasterItemProperties.qMetaDef = {title: "My Master Item", description: "Master Item created with Engine API", tags: []}
  26.  
  27. //Finally - update the master item properties with the changed mete def
  28. await myMasterItem.setProperties(myMasterItemProperties)
  29.  
  30. // at this point is safe to drop the source object ... if required
  31. // await qDoc.deleteObject("my-source-object")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement