Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

Quote State (Statecode and statuscode) change through a JavaScript. Uncaught ReferenceError: SDK is not defined

$
0
0

Hi,

I am trying to change state of a Quote from Active to Won using the approach in this link

http://sumedha8.blogspot.com/2011/11/state-statecode-and-statuscode-change.html?showComment=1367270200170#c1865308125016979359

I get the following error message when I call this functionality like 

var QuoteId = Xrm.Page.data.entity.getId();
SetStateRequest("quote",QuoteId, 2, 4);
window.location.reload(true); 

Microsoft Dynamics CRM Error Report Contents<CrmScriptErrorReport><ReportVersion>1.0</ReportVersion><ScriptErrorDetails><Message>Uncaught ReferenceError: SDK is not defined</Message><Line>218</Line><URL>/userdefined/edit.aspx?_gridType=1084&etc=1084&id=%7b9AFA96EF-D7AE-E211-8BD4-78E3B5105EFD%7d&pagemode=iframe&preloadcache=1367271475388&rskey=128101723</URL><PageURL>/userdefined/edit.aspx?_gridType=1084&etc=1084&id=%7b9AFA96EF-D7AE-E211-8BD4-78E3B5105EFD%7d&pagemode=iframe&preloadcache=1367271475388&rskey=128101723</PageURL><Function>anonymous(_entityname,entityid,_state,_status){varrequestMain=""requestMain+="<s:Envelopexmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">";requestMain+="<s:Body>";requestMain+="<Executexmlns=\"http://schemas.microsoft.com/xrm/2011/Contracts/Services</Function><CallStack><Function>anonymous(_entityname,entityid,_state,_status){varrequestMain=""requestMain+="<s:Envelopexmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">";requestMain+="<s:Body>";requestMain+="<Executexmlns=\"http://schemas.microsoft.com/xrm/2011/Contracts/Services\"xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">";requestMain+="<requesti:type=\"b:SetStateRequest\"xmlns:a=\"http://schemas.microsoft.com/xrm/2011/Contracts\"xmlns:b=\"http://schemas.microsoft.com/crm/2011/Contracts\">";requestMain+="<a:Parametersxmlns:c=\"http://schemas.datacontract.org/2004/07/System.Collections.Generic\">";requestMain+="<a:KeyValuePairOfstringanyType>";requestMain+="<c:key>EntityMoniker</c:key>";requestMain+="<c:valuei:type=\"a:EntityReference\">";requestMain+="<a:Id>"+entityid+"</a:Id>";requestMain+="<a:LogicalName>"+_entityname+"</a:LogicalName>";requestMain+="<a:Namei:nil=\"true\"/>";requestMain+="</c:value>";requestMain+="</a:KeyValuePairOfstringanyType>";requestMain+="<a:KeyValuePairOfstringanyType>";requestMain+="<c:key>State</c:key>";requestMain+="<c:valuei:type=\"a:OptionSetValue\">";requestMain+="<a:Value>"+_state+"</a:Value>";requestMain+="</c:value>";requestMain+="</a:KeyValuePairOfstringanyType>";requestMain+="<a:KeyValuePairOfstringanyType>";requestMain+="<c:key>Status</c:key>";requestMain+="<c:valuei:type=\"a:OptionSetValue\">";requestMain+="<a:Value>"+_status+"</a:Value>";requestMain+="</c:value>";requestMain+="</a:KeyValuePairOfstringanyType>";requestMain+="</a:Parameters>";requestMain+="<a:RequestIdi:nil=\"true\"/>";requestMain+="<a:RequestName>SetState</a:RequestName>";requestMain+="</request>";requestMain+="</Execute>";requestMain+="</s:Body>";requestMain+="</s:Envelope>";varreq=newXMLHttpRequest();req.open("POST",_getServerUrl(),false)//ResponseswillreturnXML.Itisn'tpossibletoreturnJSON.req.setRequestHeader("Accept","application/xml,text/xml,*/*");req.setRequestHeader("Content-Type","text/xml;charset=utf-8");req.setRequestHeader("SOAPAction","http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Execute");varsuccessCallback=null;varerrorCallback=null;req.onreadystatechange=function(){SetStateResponse(req,successCallback,errorCallback);};req.send(requestMain);}</Function><Function>LaunchDialog(QuoteID)</Function><Function>anonymous($p0,$p1,$p2,$p3){Mscrm.CrmHeader.setScriptFile(Mscrm.CrmUri.create($p1),true);for(var$v_0=window,$v_1=$p0.split("."),$v_2=0;$v_2<$v_1.length;$v_2++)if($v_0)$v_0=$v_0[$v_1[$v_2]];if(!IsNull($v_0)&&typeof$v_0===Mscrm.TypeNames.functionType){var$v_3=this.$CN_1($p2,$p3);return$v_0.apply(null,$v_3)}returnnull}</Function><Function>anonymous($p0,$p1,$p2,$p3){var$v_0=this.getCommandDefinition($p0,$p1);if(IsNull($v_0)||IsNull($v_0.Actions))returnfalse;for(var$v_1=0;$v_1<$v_0.Actions.length;$v_1++){var$v_2=$v_0.Actions[$v_1];switch($v_2.ActionType){case2:this.$DF_1($v_2.Attributes);break;case3:var$v_3=$v_2.Attributes;this.$9w_1($v_3.FunctionName,$v_3.Library,$v_2.Parameters,$p2);break;case1:this.$DG_1($v_2.Attributes,$v_2.Parameters);break}}returntrue}</Function><Function>anonymous($p0,$p1,$p2){var$v_0=this.parseCommandFromRibbon($p0),$v_1=this.$7s_1($v_0.command,$v_0.entityLogicalName,$p1,$p2),$v_2=$p1;if(!IsNull($v_2)&&!isNullOrEmptyString($v_2.PopulationXML)&&!$v_2.SuppressCommandIncludes){var$v_3=null;if($v_0.entityContext==="Form"){var$v_4=$find("crmFormSelector");if($v_4)$v_3=$v_4.get_currentFormId()}$v_2.PopulationXML=this.$Ep_1($v_2.PopulationXML,$v_0.entityLogicalName,$v_3)}return$v_1}</Function><Function>anonymous($p0,$p1,$p2){if(this.$1w_1&&!this.$1w_1.$3k_1)returnthis.$1w_1.handleCommand($p0,$p1,$p2);returnfalse}</Function><Function>anonymous(handler,commandId,properties,sequenceNumber){returnhandler.handleCommand(commandId,properties,sequenceNumber)}</Function><Function>anonymous($p0,$p1,$p2){var$v_0=this.$2R_0[$p0];if(CUI.ScriptUtility.isNullOrUndefined($v_0))returnfalse;elseif(Array.isInstanceOfType($v_0)){for(var$v_1=$v_0,$v_2=false,$v_3=0;$v_3<$v_1.length;$v_3++){var$v_4=$v_1[$v_3];if(this.callCommandHandler($v_4,$p0,$p1,$p2))$v_2=true}return$v_2}elsereturnthis.callCommandHandler($v_0,$p0,$p1,$p2)}</Function><Function>anonymous(commandId,properties){returnthis.$DE_0(commandId,properties,this.getNextSequenceNumber())}</Function><Function>anonymous(commandId,properties,commandInfo,root){returnthis.$10_1.executeCommand(commandId,properties)}</Function><Function>anonymous($p0){if(CUI.ScriptUtility.isNullOrUndefined($p0.$4_1))return;$p0.$7Q_1=this.$DU_1();var$v_0=$p0.get_commandInfo();$v_0.CommandId=$p0.$4_1;$v_0.RootId=this.$4_0;$v_0.RootType=this.get_rootType();!CUI.ScriptUtility.isNullOrUndefined(this.$26_1)&&this.$26_1.executeRootCommand($p0.$4_1,$p0.$32_1,$v_0,this)}</Function><Function>anonymous($p0){this.$7s_1($p0);returntrue}</Function><Function>anonymous($p0){if($p0.$I_1!==11){$p0.get_commandInfo().RootLocation=$p0.$I_1===2?"UpperRibbon":"LowerRibbon";if($p0.$I_1===2){var$v_0=$p0.$32_1;$p0.get_commandInfo().TabId=$v_0.NewContextId}}returnCUI.Root.prototype.$2n_0.call(this,$p0)}</Function><Function>anonymous($p0){this.$2n_0($p0)&&!CUI.ScriptUtility.isNullOrUndefined(this.$M_0)&&this.$M_0.$Ay_0($p0);this.$Am_0($p0)}</Function><Function>anonymous($p0){this.$2n_0($p0)&&!CUI.ScriptUtility.isNullOrUndefined(this.$M_0)&&this.$M_0.$Ay_0($p0);this.$Am_0($p0)}</Function><Function>anonymous($p0){this.$2n_0($p0)&&!CUI.ScriptUtility.isNullOrUndefined(this.$M_0)&&this.$M_0.$Ay_0($p0);this.$Am_0($p0)}</Function><Function>anonymous($p0){this.$2n_0($p0)&&!CUI.ScriptUtility.isNullOrUndefined(this.$M_0)&&this.$M_0.$Ay_0($p0);this.$Am_0($p0)}</Function><Function>anonymous($p0){this.$2n_0($p0)&&!CUI.ScriptUtility.isNullOrUndefined(this.$M_0)&&this.$M_0.$Ay_0($p0);this.$Am_0($p0)}</Function><Function>anonymous($p0){this.$2n_0($p0)&&!CUI.ScriptUtility.isNullOrUndefined(this.$M_0)&&this.$M_0.$Ay_0($p0);this.$Am_0($p0)}</Function><Function>anonymous($p0){this.$2n_0($p0)&&!CUI.ScriptUtility.isNullOrUndefined(this.$M_0)&&this.$M_0.$Ay_0($p0);this.$Am_0($p0)}</Function></CallStack></ScriptErrorDetails><ClientInformation><BrowserUserAgent>Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31</BrowserUserAgent><BrowserLanguage>undefined</BrowserLanguage><SystemLanguage>undefined</SystemLanguage><UserLanguage>undefined</UserLanguage><ScreenResolution>1920x1080</ScreenResolution><ClientName>Web</ClientName><ClientTime>2013-04-29T14:38:00</ClientTime></ClientInformation><ServerInformation><OrgLanguage>1033</OrgLanguage><OrgCulture>1033</OrgCulture><UserLanguage>1033</UserLanguage><UserCulture>1033</UserCulture><OrgID>{06156408-5436-4116-B9C4-97CD63712DAA}</OrgID><UserID>{EA51D295-C04E-491A-B400-DB9E3D58BB18}</UserID><CRMVersion>5.0.9690.3358</CRMVersion></ServerInformation></CrmScriptErrorReport>



Viewing all articles
Browse latest Browse all 8223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>