Shortcut button in form to show workflow

Hi Users asks for a link directly in the form to the workflow. I'm thinking of adding a button in the form and when pressed it shows the workflow. Actually just a shortcut instead of going to the menu - Views - Workflow. The method behind must be generic so it works on all itemtypes where it's added. A lot of infrequent users never find their way to the menu so the idea was to give them easier access to the workflow view. Kind Regards Henrik Olesen Kamstrup Denmark
  • Create HTML field: And use following code:
    
    <script>
        function showWorkflowProcess() {
    		if (document.item && !top.aras.isTempEx(document.item)) { 
    			var wfProcessId;
    			var q = new top.Item("tmp", "tmp");
    			q.loadAML("<Item type='Workflow' action='get' select='related_id(*)'>" +
    						"<source_id>" + document.item.getAttribute("id") + "</source_id>" +
    						"<related_id condition='is not null'/>" +
    					  "</Item>");
    			q = q.apply();
    			if (q.getItemCount() == 1 && !q.isError()) {
    				wfProcessId = q.getItemByIndex(0).getProperty("related_id", "");
    			} 
    			
    			if (wfProcessId !== "") {
    				top.aras.uiShowItem("Workflow Process", wfProcessId);
    			}
    		}
    	}
    </script>
    
    <button type="button" onclick="showWorkflowProcess();" style="background-color: white; border: none; cursor: pointer;" id="openWorkflowBtn_btn">
        <img src="../images/WorkflowProcess.svg" border='0' width="25" height="25" />
    </button>
  • Hi Zahar I just added the HTML field and the code. Works perfectly. Thank you very much for quick reply.   Regards Henrik