henning1518 2 Report post Posted February 4 Hi, is it possible to open the rootcause "selection form" in reading-mode when the rootcause is empty and someone is clicking the SOLN-Button? Button: ImgBtnCreate("btnSOL", "Solution", 'openrootcause();', 1, 0); openrootcause() { <PDM_IF "$args.rootcause" == ""> 1. open rootcause selection 2. Update and save ticket } Thanks a lot Share this post Link to post Share on other sites
henning1518 2 Report post Posted February 6 (edited) Found a solution from cdtj that changes the ticket status with a button. I adapted it with my needs and know it´s really ugly (Hope it will not causes problems in future): function empty_rootcause() { alert("First enter a rootcause!"); window.localStorage.setItem('rootcause_empty', 'yes'); console.log(localStorage); var status = 'KE'; var query_str = cfgCgi + "?SID=$prop.SID+FID=$prop.FID+OP=UPDATE" + "+FACTORY=cr+PERSID=" + "$args.persistent_id" + "+KEEP.new_status=" + status; browseWithURL(query_str); } function open_rootcause() { <PDM_IF "$args.rootcaue" == "" && "$prop.form_name_3" == "edit"> function emptytrue() { if (currentAction == 0 && localStorage.getItem("rootcause_empty") == "yes") { clearInterval(myInterval); ahdframe.document.getElementsByName('SET.status')[0].value = "$args.KEEP.new_status"; jQuery("label[for='df_5_2']")[0].click(); window.localStorage.removeItem('rootcause_empty'); console.log(localStorage); } } if (('$args.KEEP.new_status' != '') && ('$prop.form_name_3' == 'edit')) { var myInterval = setInterval(emptytrue, 100); } </PDM_IF> } ImgBtnCreate("btnSOLN", "Solution", 'empty_rootcause();', 1, 0); <body class="detailro" onload='loadActions();open_rootcause();' onunload="unloadActions()"> Thanks @cdtj Edited February 6 by henning1518 Share this post Link to post Share on other sites
cdtj 29 Report post Posted February 7 Looks a bit strange but good if works Don't forget to remove console.log or add check that console is object (typeof console != "undefined") or code will fail on IE. Also you're passing unique variable in KEEP array so you can avoid localStorage which also browser specific (nothing bad could happen if IE7 which is million years old is not used in your company): function empty_rootcause() { var status = 'KE'; var query_str = cfgCgi + "?SID=$prop.SID+FID=$prop.FID+OP=UPDATE" + "+FACTORY=cr+PERSID=" + "$args.persistent_id" + "+KEEP.new_status=" + status; browseWithURL(query_str); } function open_rootcause() { <PDM_IF "$args.rootcaue" == "" && "$prop.form_name_3" == "edit" && "$args.KEEP.new_status" != ""> function emptytrue() { if (currentAction == 0) { clearInterval(myInterval); jq('[name=SET.status]').val("$args.KEEP.new_status"); jq("label[for='df_5_2']")[0].click(); } } <PDM_IF "$args.KEEP.new_status" != "" && "$prop.form_name_3" == "edit"> var myInterval = setInterval(emptytrue, 100); </PDM_IF> </PDM_IF> } PS: More PDM_IF tags less onform code for client Share this post Link to post Share on other sites