locked
How to debug the custom aspx page in mscrm4 RRS feed

  • Question

  • Hi,

    In my custom entity form there is a ISV button.If i click on this button getting the JavaScript error "Errors on page".

    Actually on this button click custom aspx page is calling.I think there is a problem in this custom page.

    This custom page is located at /ISV/Test/custom.aspx

    If I want to debug this page, how can i do that.

    Please help me in this, its very urgent issue.

     

    Thanks,

    Yadav

     

     


    Naveen MSCRM Technical Consultant
    Wednesday, January 26, 2011 9:18 AM

Answers

All replies

  • Hello Yadav

    It seems that error not inside your custom page but inside your button click handler. Can you please provide code of your ISV button?


    Microsoft CRM Freelancer

    My blog (english)
    Мой блог (русскоязычный)
    Wednesday, January 26, 2011 9:40 AM
    Moderator
  • Hi Andriy,

     

    Thank you very much for your immediate reply.

    I will reach to office in next 1 hour.

    Once I have reached to office, I will provide you the ISV button code.

     

    Thanks,

    Yadav 


    Naveen MSCRM Technical Consultant
    Wednesday, January 26, 2011 10:16 AM
  • Hi Yadav,

    Set a breakpoint in your   code. For your cs file, attach the debugger to the w3wp.exe process on the Microsoft Dynamics CRM server. If there are multiple processes running for the same executable file, attach the debugger to all of them because you do not know which process runs your custom code.

    Regards,


    Wednesday, January 26, 2011 11:12 AM
  • Hi Andriy,

    The follwowing is the code as present in ISV.Config file for ISV button.

    Let me know if you need any more information.

     <Button JavaScript="Asc_CreateNextInfusion();">
     <Titles>
     <Title LCID="1033" Text="Create Next Infusion" />
     </Titles>
     <ToolTips>
     <ToolTip LCID="1033" Text="Create Next Infusion" />
     </ToolTips>
     </Button>

    Thanks,

    Yadav


    Naveen MSCRM Technical Consultant
    Wednesday, January 26, 2011 12:33 PM
  • Can you please provide the OnLoad code of entity (it seems that this code must contain function) Asc_CreateNextInfusion()
    Microsoft CRM Freelancer

    My blog (english)
    Мой блог (русскоязычный)
    Wednesday, January 26, 2011 12:47 PM
    Moderator
  • Hi Andriy,

    Please find the below mentioned OnLoad code for this method. 

    window.Asc_CreateNextInfusion = function()
    {
        if (crmForm.all.invoke_nextinfusionvisitid.DataValue == null)
        {
            // No next infusion has been created for the current infusion yet

            if (crmFormSubmit.crmFormSubmitId != null && crmFormSubmit.crmFormSubmitId.value != null)
            {
                // Ajax call to create the next infusino visit
                var sUrl = "/ISV/Asc/ScheduleInfusion.aspx?OrgName=" + ORG_UNIQUE_NAME + "&Id=" + crmFormSubmit.crmFormSubmitId.value;
                var oXmlHTTP = new ActiveXObject("Msxml2.XMLHTTP");
                oXmlHTTP.Open("GET", sUrl, false);

                var oXmlDoc = null;
                var result = "";

                oXmlHTTP.Send();

                if (oXmlHTTP.status == 200)
                {
                    oXmlDoc = oXmlHTTP.responseXML;
                    result = oXmlDoc.selectSingleNode("results").text;

                    // Show result of the operation 
                    if (result.length > 0)
                    {
                            if (result == "The next infusion is successfully scheduled.") {
                                var service = new Asc_CrmService();
                                var cols = ["invoke_nextinfusionvisitid"];
                                var nextVisit = service.Retrieve("invoke_infusion", crmForm.ObjectId, cols);
                                if (nextVisit != null) {
                                    var increment = 1;
                                    var newNumber;
                                    var parentCase = new Array();
                                    parentCase = crmForm.all.item("invoke_treatmentcaseid").DataValue;
                                    if (parentCase != null) {
                                        var currentNumber = getCurrentInfusionVisitNumber(parentCase[0].id);
                                        if (currentNumber == null || currentNumber == "") {
                                            newNumber = "001";
                                        }
                                        else {
                                            newNumber = parseInt(currentNumber, 10) + parseInt(increment, 10);
                                            newNumber = padZeros(newNumber, currentNumber.length);
                                        }

                                        // store the new number
                                        storeNewInfusionVisitNumber(parentCase[0].id, newNumber);

                                        // save the new number on the form
                                        var sDecimalIncrement = ".00"; // this value will get updated as part of different process
                                        var service = new Asc_CrmService();
                                        var entityToUpdate = new BusinessEntity("invoke_infusion");
                                        entityToUpdate.attributes["invoke_infusionid"] = nextVisit.attributes["invoke_nextinfusionvisitid"].value;
                                        entityToUpdate.attributes["invoke_name"] = parentCase[0].name + "-" + newNumber + sDecimalIncrement;
                                        entityToUpdate.attributes["us_previousinfusionnumberstring"] = newNumber;
                                        service.Update(entityToUpdate);
                                    }
                                }
                            }
                            alert(result);
                    }
                }
                else
                {
                    alert("Unable to schedule infusion: missing script.");
                }
            }
        }
        else
        {
            //Next infusion exists

            alert("Next Infusion has already been created.");
        }
    }

     

    Thanks,

    Yadav


    Naveen MSCRM Technical Consultant
    Wednesday, January 26, 2011 1:00 PM
  • Hello Naveen.

    You should set debugger; directive inside function, enable debug in your browser and ste-by-step debug this function.


    Microsoft CRM Freelancer

    My blog (english)
    Мой блог (русскоязычный)
    Wednesday, January 26, 2011 1:07 PM
    Moderator
  • Hi Andriy,

    I have debugged this function.

    In this function while executing the below line getting the error Object Required in response.text (In Quickwatch).

    result = oXmlDoc.selectSingleNode("results").text;

    In the error description like : Tectura assembly is not found or you have missed the assembly reference.

    What could be the reason.

     

    Thanks,

    Yadav


    Naveen MSCRM Technical Consultant
    Wednesday, January 26, 2011 1:35 PM
  • Try to add following code

    alert(sUrl);

    after your line

    var sUrl = "/ISV/Asc/ScheduleInfusion.aspx?OrgName=" + ORG_UNIQUE_NAME + "&Id=" + crmFormSubmit.crmFormSubmitId.value;

     

    copy the url and try to open it using your browser. It seems that your page doesn't work properly.


    Microsoft CRM Freelancer

    My blog (english)
    Мой блог (русскоязычный)
    Wednesday, January 26, 2011 2:09 PM
    Moderator
  • Hi Andriy,

    While trying to access the sUrl in new browser getting the follwoing error message.

    Error Description:

    CS0246: The type or namespace name 'Tectura' could not be found (are you missing a using directive or an assembly reference?)


    Error Details:

    Please help.
    Thanks,
    Yadav

    Naveen MSCRM Technical Consultant
    Wednesday, January 26, 2011 2:52 PM
  • This means that developed page doesn't work properly. It seems that  you're out of some required assemblies. You have to ensure that all the assemblies installed properly.

    Microsoft CRM Freelancer

    My blog (english)
    Мой блог (русскоязычный)
    Wednesday, January 26, 2011 3:00 PM
    Moderator
  • Hi Andriy,

    This problem has been resolved.

    I have placed the required dll into CRMWeb bin folder.

     

    Thanks,

    Yadav


    Naveen MSCRM Technical Consultant
    Friday, January 28, 2011 6:49 AM
  • How do you manage that if it's not in test but in production and you can't debug it, which kind of alert can I add in the code ... ???

    thanks

    Monday, July 4, 2011 7:42 AM