Workflow is enabled in the system.
There is a context menu button added to the editor which makes use of Page metadata. The Event System will update the current page path in the page metadata on when the SAVE event is triggered.
But as workflow is enabled in the system, whenever I copy a page from one SG to another SG, clicking the save button explicitly will trigger the Workflow.
Until the workflow is completed I am unable to get the modified metadata in the Context menu JS code (Event System will update the modified the current page path in metadata).
Suspected reason : Unable to fetch the metadata for minor version.
Current code :
var itemId = selection.getItem(0);
var item = $models.getItem(itemId);
var contentXml = item.getStaticXmlDocument();
var currentPath = $xml.getInnerText(contentXml, "//*[local-name()='current_path']");
How should I handle the scenario in JavaScript?