locked
MSCRM 2011 Duplicate case entity error RRS feed

  • Question

  • Hi all,

    I'm having a problem on duplicating case entity via openEntityForm statement. I think the problem is about URL string lenght as error message says. I have read everything on the net that i found but unfortunately there is no solution.

    I have changed the maxQueryString value. -> Fail

    You can find error msg and Event viewer log below:

    HTTP Error 404.15 - Not Found

    The request filtering module is configured to deny a request where the query string is too long.

    Event Viewer:

    Event code: 3005 
    Event message: An unhandled exception has occurred. 
    Event time: 7/21/2015 11:16:16 AM 
    Event time (UTC): 7/21/2015 8:16:16 AM 
    Event ID: f0d5a13e1d5349d092dc576817400f2c 
    Event sequence: 1418720 
    Event occurrence: 6 
    Event detail code: 0 

    Application information: 
        Application domain: /LM/W3SVC/1/ROOT-1-130818813357865626 
        Trust level: Full 
        Application Virtual Path: / 
        Application Path: C:\Program Files\Microsoft Dynamics CRM\CRMWeb\ 
        Machine name: XXXXXX 

    Process information: 
        Process ID: 4308 
        Process name: w3wp.exe 
        Account name: NT AUTHORITY\NETWORK SERVICE 

    Exception information: 
        Exception type: InvalidOperationException 
        Exception message: CRM Parameter Filter - Invalid parameter 'caseorigincode=2' in Request.QueryString on page /XXXXX/home/homepage/home_news.aspx
    The raw request was 'GET /XXXXXXX/home/homepage/home_news.aspx?caseorigincode=2&casetypecode=3&customerid=[%]...........................

    My Source Code:

    function DuplicateCase() {
        //get values from the Form
        //var CaseId = Xrm.Page.data.entity.getId();
        if (Xrm.Page.data.entity.attributes.get("customerid").getValue() != null) {
        var CustomerId   = Xrm.Page.data.entity.attributes.get("customerid").getValue()[0].id;
        var CustomerName = Xrm.Page.data.entity.attributes.get("customerid").getValue()[0].name;
        var CustomerType = Xrm.Page.data.entity.attributes.get("customerid").getValue()[0].entityType;
        }
        if (Xrm.Page.data.entity.attributes.get("new_malzeme").getValue() != null) {
        var MatNumbId     = Xrm.Page.data.entity.attributes.get("new_malzeme").getValue()[0].id;   
        var MatNumbName   = Xrm.Page.data.entity.attributes.get("new_malzeme").getValue()[0].name;
        }
        if (Xrm.Page.data.entity.attributes.get("new_satisburosu").getValue() != null) {
        var SatBurId      = Xrm.Page.data.entity.attributes.get("new_satisburosu").getValue()[0].id;
        var SatBurName    = Xrm.Page.data.entity.attributes.get("new_satisburosu").getValue()[0].name;
        }
        var Talep       = Xrm.Page.data.entity.attributes.get("new_talep").getValue();
        var ilgiliKisi  = Xrm.Page.data.entity.attributes.get("new_ilgilikisi").getValue();
        var UrunAdi     = Xrm.Page.data.entity.attributes.get("new_urunadi").getValue();
        var Zamanlama   = Xrm.Page.data.entity.attributes.get("new_zamanlama").getValue();
        var Email       = Xrm.Page.data.entity.attributes.get("new_mail").getValue();
        if (Xrm.Page.data.entity.attributes.get("new_siparis").getValue() != null) {
        var SiparisId   = Xrm.Page.data.entity.attributes.get("new_siparis").getValue()[0].id;
        var SiparisName = Xrm.Page.data.entity.attributes.get("new_siparis").getValue()[0].name;
        }
        var Adet        = Xrm.Page.data.entity.attributes.get("new_adet").getValue();
        var Durumu      = Xrm.Page.data.entity.attributes.get("incidentstagecode").getValue();
        var telefon     = Xrm.Page.data.entity.attributes.get("new_telefon").getValue();
        var SrvOzt      = Xrm.Page.data.entity.attributes.get("title").getValue();
        if (Xrm.Page.data.entity.attributes.get("new_mhyetkilisi").getValue() != null) {
        var MHyetkilisiId   = Xrm.Page.data.entity.attributes.get("new_mhyetkilisi").getValue()[0].id;
        var MHyetkilisiName = Xrm.Page.data.entity.attributes.get("new_mhyetkilisi").getValue()[0].name;
        }
        var islemBelgNo = Xrm.Page.data.entity.attributes.get("new_islembelgeno").getValue();        
        if (Xrm.Page.data.entity.attributes.get("new_sikayetinfabrikayagelistarihi").getValue() != null) {
        var FabGelTrh   = FormatDate("new_sikayetinfabrikayagelistarihi");
        }
        var Garanti     = Xrm.Page.data.entity.attributes.get("new_garanti").getValue();
        if (Xrm.Page.data.entity.attributes.get("new_uretimdencikistarihi").getValue() != null) {
        var UrCksTrh    = FormatDate("new_uretimdencikistarihi");
        }
        var SerTalTuru  = Xrm.Page.data.entity.attributes.get("casetypecode").getValue();
        var Sevkiyat    = Xrm.Page.data.entity.attributes.get("new_sevkiyatsekli").getValue();
        if (Xrm.Page.data.entity.attributes.get("new_cozumtarihi").getValue() != null) {
        var CozumTrh    = FormatDate("new_cozumtarihi");
        }
        if (Xrm.Page.data.entity.attributes.get("new_servistalebitarihi").getValue() != null) {
        var SerTalTrh   = FormatDate("new_servistalebitarihi");
        }
        var SerAdrs     = Xrm.Page.data.entity.attributes.get("new_servisadresi").getValue();
        var Oncelik     = Xrm.Page.data.entity.attributes.get("prioritycode").getValue();
        var SemtIlce    = Xrm.Page.data.entity.attributes.get("new_semt_ilce").getValue();
        if (Xrm.Page.data.entity.attributes.get("new_sehir").getValue() != null) {
        var SehirId     = Xrm.Page.data.entity.attributes.get("new_sehir").getValue()[0].id; 
        var SehirName   = Xrm.Page.data.entity.attributes.get("new_sehir").getValue()[0].name;
        }
        var TespitSnc   = Xrm.Page.data.entity.attributes.get("new_tespitsonucu").getValue();
        var HataKay     = Xrm.Page.data.entity.attributes.get("new_mhhatakaynagi").getValue();
        var HataAdi     = Xrm.Page.data.entity.attributes.get("new_hatasebebi").getValue();
        var HataliBrm   = Xrm.Page.data.entity.attributes.get("new_hatalibirim").getValue();
        var YplnHata    = Xrm.Page.data.entity.attributes.get("new_hataadi").getValue();
        var MHTop       = Xrm.Page.data.entity.attributes.get("new_mhtoplanti").getValue();
        var KapanisNdn  = Xrm.Page.data.entity.attributes.get("new_kapansnedeni").getValue();
        if (Xrm.Page.data.entity.attributes.get("new_kapanistarihi").getValue() != null) {
        var KapanisTrh  = FormatDate("new_kapanistarihi");
        }
        if (Xrm.Page.data.entity.attributes.get("new_satissor").getValue() != null) {
        var SatSorId      = Xrm.Page.data.entity.attributes.get("new_satissor").getValue()[0].id;
        var SatSorName    = Xrm.Page.data.entity.attributes.get("new_satissor").getValue()[0].name;
        }
        var Uygunsuzluk = Xrm.Page.data.entity.attributes.get("new_uygunsuzlukmaliyeti").getValue();
        if (Xrm.Page.data.entity.attributes.get("new_departman").getValue() != null) {
        var DepartmanId   = Xrm.Page.data.entity.attributes.get("new_departman").getValue()[0].id;
        var DepartmanName = Xrm.Page.data.entity.attributes.get("new_departman").getValue()[0].name;
        }
        var SerTalKay   = Xrm.Page.data.entity.attributes.get("caseorigincode").getValue();
        var SatFyt      = Xrm.Page.data.entity.attributes.get("new_satisfiyati2").getValue();
        if (Xrm.Page.data.entity.attributes.get("new_teslimattarihi").getValue() != null) {
        var TeslimatTrh = FormatDate("new_teslimattarihi");
        }
        if (Xrm.Page.data.entity.attributes.get("new_anketiyapan").getValue() != null) {
        var AnketiYapanId = Xrm.Page.data.entity.attributes.get("new_anketiyapan").getValue()[0].id;
        var AnketiYapanName = Xrm.Page.data.entity.attributes.get("new_anketiyapan").getValue()[0].name;
        }
        var AnketSonucu = Xrm.Page.data.entity.attributes.get("customersatisfactioncode").getValue();
        var MusteriGors = Xrm.Page.data.entity.attributes.get("new_musterigorusleri").getValue();
        var tekraronl   = Xrm.Page.data.entity.attributes.get("new_tekraronleme").getValue();
        var Aciklama    = Xrm.Page.data.entity.attributes.get("description").getValue();
        //define default values for new Incident record
        var parameters  = {};
    
        if (CustomerId != null && CustomerName != null) {
            parameters["customerid"] = CustomerId;
            parameters["customeridname"] = CustomerName;
            parameters["customeridtype"] = CustomerType;
        }
        if (MatNumbId != null && MatNumbName != null) {
            parameters["new_malzeme"] = MatNumbId;
            parameters["new_malzemename"] = MatNumbName;
        }
       if (SatBurId != null && SatBurName != null) {
            parameters["new_satisburosu"] = SatBurId;
            parameters["new_satisburosuname"] = SatBurName;
        }
        if (Talep != null) {
            parameters["new_talep"] = Talep;
        }
        if (ilgiliKisi != null) {
            parameters["new_ilgilikisi"] = ilgiliKisi;
        }
        if (UrunAdi != null) {
            parameters["new_urunadi"] = UrunAdi;
        }
        if (Zamanlama != null) {
            parameters["new_zamanlama"] = Zamanlama;
        }
        if (Email != null) {
            parameters["new_mail"] = Email;
        }
        if (SiparisId != null &&  SiparisName != null) {
            parameters["new_siparis"] = SiparisId;
            parameters["new_siparisname"] = SiparisName;
        }
        if (Adet != null) {
            parameters["new_adet"] = Adet;
        }
        if (Durumu != null) {
            parameters["incidentstagecode"] = Durumu;
        }
        if (telefon != null) {
            parameters["new_telefon"] = telefon;
        }
        if (SrvOzt != null) {
            parameters["title"] = SrvOzt;
        }
        if (MHyetkilisiId != null && MHyetkilisiName != null) {
            parameters["new_mhyetkilisi"] = MHyetkilisiId;
            parameters["new_mhyetkilisiname"] = MHyetkilisiName;
        }
        if (islemBelgNo != null) {
            parameters["new_islembelgeno"] = islemBelgNo;
        }
        if (FabGelTrh != null) {
            parameters["new_sikayetinfabrikayagelistarihi"] = FabGelTrh;
        }
        if (Garanti != null) {
            parameters["new_garanti"] = Garanti;
        }
        if (UrCksTrh != null) {
            parameters["new_uretimdencikistarihi"] = UrCksTrh;
        }
        if (SerTalTuru != null) {
            parameters["casetypecode"] = SerTalTuru;
        }
        if (Sevkiyat != null) {
            parameters["new_sevkiyatsekli"] = Sevkiyat;
        }
        if (CozumTrh != null) {
            parameters["new_cozumtarihi"] = CozumTrh;
        }
        if (SerTalTrh != null) {
            parameters["new_servistalebitarihi"] = SerTalTrh;
        }
        if (SerAdrs != null) {
            parameters["new_servisadresi"] = SerAdrs;
        }
        if (Oncelik != null) {
            parameters["prioritycode"] = Oncelik;
        }
        if (SemtIlce != null) {
            parameters["new_semt_ilce"] = SemtIlce;
        }
        if (SehirId != null && SehirName != null) {
            parameters["new_sehir"] = SehirId;
            parameters["new_sehirname"] = SehirName;
        }
        if (TespitSnc != null) {
            parameters["new_tespitsonucu"] = TespitSnc;
        }
        if (HataKay != null) {
            parameters["new_mhhatakaynagi"] = HataKay;
        }
        if (HataAdi != null) {
            parameters["new_hatasebebi"] = HataAdi;
        }
        if (HataliBrm != null) {
            parameters["new_hatalibirim"] = HataliBrm;
        }
        if (YplnHata != null) {
            parameters["new_hataadi"] = YplnHata;
        }
        if (MHTop != null) {
            parameters["new_mhtoplanti"] = MHTop;
        }
        if (KapanisNdn != null) {
            parameters["new_kapansnedeni"] = KapanisNdn;
        }
        if (KapanisTrh != null) {
            parameters["new_kapanistarihi"] = KapanisTrh;
        }
        if (SatSorId != null && SatSorName != null) {
            parameters["new_satissor"] = SatSorId;
            parameters["new_satissorname"] = SatSorName;
        }
        if (Uygunsuzluk != null) {
            parameters["new_uygunsuzlukmaliyeti"] = Uygunsuzluk;
        }
        if (DepartmanId != null && DepartmanName != null) {
            parameters["new_departman"] = DepartmanId;
            parameters["new_departmanname"] = DepartmanName;
        }
        if (SatFyt != null) {
            parameters["new_satisfiyati2"] = SatFyt;
        }
        if (SerTalKay != null) {
            parameters["caseorigincode"] = SerTalKay;
        }
    
        if (TeslimatTrh != null) {
            parameters["new_teslimattarihi"] = TeslimatTrh;
        }
        if (AnketiYapanId != null && AnketiYapanName != null) {
            parameters["new_anketiyapan"] = AnketiYapanId;
            parameters["new_anketiyapanname"] = AnketiYapanName;
        }
        if (AnketSonucu != null) {
            parameters["customersatisfactioncode"] = AnketSonucu;
        }
        if (MusteriGors != null) {
            parameters["new_musterigorusleri"] = MusteriGors;
        }
        if (tekraronl != null) {
            parameters["new_tekraronleme"] = tekraronl;
        }
        if (Aciklama != null) {
            parameters["description"] = Aciklama;
        }
        //pop incident form with default values
        Xrm.Utility.openEntityForm("incident", null, parameters);
    }
    
    function FormatDate(fieldname) {
        var date = Xrm.Page.data.entity.attributes.get(fieldname).getValue();
        if (date != null) {
            var curr_date = date.getDate();
            var curr_month = date.getMonth();
            curr_month++;  // getMonth() considers Jan month 0, need to add 1
            var curr_year = date.getFullYear();
            return curr_month + "/" + curr_date + "/" + curr_year;
        }
        else return null;
    }

    Am i missing something ?

    Thanks.


    • Edited by Eldanar Tuesday, July 21, 2015 8:41 AM
    Tuesday, July 21, 2015 8:40 AM