CA Service Management

 View Only

Open custom form with a button on detail_chg

  • 1.  Open custom form with a button on detail_chg

    Posted 26 days ago
    Edited by John Carmino 26 days ago
    Hey guys,
     
    can anyone help me?

    So, I have this link on menubar_sd.htmpl
    <PDM_OBJECT>
    if ("$env.NX_EDIT_INACTIVE" != "No" || (typeof main_frame.argActive != "undefined" && main_frame.argActive == "1"))
    {
    htmpl_str = "+HTMPL="
    if ( factory == "chg" )
      htmpl_str += "z_question_chg.htmpl";
    <PDM_MACRO name=menuItemLocal label="Questionário de aprovação..." function="JavaScript: popupActivityWithURL('\" + query_str1 + \"LOG\" + htmpl_str + \"','')">
    }
    </PDM_OBJECT>
     
     

    This link build the URL: http://localhost:8080/CAisd/pdmweb.exe?SID=1653730014+FID=7990+FACTORY=chg+PERSID=chg:400124+OP=UPDATE+ACTIVITY_LOG_TYPE=LOG+HTMPL=z_question_chg.htmpl+KEEP.POPUP_NAME=USD1693831762501+KEEP.use_role=1+KEEP.use_role=1

    I need custom a button on detail_chg.htmpl to open this URL, but the PDM_MACRO that I wrote does not work with that URL.
    <PDM_MACRO name=button Caption="Questionário" Func="OpenQuest();" hotkey_name="Questionário" ID=btn002>
    <script>
    function OpenQuest() {
        var fid = fid_generator();
        var url = cfgCgi + "?SID=" + cfgSID + "+FID=" + fid + "+FACTORY=chg" + "+PERSID=" + "$args.persistent_id" + "+OP=UPDATE+ACTIVITY_LOG_TYPE=LOG" + "+HTMPL=z_question_chg.htmpl+KEEP.POPUP_NAME=$args.KEEP.POPUP_NAME+KEEP.use_role=1+KEEP.use_role=1";

       
        var popupWindow = window.open(url, "Questionário", "width=600,height=400");
       
       
        if (!popupWindow || popupWindow.closed) {
            alert("O navegador bloqueou o popup. Por favor, permita popups neste site.");
        }
    }
    </script>


    The PopUp opens blank. The form does not load.
    In the console I can see these errors:
    Uncaught TypeError: Cannot set properties of undefined (setting 'next_persid')
    detail_form.js:1001 Uncaught TypeError: Cannot read properties of undefined (reading 'colNum')
    Uncaught TypeError: Cannot read properties of null (reading 'style')
    .
    .
    .
    .
    .
    Thanks for you help.
    John