MSCRMGEEK
asked on
ms crm 2011 - Why javascript Code for clonning the entity form is giving error?
Hi All,
ms crm 2011 - Why javascript Code for clonning the entity form is giving error?
following url is getting executed, when the url is given internet explorer.
http://<server>/<org>/main.aspx?e tc=10019&e xtraqs=%3f _CreateFro mId%3d%257 b83D303DE- 6B03-E111- 9EE0-00155 D031A24%25 7d%26_Crea teFromType %3d10019%2 6etc%3d100 19&pagetyp e=entityre cord
But when I am calling the following javascript function in the ribbon button of the Entity Form(Record), it is giving error.
if (typeof (HP) == "undefined") {
HP = { __namespace: true };
if (typeof (HP.Sample) == "undefined") {
HP.Sample = { _namespace: true }
}
}
HP.Sample.CLONE = {
cloneRecord: function () {
var serverUrl;
var errorMessage = "Context to retrieve the Server URL is not available.";
if (typeof GetGlobalContext != "undefined") {
serverUrl = GetGlobalContext().getServ erUrl();
}
else {
if (typeof Xrm != "undefined") {
serverUrl = Xrm.Page.context.getServer Url();
}
else {
alert(errorMessage);
return;
}
}
if (serverUrl.match(/\/$/)) {
serverUrl = serverUrl.substring(0, serverUrl.length - 1);
}
var features = "location=no,menubar=no,st atus=no,to olbar=no";
var recordUrl = serverUrl + "/main.aspx?";
var params = "etc=" + Xrm.Page.context.getQueryS tringParam eters().et c + "";
params += "&pagetype=entityrecord";
params += "&extraqs=";
var extraqs = "?_CreateFromId=%" + Xrm.Page.data.entity.getId () + "%";
extraqs += "&_CreateFromType=" + Xrm.Page.context.getQueryS tringParam eters().et c;
extraqs += "&etc=" + Xrm.Page.context.getQueryS tringParam eters().et c;
var newQuestionaireURL = recordUrl + params;
window.open(newQuestionair eURL, encodeURIComponent(extraqs ), "_blank", features, false);
},
_namespace: true
};
Can any one help me on this for rectifying the error.
Thanks,
Rajeev.
ms crm 2011 - Why javascript Code for clonning the entity form is giving error?
following url is getting executed, when the url is given internet explorer.
http://<server>/<org>/main.aspx?e
But when I am calling the following javascript function in the ribbon button of the Entity Form(Record), it is giving error.
if (typeof (HP) == "undefined") {
HP = { __namespace: true };
if (typeof (HP.Sample) == "undefined") {
HP.Sample = { _namespace: true }
}
}
HP.Sample.CLONE = {
cloneRecord: function () {
var serverUrl;
var errorMessage = "Context to retrieve the Server URL is not available.";
if (typeof GetGlobalContext != "undefined") {
serverUrl = GetGlobalContext().getServ
}
else {
if (typeof Xrm != "undefined") {
serverUrl = Xrm.Page.context.getServer
}
else {
alert(errorMessage);
return;
}
}
if (serverUrl.match(/\/$/)) {
serverUrl = serverUrl.substring(0, serverUrl.length - 1);
}
var features = "location=no,menubar=no,st
var recordUrl = serverUrl + "/main.aspx?";
var params = "etc=" + Xrm.Page.context.getQueryS
params += "&pagetype=entityrecord";
params += "&extraqs=";
var extraqs = "?_CreateFromId=%" + Xrm.Page.data.entity.getId
extraqs += "&_CreateFromType=" + Xrm.Page.context.getQueryS
extraqs += "&etc=" + Xrm.Page.context.getQueryS
var newQuestionaireURL = recordUrl + params;
window.open(newQuestionair
},
_namespace: true
};
Can any one help me on this for rectifying the error.
Thanks,
Rajeev.
ASKER
When I am clicking on "View the data that will be sent to Microsoft", I am getting the following error:-
Microsoft Dynamics CRM Error Report Contents
<CrmScriptErrorReport>
<ReportVersion>1.0</Report Version>
<ScriptErrorDetails>
<Message>Invalid argument.</Message>
<Line>352371890</Line>
<URL>/userdefined/edit.asp x?_gridTyp e=10037&et c=10037&id =%7bBD6AB6 CE-EF65-E2 11-9E4E-08 002738A110 %7d&pagemo de=iframe& preloadcac he=1360646 494936&rsk ey=2417905 58</URL>
<PageURL>/userdefined/edit .aspx?_gri dType=1003 7&etc=1003 7&id=%7bBD 6AB6CE-EF6 5-E211-9E4 E-08002738 A110%7d&pa gemode=ifr ame&preloa dcache=136 0646494936 &rskey=241 790558</Pa geURL>
<Function>anonymous(){vars erverUrl;v arerrorMes sage="Cont exttoretri evetheServ erURLisnot available. ";if(typeo fGetGlobal Context!=" undefined" ){serverUr l=GetGloba lContext() .getServer Url();}els e{if(typeo fXrm!="und efined"){s erverUrl=X rm.Page.co ntext.getS erverUrl() ;}else{al< /Function>
<CallStack>
<Function>anonymous(){vars erverUrl;v arerrorMes sage="Cont exttoretri evetheServ erURLisnot available. ";if(typeo fGetGlobal Context!=" undefined" ){serverUr l=GetGloba lContext() .getServer Url();}els e{if(typeo fXrm!="und efined"){s erverUrl=X rm.Page.co ntext.getS erverUrl() ;}else{ale rt(errorMe ssage);ret urn;}}if(s erverUrl.m atch(/\/$/ )){serverU rl=serverU rl.substri ng(0,serve rUrl.lengt h-1);}varf eatures="l ocation=no ,menubar=n o,status=n o,toolbar= no";varrec ordUrl=ser verUrl+"/m ain.aspx?" ;varparams ="etc="+Xr m.Page.con text.getQu eryStringP arameters( ).etc+"";p arams+="&p agetype=en tityrecord ";params+= "&extraqs= ";varextra qs="?_Crea teFromId=% "+Xrm.Page .data.enti ty.getId() +"%";extra qs+="&_Cre ateFromTyp e="+Xrm.Pa ge.context .getQueryS tringParam eters().et c;extraqs+ ="&etc="+X rm.Page.co ntext.getQ ueryString Parameters ().etc;var newQuestio naireURL=r ecordUrl+p arams;aler t(newQuest ionaireURL +encodeURI Component( extraqs)); window.ope n(newQuest ionaireURL ,encodeURI Component( extraqs)," _blank",fe atures,fal se);}</Fun ction>
<Function>anonymous($p0,$p 1,$p2,$p3) {Mscrm.Crm Header.set ScriptFile (Mscrm.Crm Uri.create ($p1),true );for(var$ v_0=window ,$v_1=$p0. split(".") ,$v_2=0;$v _2<$v_1.le ngth;$v_2+ +)if($v_0) $v_0=$v_0[ $v_1[$v_2] ];if(!IsNu ll($v_0)&& typeof$v_0 ===Mscrm.T ypeNames.f unctionTyp e){var$v_3 =this.$Ds_ 1($p2,$p3) ;return$v_ 0.apply(nu ll,$v_3)}r eturnnull} </Function >
<Function>anonymous($p0,$p 1,$p2,$p3) {var$v_0=t his.getCom mandDefini tion($p0,$ p1);if(IsN ull($v_0)| |IsNull($v _0.Actions ))returnfa lse;for(va r$v_1=0;$v _1<$v_0.Ac tions.leng th;$v_1++) {var$v_2=$ v_0.Action s[$v_1];sw itch($v_2. ActionType ){case2:th is.$Ek_1($ v_2.Attrib utes);brea k;case3:va r$v_3=$v_2 .Attribute s;this.$BV _1($v_3.Fu nctionName ,$v_3.Libr ary,$v_2.P arameters, $p2);break ;case1:thi s.$El_1($v _2.Attribu tes,$v_2.P arameters) ;break}}re turntrue}< /Function>
<Function>anonymous($p0,$p 1,$p2){var $v_0=this. parseComma ndFromRibb on($p0),$v _1=this.$8 B_1($v_0.c ommand,$v_ 0.entityLo gicalName, $p1,$p2),$ v_2=$p1;if (!IsNull($ v_2)&&!isN ullOrEmpty String($v_ 2.Populati onXML)&&!$ v_2.Suppre ssCommandI ncludes){v ar$v_3=nul l;if($v_0. entityCont ext==="For m"){var$v_ 4=$find("c rmFormSele ctor");if( $v_4)$v_3= $v_4.get_c urrentForm Id()}$v_2. Population XML=this.$ GD_1($v_2. Population XML,$v_0.e ntityLogic alName,$v_ 3)}return$ v_1}</Func tion>
</CallStack>
</ScriptErrorDetails>
<ClientInformation>
<BrowserUserAgent>Mozilla/ 4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)</BrowserUserAgen t>
<BrowserLanguage>en-us</Br owserLangu age>
<SystemLanguage>en-us</Sys temLanguag e>
<UserLanguage>en-us</UserL anguage>
<ScreenResolution>1600x796 </ScreenRe solution>
<ClientName>Web</ClientNam e>
<ClientTime>2013-02-11T21: 22:25</Cli entTime>
</ClientInformation>
<ServerInformation>
<OrgLanguage>1033</OrgLang uage>
<OrgCulture>1033</OrgCultu re>
<UserLanguage>1033</UserLa nguage>
<UserCulture>1033</UserCul ture>
<OrgID>{CE4C6C42-9A5F-E211 -97C7-0800 2738A110}< /OrgID>
<UserID>{07E03D59-9A5F-E21 1-97C7-080 02738A110} </UserID>
<CRMVersion>5.0.9690.2243< /CRMVersio n>
</ServerInformation>
</CrmScriptErrorReport>
Thanks,
Microsoft Dynamics CRM Error Report Contents
<CrmScriptErrorReport>
<ReportVersion>1.0</Report
<ScriptErrorDetails>
<Message>Invalid argument.</Message>
<Line>352371890</Line>
<URL>/userdefined/edit.asp
<PageURL>/userdefined/edit
<Function>anonymous(){vars
<CallStack>
<Function>anonymous(){vars
<Function>anonymous($p0,$p
<Function>anonymous($p0,$p
<Function>anonymous($p0,$p
</CallStack>
</ScriptErrorDetails>
<ClientInformation>
<BrowserUserAgent>Mozilla/
<BrowserLanguage>en-us</Br
<SystemLanguage>en-us</Sys
<UserLanguage>en-us</UserL
<ScreenResolution>1600x796
<ClientName>Web</ClientNam
<ClientTime>2013-02-11T21:
</ClientInformation>
<ServerInformation>
<OrgLanguage>1033</OrgLang
<OrgCulture>1033</OrgCultu
<UserLanguage>1033</UserLa
<UserCulture>1033</UserCul
<OrgID>{CE4C6C42-9A5F-E211
<UserID>{07E03D59-9A5F-E21
<CRMVersion>5.0.9690.2243<
</ServerInformation>
</CrmScriptErrorReport>
Thanks,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What error you are getting?
Regards,
Chinmay.