Lock Item and all related Items on opening Form

What is the code equivalent of clicking the Lock button? I have an ItemType, QN, with a Classification PVN. If a user opens a PVN, I want to run code to make it lock automatically. I've tried top.onLockCommand(), but this only locks the Item itself, not the related Items. I've tried cycling through all the related Items and unlocking them one by one, but this only works if I then click the Refresh button, or close the PVN and re-open it.

Parents Reply Children
  • I had, and it hadn't worked, but I was ultimately able to resolve this by setting a timeout on the command, that only allows it to run once the Relationships are fully loaded. Thank you for the assistance.

    setTimeout(refreshForm, 10);

    function refreshForm()
    if (!isTabbarReady()){
    setTimeout(refreshForm, 10);

    var res = Boolean(parent &&
    parent.relationships &&
    parent.relationships.document &&
    parent.relationships.document.readyState == "complete" &&
    parent.relationships.relTabbar &&
    top &&
    top.menuFrame &&
    return res;