Quantcast
Channel: CRM Development forum
Viewing all 465 articles
Browse latest View live

Dynamics CRM 2013 link to Google Analytics tool

$
0
0

Hi All;

I have added the Google Analytics code in the Dashbord of CRM as webresource

The code is as below

<html><head><script type="text/javascript" >

 


  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'AA-0000000-0', 'dynamics.com');
  ga('send', 'pageview');

</script></head><body></body></html>

But this code gets reflected(can be seen) when the actual dashboard gets loaded 

as below

Does anyone knows the reason why?

Any help much appreciated

Thanks


Pradnya07


context.InputParameters["Target"] doesn't have updated values - CRM 2013

$
0
0

I'm working on a plugin that was originally written for CRM 2011, but the CRM has now been updated to 2013. It's CRM online, so I'm just putting in logging to see what's going on.

I've discovered that the context.InputParameters["Target"] doesn't have updated values. I thought that the target held any updated values? There's only a preimage registered, but I thought that as long as I'm dealing with the target, that I'd have the updated values? I can see that the fields that have just been updated are in the target, but it has the old values.

Here is the code:

public void Execute(IServiceProvider serviceProvider) { ITracingService tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService)); //tracingService.Trace("Entering OrderVal.Execute"); try { // Obtain the execution context from the service provider. Microsoft.Xrm.Sdk.IPluginExecutionContext context = (Microsoft.Xrm.Sdk.IPluginExecutionContext) serviceProvider.GetService(typeof(Microsoft.Xrm.Sdk.IPluginExecutionContext)); IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory)); IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId); Validation val = new Validation(service, context)

//This is the line that I'm wondering about Entity entity = (Entity)context.InputParameters["Target"]; PrintOutAttributesTest(entity, serviceProvider); Entity EntityImage = (Entity)context.PreEntityImages["EntityImage"]; Guid enquiryid = ((Guid)EntityImage.Attributes["new_enquiryid"]); if (enquiryid != Guid.Empty) { string messages = val.GetErrors(enquiryid, serviceProvider); if (messages != string.Empty) { messages = "The following were found. " + messages; throw new InvalidPluginExecutionException(messages); } } } catch (InvalidPluginExecutionException invalidEx) { throw invalidEx; } catch (Exception ex) { throw new Exception("Exception in execute of Order Errors " + ex.Message, ex); } } protected internal void PrintOutAttributesTest(Entity entity, IServiceProvider serviceProvider) { ITracingService tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService)); foreach (var attrib in entity.Attributes) { tracingService.Trace("Attribute key: " + attrib.Key + ", Attribute value: " + attrib.Value.ToString()); } }

Thanks.


Xrm.Utility.confirmDialog bug or feature ?

$
0
0

In SDK 2013 and online there’s a note regarding usage of blocking modal windows and mobile devices:

   "If you use window.alert in your form scripts the message you set will automatically be displayed using Xrm.Utility.alertDialog without a callback function specified, but this is temporary and    

     is already considered deprecated. You should move any code using window.alert to use Xrm.Utility.alertDialog instead".

I moved my SDK xrmForm.Confirm utility which underneath used window.confirm to Xrm.Utility.confirmDialog to support none blocking devices only to find that the confirmDialog does not return a value (true or false) when browsed from a web application. The confirmDialog does use a regular blocking confirm but the function does not return anything (see first Confirm method in my code sample) . This forced me to check if the client is a mobile device myself and use window.confirm if it’s not.  (see second confirm method in my code sample)

Using the second Confirm method is in contrast to MS statement, So the question is: Do we need to test for mobile ourselves or should we expect the function to do that for us (BUG)?

function XrmForm() {
    var xfrm = this;
    //First Confirm returns undefined
    xfrm.Confirm (message, onOk , onCancel) {
        return Xrm.Utility.confirmDialog(message,onOk, onCancel);
    }

    //Second Confirm
    xfrm.Confirm (message, onOk, onCancel) {
        var result;
        if (xfrm.IsMobile())
            Xrm.Utility.confirmDialog(message,onOk, onCancel);
        else
            result = window.confirm(message);
        return result;
    }
    
    xfrm.IsMobile = function() {
        return context.client.getClient() === "Mobile";
    }
}

Cheers,

Adi


Dynamics CRM - Thinking outside the Box

CRM 2013 SP1: Custom Action - New bug introduced

$
0
0

Hi,

I was using following SOAP XML to invoke my custom action in CRM 2013. The custom action does not accept any input parameter. However, to invoke a custom action from JavaScript, you have to have a Target parameter passed in, else the action invocation used to fail.

function ExecuteAction(actionName)
{
	// Creating the request XML for calling the Action
		requestXML += "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">";
		requestXML += "  <s:Body>";
		requestXML += "    <Execute xmlns=\"http://schemas.microsoft.com/xrm/2011/Contracts/Services\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">";
		requestXML += "      <request xmlns:a=\"http://schemas.microsoft.com/xrm/2011/Contracts\">";
		requestXML += "        <a:Parameters xmlns:b=\"http://schemas.datacontract.org/2004/07/System.Collections.Generic\">";
		requestXML += "          <a:KeyValuePairOfstringanyType>";
		requestXML += "            <b:key>Target</b:key>";
		requestXML += "            <b:value i:type=\"a:EntityReference\">";
		requestXML += "              <a:Id>" + Xrm.Page.data.entity.getId() + "</a:Id>";
		requestXML += "              <a:LogicalName>" + Xrm.Page.data.entity.getEntityName() + "</a:LogicalName>";
		requestXML += "              <a:Name i:nil=\"true\" />";
		requestXML += "            </b:value>";
		requestXML += "          </a:KeyValuePairOfstringanyType>";
		requestXML += "        </a:Parameters>";
		requestXML += "        <a:RequestId i:nil=\"true\" />";
		requestXML += "        <a:RequestName>" + actionName + "</a:RequestName>";
		requestXML += "      </request>";
		requestXML += "    </Execute>";
		requestXML += "  </s:Body>";
		requestXML += "</s:Envelope>";

	var req = new XMLHttpRequest();
	req.open("POST", GetServiceUrl(), false)
	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");
	req.send(requestXML);

	//refresh the page if the request was successful.
	if (req.status == 200)
	{
		if (refreshPage)
		{
			RefreshForm()
		}
	}
	else
	{
		Xrm.Utility.alertDialog(req.statusText + "\n" + req.responseXML.getElementsByTagName("faultstring")[0].textContent);
	}
}

Now with SP 1 installed, the same JavaScript throws "Internal Server Error Unrecognized request parameter: Target" error. Why further break what was already broken and throw everybody's workaround out of whack?


XML Validation with XSD fails because of xs:sequence for complexType

$
0
0

Hi,

I have xsd which has complextype elements with xs:sequence to maintain the order of child elements inside the parent element. I am using dataset to read the xsd and read the data from some other text file.

After creating the xml file (by using dataset.GetXml();) i am validating the xml file against the xsd. But validation is getting failed.

I unerstand that if i change xs:sequence to xs:all then validation error will not come. But i want to maintain the order in xml file. and more important is i dont want to do any change in xsd file.

Please help me on this ASAP.

sample XSD data as below :  

<xs:complexType name="testdata"><xs:sequence><xs:element ref="Cur1" minOccurs="0"/><xs:element ref="SecIDSource" minOccurs="1" maxOccurs="1"/><xs:element ref="SecId" minOccurs="1" maxOccurs="1"/><xs:element ref="Symbol" minOccurs="0"/><xs:element ref="SecurityDesc" minOccurs="0"/><xs:element ref="SettlCurrency" minOccurs="0"/><xs:element ref="MaturityMonthYear" minOccurs="0"/><xs:element ref="StrikePrice" minOccurs="0"/><xs:element ref="SecurityExchange" minOccurs="0"/><xs:element ref="ContractMultiplier" minOccurs="0"/></xs:sequence></xs:testdata>

CRM Custom Workflow - System.Security.SecurityException

$
0
0

Hi,

I'm working on a Dynamics CRM 2011 custom workflow to enhance the standard SharePoint integration.

The purpose of the workflow is to create a folder with a more specicif name than the standard account name, also containing the customer number. The workflow will work against SharePoint online.

I have planned to use the SharePoint client libraries: Microsoft.SharePoint.Client, Microsoft.SharePoint.Client.Runtime, and Microsoft.SharePoint.UserProfiles. These DLL-files are included in the package with a ilmerge build event:

COPY $(TargetDir)$(TargetName).dll temp.dll
$(ProjectDir)ILMergeexe\ILMerge.exe /out:$(TargetDir)$(TargetName).dll temp.dll $(TargetDir)Microsoft.SharePoint.Client.dll $(TargetDir)Microsoft.SharePoint.Client.Runtime.dll $(TargetDir)Microsoft.SharePoint.Client.UserProfiles.dll  /keyfile:$(ProjectDir)versjon2.snk /targetplatform:v4,"C:\Windows\Microsoft.NET\Framework\v4.0.30319" /copyattrs 
DEL  $(TargetDir)temp.dll

The SharePoint code is working perfectly when I'm running it from Visual Studio, but it fails when I run it through CRM. The exception i get is a System.Security.SecurityException:

Unhandled Exception: Microsoft.Xrm.Sdk.InvalidPluginExecutionException: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
   at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
   at System.Security.CodeAccessPermission.Demand()
   at System.Net.AuthenticationManager.Register(IAuthenticationModule authenticationModule)
   at Microsoft.SharePoint.Client.SharePointOnlineAuthenticationModule.EnsureRegistered()
   at Microsoft.SharePoint.Client.SharePointOnlineCredentials..ctor(String username, SecureString password)
   at SPOnlineClient.SPFolderHelper.GenerateCredentials(String username, String password)
   at SPOnlineClient.SPFolderHelper..ctor(String siteUrl, String username, String password, String listName)
   at Skill.ITAS.SharePointFolderWF.SharePointFolderWF.CreateSharePointFolder(String folderName)
   at Skill.ITAS.SharePointFolderWF.SharePointFolderWF.HandleCreate(IOrganizationService service, IWorkflowContext context)
The action that failed was:
Demand
The type of the first permission that failed was:
System.Security.Permissions.SecurityPermission
The Zone of the assembly that failed was:
MyComputer

The simple code where it fails is the first place i try to call one of the three Microsoft libraries I'm including. The call is not referring to any external connection, only creating SharePointCredentials:

 private SharePointOnlineCredentials GenerateCredentials(string username, string password)
        {
            var pwd = new System.Security.SecureString();
            foreach (char eachChar in password)
            {
                pwd.AppendChar(eachChar);
            }
            return new SharePointOnlineCredentials(username, pwd);

        }

This makes me think that the error is somehow related to access of these third party libraries. 

I would very much appreciate any help or hints to point me in the direction of a possible solution!

Best Regards,

Trond


Trond


Custom workflow activity - Testing InArgument for null values

$
0
0

Not sure if I'm over thinking or not thinking at all.
The scenario is:

I have a "Not Required" input parameter that accepts an "int".
I tried to make it an InArgument<int?> but it won't register, CRM says it is an unsupported type.

Anyways, the user interface will accpet numeric values and also, an empty field.
The problem is that when the user leave it empty, the the "Get" method will return "0" (because it is not nullable I guess).
In many cases it is enough but for this particular project I need to know the user didn't enter any data.

Looks like InArgument<string> is a good option but then I end up with an UI that says "string" and accepts string when the value should be empty or integer.

Any ideas:

[Input("Some value")]
public InArgument<int> SomeValue { get; set; }

protected override void Execute(CodeActivityContext executionContext)
{

    if (SomeValue.Get(executionContext != null) {
        //always true since I get 0 even when the field is empty
    }

}

Thanks

CRM 2011: PrincipalEntityMap records missing for users created through SDK

$
0
0

We have created a bunch of users in CRM 2011 using the SDK.

Everything seems to work fine, until these users started to create their own User Dashboards.

The users could create their own User Dashboards. However, once they created them, they could not see them. They were not in their list of Dashboards - only the System Dashboards where there.

There were no errors in the event viewer or even the trace logs.

I used SQL Profiler to see what it was doing and I discovered it was checking the PrincipalEntityMap table for principals that had an objecttypecode of 1031 - which is the User Dashboard (called UserForm).

How do these records get created?

I can write a SQL script to populate the database with these missing records. What I would like to know is why they are missing? Any ideas?

For information - the following SQL is what CRM uses to retrieve the list of user dashboards. It is joining on PrincipalEntityMap. Where do the records for PrincipalEntityMap come from?

exec sp_executesql N'select 
top 5001 "userform0".UserFormId as "userformid"
, "userform0".Name as "name"
, "userform0".Description as "description" 
from
 UserFormBase as "userform0" 
where
 (("userform0".Type = @Type0) and ("userform0".OwnerId in (select pem.PrincipalId from PrincipalEntityMap pem join SystemUserPrincipals sup on pem.PrincipalId = sup.PrincipalId where sup.SystemUserId = @UserIdOwnerCommand00 and pem.ObjectTypeCode = @OtcOwnerCommand00)
 or "userform0".UserFormId in (select ObjectId from fn_POARetrieveMultiple(@SystemUserId0, @ObjectTypeCode0)))) order by"userform0".Name asc
, "userform0".UserFormId asc',N'@Type0 int,@UserIdOwnerCommand00 uniqueidentifier,@OtcOwnerCommand00 int,@SystemUserId0 uniqueidentifier,@ObjectTypeCode0 int',@Type0=0,@UserIdOwnerCommand00='16A583B7-4E1D-E411-A0FA-00155D5D3B03',@OtcOwnerCommand00=1031,@SystemUserId0='16A583B7-4E1D-E411-A0FA-00155D5D3B03',@ObjectTypeCode0=1031
I have asked this on SO too - no luck - here is the link 




addCustomView in CRM 2013 lookup

$
0
0

I get an Savedquery With Id = 00000000-0000-0000-0000-000000000000 Does Not Exist message when I set up the custom view to a CRM 2013 Team lookup, whit this code, working in CRM 2011.

// Set the Owning Team View based on the account selected
function setOwningTeamView(entityFieldName, lookupFieldName, resetSelection) {
  // Get the selected entity 
  var account = Xrm.Page.getAttribute(entityFieldName).getValue();

if (account != null) {
    var accid = account[0].id;
    var accname = account[0].name;

    if (resetSelection == true) {
        // reset old selection for Contact
        Xrm.Page.getAttribute(lookupFieldName).setValue(null);
    }

    // use randomly generated GUID Id for the view
    var viewId = "{0CBC820C-7033-4AFF-9CE8-FB610464DBD3}";
    var entityName = "team";

    // give the custom view a name
    var viewDisplayName = "Teams applicable to " + accname + "";

    var accountBU = SDK.REST.retrieveRecordSync(Xrm.Page.getAttribute("a_account").getValue()[0].id, "Account", "OwningBusinessUnit", "");
    var relatedBusinessUnits = SDK.REST.retrieveMultipleRecordsSync("BusinessUnit", "?$select=BusinessUnitId,Name&$filter=a_Type/Value eq 1");
    var FetchXMLBU = "";
    for (var i = 0; i < relatedBusinessUnits.results.length; i++) {
        FetchXMLBU += "<value>" + relatedBusinessUnits.results[i].BusinessUnitId + "</value>"
    }

    debugger;

    // find all contacts where parent customer is the account selected and where the Contact record is active
    var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>"+ "<entity name='team'>"+ "<attribute name='teamid' />"+ "<attribute name='name' />"+ "<attribute name='description' />"+ "<attribute name='businessunitid' />"+ "<filter>"+ "<condition attribute='businessunitid' operator='in'>"+ "<value>" + accountBU.OwningBusinessUnit.Id + "</value>"+ FetchXMLBU+ "</condition>"+ "</filter>"+ "</entity>"+ "</fetch>";

    // build Grid Layout
    var layoutXml = "<grid name='resultset' " +"object='1' " +"jump='teamid' " +"select='1' " +"icon='0' " +"preview='0'>" +"<row name='result' id='teamid'>" +"<cell name='name' width='200' />" +"<cell name='businessunitid' width='200' />" +"<cell name='description' width='400' />" +"</row>" +"</grid>";

    // add the Custom View to the indicated [lookupFieldName] Control
    Xrm.Page.getControl(lookupFieldName).addCustomView(viewId, entityName, viewDisplayName, fetchXml, layoutXml, true);
    //The following line is the an unsupported way of disabling the View Picker, currently there is no supported way.
    document.getElementById(lookupFieldName + "_i").setAttribute("disableViewPicker", "1");
    //document.getElementById(lookupFieldName).setAttribute("disableViewPicker", "1");
}
}

I'm also setting up a Customer lookup view with addCustomView with same code except for the calls to SDK and works well.

This is the fetchXMl generated:

"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'><entity name='team'><attribute name='teamid' /><attribute name='name' /><attribute name='description' /><attribute name='businessunitid' /><filter><condition attribute='businessunitid' operator='in'>

<value>d2f2af7c-9c2e-e411-a53a-00155d5248a4</value><value>cff2af7c-9c2e-e411-a53a-00155d5248a4</value><value>d0f2af7c-9c2e-e411-a53a-00155d5248a4</value></condition></filter></entity></fetch>"


What can I change here to get this working?


CRM 2013: Activity Subgrid to show Account related records

$
0
0

Hello,

On CRM 2013, I'm creating a subgrid on Account form. The requirement is the subgrid will list all Activities for all Contacts under that Account, including the 'Account' itself.

I found this article from Dynamics CRM blog about creating deep queries for subgrid: http://blogs.msdn.com/b/crm/archive/2012/04/16/deep-queries-for-subgrids.aspx

The steps are as follow:

1) I created my custom Activity view that's related to Parent Accounts. I named it "Activities Related to Parent Accounts".

2) I set the subgrid to use this custom Activity view.

3) Exported the solution and modified customization.xml

4) Modified the subgrid to use relationship for parent account. The relationship name is "contact_customer_accounts" (before the <RelationshipName> here is empty.

<control id="AccountActivities" classid="{E7A81278-8635-4d9e-8D4D-59480B391C5B}"><parameters><ViewId>{F1D86D0B-7E34-E411-80D1-005056971AAB}</ViewId><IsUserView>false</IsUserView><RelationshipName>contact_customer_accounts</RelationshipName><TargetEntityType>activitypointer</TargetEntityType><AutoExpand>Fixed</AutoExpand><EnableQuickFind>false</EnableQuickFind><EnableViewPicker>false</EnableViewPicker><ViewIds>{F1D86D0B-7E34-E411-80D1-005056971AAB},{00000000-0000-0000-00AA-000010001902},{00000000-0000-0000-00AA-000010001899}</ViewIds><EnableJumpBar>false</EnableJumpBar><ChartGridMode>Grid</ChartGridMode><VisualizationId>{440505AB-F89B-E211-8B5B-78E3B510FDBD}</VisualizationId><IsUserChart>false</IsUserChart><EnableChartPicker>false</EnableChartPicker><RecordsPerPage>4</RecordsPerPage></parameters></control>

5. Modify the FetchXML under the custom Activity view that I created earlier. This is the FetchXML that I use. I confirmed that that FetchXML return the information as desired.

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"><entity name="activitypointer"><attribute name="activitytypecode" /><attribute name="subject" /><attribute name="statecode" /><attribute name="prioritycode" /><attribute name="modifiedon" /><attribute name="activityid" /><attribute name="instancetypecode" /><attribute name="community" /><order attribute="modifiedon" descending="false" /><filter type="and"><condition attribute="statecode" operator="in"><value>1</value><value>0</value><value>3</value></condition></filter><link-entity name="contact" from="contactid" to="regardingobjectid" alias="aa"><link-entity name="account" from="accountid" to="parentcustomerid" alias="ab"><filter type="and"><condition attribute="accountid" operator="not-null" /></filter></link-entity></link-entity></entity></fetch>

However when I go into the Account form, the subgrid is giving out error "..please contact Dynamic CRM Support etc".

Any suggestion on which steps I might be missing here? Thanks in advance for your help, appreciate it.

-elisabeth


CRM 2013: Refreshing Subgrid that has N:N relationship

$
0
0

In CRM 2013 I have a javascript that adds a N:N relationship between Case and Account via a ribbon function.  So on the click of this button, it will pop up a CRM lookup dialog and then users can add existing Accounts into a Case. When the relationship is created, we have a plugin that will fire on the create of this relationship, and then create a new custom entity record 'CaseAccount'. Everything works fine, the relationship gets added and the record is added successfully.

On the Case form, we have a subgrid that shows all available CaseAccount under that Case. However after clicking the ribbon button to create the relationship, the new CaseAccount record doesn't immediately show up in the subgrid. Users must refresh the Case page in order to show the records in the subgrid.

I tried to put a function to refresh the subgrid using Xrm.Page.data.refresh(). However I notice that the subgrid is refreshing when the CRM lookup dialog is firing. However after clicking 'OK' on the lookup window and the record is finally added, there is no more refreshing. Therefore the new records don't show up on the subgrid?

Any suggestion on how to refresh subgrid completing a lookup dialog?

Below is the code that we have. Credit to Magnetism Solution for portion of the code.

function addLookupDialog(gridTypeCode) {
    var relName = "new_case_account";
    var roleOrd = 2;
    var viewId = "{00000000-0000-0000-0000-000010001002}";

    if (!IsNull(relName)) {
        var customView = {
            fetchXml: "(my fetchxml)",
            id: viewId,
            layoutXml: "(my fetchxml grid)",
            name: "Filtered Lookup View",
            recordType: gridTypeCode,
            Type: 0
        };

        var parent = GetParentObject(null, 0);
        var parameters = [gridTypeCode, "", relName, roleOrd, parent];
        var callbackRef = Mscrm.Utilities.createCallbackFunctionObject("locAssocObjAction", this, parameters, false);

        //pops the lookup window with our view injected
        var lookupItems = LookupObjectsWithCallback(callbackRef, null, "multi", gridTypeCode, 0, null, "", null, null, null, null, null, null, viewId, [customView]);
    }

    if (lookupItems && lookupItems.items.length > 0) {
        //beginning of rollup 12 must make modification
        var parentId;
        var parentTypeCode;
        if (typeof (GetParentObject) == "function") { //post rollup 12 has its own function to get this 
            var parent = GetParentObject();
            parentId = parent.id;
            parentTypeCode = parent.objectTypeCode;
        }
        else { //pre rollup 12 still needs to use the old way 
            var parent = typeof (crmFormSubmit) == "undefined" ? $get("crmFormSubmit") : crmFormSubmit;
            if (parent) {
                parentId = parent.crmFormSubmitId.value;
                parentTypeCode = parent.crmFormSubmitObjectType.value;
            }
            else {
                parentId = window.parent.crmFormSubmit.crmFormSubmitId.value;
                parentTypeCode = window.parent.crmFormSubmit.crmFormSubmitObjectType.value;
            }
        }//end of rollup 12 modification

        AssociateObjects(parentTypeCode, parentId, gridTypeCode, lookupItems, IsNull(roleOrd) || roleOrd == 2, "", relName);
		//refreshing subgrid, but not working yet
		Xrm.Page.data.refresh().then(Xrm.Page.getControl("myGrid").refresh(), alert("Error Refreshing"));
            //}
        }
    }







Pre-filtering in Fetch-based Reports, ms crm 2011

$
0
0

Hi,

I am using Fetch XML in my report and i wanted to implement Pre-Filtering.

I have an entity by name "new_entityone" is linked with an another entity named "new_eventregistration".

I have used the below code and seems like pre filtering is applied for only main entity ie. "new_entityone".

How to enable pre-filtering for both parent entity and linked entity.?

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true"><entity name="new_entityone" enableprefiltering="1" prefilterparametername="FilteredEvent">    <attribute name="new_name" />    <attribute name="new_email" /><attribute name="createdon" /><order attribute="new_name" descending="false" /><link-entity name="new_eventregistration" from="new_entityoneid" to="new_entityoneid" alias="alianname" enableprefiltering="1" prefilterparametername="FilteredEventReg"><attribute name='new_total'/><link-entity name="contact" from="contactid" to="new_registrantid" alias="contact"><attribute name="lastname" /></link-entity></link-entity></entity></fetch>
While creating report , i have chosen Related Record Types = new_entityone,new_eventregistration.


Thanks and Regards.

Custom button returns error in CFO but works fine in Web client

$
0
0

Environment: MS-CRM 2013, UR2 on premisis; MS-Outlook 2010

We have some customer buttons, which works as intended in the Web client, but gives a syntax error in CFO (online as well as offline).

Example:
Ribbondiffxml:

<RibbonDiffXml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><CustomAction Id="hdm.account.ContactReport.Button.CustomAction" Location="Mscrm.Form.account.MainTab.Save.Controls._children" Sequence="41"><CommandUIDefinition><Button Alt="$LocLabels:hdm.account.ContactReport.Button.Alt" Command="hdm.account.NewContactReport.Command" Description="Create a new Contact Report" Id="hdm.account.ContactReport.Button" Image32by32="$webresource:IconHdm_tripreportLarge" Image16by16="$webresource:IconHdm_tripreportSmall" LabelText="$LocLabels:hdm.account.ContactReport.Button.LabelText" Sequence="41" TemplateAlias="o1" ToolTipTitle="$LocLabels:hdm.account.ContactReport.Button.ToolTipTitle" ToolTipDescription="$LocLabels:hdm.account.ContactReport.Button.ToolTipDescription" /></CommandUIDefinition></CustomAction><HideCustomAction HideActionId="hdm.Mscrm.Form.account.AddConnection.Hide" Location="Mscrm.Form.account.AddConnection" /><HideCustomAction HideActionId="hdm.Mscrm.SubGrid.account.AddNewStandard.Hide" Location="Mscrm.SubGrid.account.AddNewStandard" /></CustomActions><Templates><RibbonTemplates Id="Mscrm.Templates" /></Templates><CommandDefinition Id="hdm.account.NewContactReport.Command"><EnableRules /><DisplayRules><DisplayRule Id="hdm.account.CreateState.DisplayRule" /></DisplayRules><Actions><JavaScriptFunction FunctionName="HDM.Account.NewContactReportOnClick" Library="HDM.Account" /></Actions></CommandDefinition></CommandDefinitions><RuleDefinitions><TabDisplayRules /><DisplayRules></DisplayRules><EnableRules></EnableRules></RuleDefinitions><LocLabels><LocLabel Id="hdm.account.ContactReport.Button.Alt"><Titles><Title description="Contact Report" languagecode="1033" /></Titles></LocLabel><LocLabel Id="hdm.account.ContactReport.Button.LabelText"><Titles><Title description="New Contact Report" languagecode="1033" /></Titles></LocLabel><LocLabel Id="hdm.account.ContactReport.Button.ToolTipDescription"><Titles><Title description="Create a new Contact Report" languagecode="1033" /></Titles></LocLabel><LocLabel Id="hdm.account.ContactReport.Button.ToolTipTitle"><Titles><Title description="Contact Report" languagecode="1033" /></Titles></LocLabel></LocLabels></RibbonDiffXml>

JavaScript:

    NewContactReportOnClick: function () {
        var parameters = {};
        parameters["hdm_accountid"] = Xrm.Page.data.entity.getId();
        parameters["hdm_accountidname"] = Xrm.Page.getAttribute("name").getValue();
        Xrm.Utility.openEntityForm("hdm_tripreport", null, parameters);
    },

CFO error:

CFO Fidler:

When doing the same with the browser, the URL is different, also a http 404 error , but no error pop up:

404 HTTPS crmstg... /HDMMSCRM/HDM.Account

Any suggestions are appreciated.

Regards,
Per


Per

Windows LiveID creating problem..

$
0
0

I have a customer portal which logs in into CRM and returns client details using Windows Live ID orGoogle ID. The login with Google Id works fine. But windows Live ID login is creating the problem.... I am getting this error.

Server Error in '/' Application.

Sequence contains more than one element

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: Sequence contains more than one element

Source Error: 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 
[InvalidOperationException: Sequence contains more than one element]
   Microsoft.Xrm.Sdk.Linq.QueryProvider.ThrowException(Exception exception) +6
   Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute(QueryExpression qe, Boolean throwIfSequenceIsEmpty, Boolean throwIfSequenceNotSingle, Projection projection, NavigationSource source, List`1 linkLookups, String& pagingCookie, Boolean& moreRecords) +665
   Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute(QueryExpression qe, Boolean throwIfSequenceIsEmpty, Boolean throwIfSequenceNotSingle, Projection projection, NavigationSource source, List`1 linkLookups) +67
   Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute(Expression expression) +129
   Microsoft.Xrm.Sdk.Linq.QueryProvider.System.Linq.IQueryProvider.Execute(Expression expression) +62
   System.Linq.Queryable.SingleOrDefault(IQueryable`1 source, Expression`1 predicate) +287
   Microsoft.Xrm.Portal.IdentityModel.Web.Handlers.FederationAuthenticationHandler.FindContactByUserName(HttpContext context, WSFederationAuthenticationModule fam, IDictionary`2 signInContext, OrganizationServiceContext serviceContext, String identityProvider, String userName) +534
   Microsoft.Xrm.Portal.IdentityModel.Web.Handlers.FederationAuthenticationHandler.TryHandleSignInResponse(HttpContext context, WSFederationAuthenticationModule fam, IDictionary`2 signInContext) +115
   Microsoft.Xrm.Portal.IdentityModel.Web.Handlers.FederationAuthenticationHandler.TryHandleSignInResponse(HttpContext context, WSFederationAuthenticationModule fam) +36
   Microsoft.Xrm.Portal.IdentityModel.Web.Handlers.FederationAuthenticationHandler.ProcessRequest(HttpContext context) +214

[FederationAuthenticationException: Federated sign-in error.]
   Microsoft.Xrm.Portal.IdentityModel.Web.Handlers.FederationAuthenticationHandler.ProcessRequest(HttpContext context) +442
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +341
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69

It was working fine in the development ...  i have pushed this site into azure...  and i m accessing it through azurewebsites.net

How can i solve this problem????


Custom button returns error in CFO but works fine in Web client

$
0
0

Environment: MS-CRM 2013, UR2 on premisis; MS-Outlook 2010

We have some customer buttons, which works as intended in the Web client, but gives a syntax error in CFO (online as well as offline).

Example:
Ribbondiffxml:

<RibbonDiffXml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><CustomAction Id="hdm.account.ContactReport.Button.CustomAction" Location="Mscrm.Form.account.MainTab.Save.Controls._children" Sequence="41"><CommandUIDefinition><Button Alt="$LocLabels:hdm.account.ContactReport.Button.Alt" Command="hdm.account.NewContactReport.Command" Description="Create a new Contact Report" Id="hdm.account.ContactReport.Button" Image32by32="$webresource:IconHdm_tripreportLarge" Image16by16="$webresource:IconHdm_tripreportSmall" LabelText="$LocLabels:hdm.account.ContactReport.Button.LabelText" Sequence="41" TemplateAlias="o1" ToolTipTitle="$LocLabels:hdm.account.ContactReport.Button.ToolTipTitle" ToolTipDescription="$LocLabels:hdm.account.ContactReport.Button.ToolTipDescription" /></CommandUIDefinition></CustomAction><HideCustomAction HideActionId="hdm.Mscrm.Form.account.AddConnection.Hide" Location="Mscrm.Form.account.AddConnection" /><HideCustomAction HideActionId="hdm.Mscrm.SubGrid.account.AddNewStandard.Hide" Location="Mscrm.SubGrid.account.AddNewStandard" /></CustomActions><Templates><RibbonTemplates Id="Mscrm.Templates" /></Templates><CommandDefinition Id="hdm.account.NewContactReport.Command"><EnableRules /><DisplayRules><DisplayRule Id="hdm.account.CreateState.DisplayRule" /></DisplayRules><Actions><JavaScriptFunction FunctionName="HDM.Account.NewContactReportOnClick" Library="HDM.Account" /></Actions></CommandDefinition></CommandDefinitions><RuleDefinitions><TabDisplayRules /><DisplayRules></DisplayRules><EnableRules></EnableRules></RuleDefinitions><LocLabels><LocLabel Id="hdm.account.ContactReport.Button.Alt"><Titles><Title description="Contact Report" languagecode="1033" /></Titles></LocLabel><LocLabel Id="hdm.account.ContactReport.Button.LabelText"><Titles><Title description="New Contact Report" languagecode="1033" /></Titles></LocLabel><LocLabel Id="hdm.account.ContactReport.Button.ToolTipDescription"><Titles><Title description="Create a new Contact Report" languagecode="1033" /></Titles></LocLabel><LocLabel Id="hdm.account.ContactReport.Button.ToolTipTitle"><Titles><Title description="Contact Report" languagecode="1033" /></Titles></LocLabel></LocLabels></RibbonDiffXml>

JavaScript:

    NewContactReportOnClick: function () {
        var parameters = {};
        parameters["hdm_accountid"] = Xrm.Page.data.entity.getId();
        parameters["hdm_accountidname"] = Xrm.Page.getAttribute("name").getValue();
        Xrm.Utility.openEntityForm("hdm_tripreport", null, parameters);
    },

CFO error:

CFO Fidler:

When doing the same with the browser, the URL is different, also a http 404 error , but no error pop up:

404 HTTPS crmstg... /HDMMSCRM/HDM.Account

Any suggestions are appreciated.

Regards,
Per


Per


Windows LiveID creating problem..

$
0
0

I have a customer portal which logs in into CRM and returns client details using Windows Live ID orGoogle ID. The login with Google Id works fine. But windows Live ID login is creating the problem.... I am getting this error.

Server Error in '/' Application.

Sequence contains more than one element

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: Sequence contains more than one element

Source Error: 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 
[InvalidOperationException: Sequence contains more than one element]
   Microsoft.Xrm.Sdk.Linq.QueryProvider.ThrowException(Exception exception) +6
   Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute(QueryExpression qe, Boolean throwIfSequenceIsEmpty, Boolean throwIfSequenceNotSingle, Projection projection, NavigationSource source, List`1 linkLookups, String& pagingCookie, Boolean& moreRecords) +665
   Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute(QueryExpression qe, Boolean throwIfSequenceIsEmpty, Boolean throwIfSequenceNotSingle, Projection projection, NavigationSource source, List`1 linkLookups) +67
   Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute(Expression expression) +129
   Microsoft.Xrm.Sdk.Linq.QueryProvider.System.Linq.IQueryProvider.Execute(Expression expression) +62
   System.Linq.Queryable.SingleOrDefault(IQueryable`1 source, Expression`1 predicate) +287
   Microsoft.Xrm.Portal.IdentityModel.Web.Handlers.FederationAuthenticationHandler.FindContactByUserName(HttpContext context, WSFederationAuthenticationModule fam, IDictionary`2 signInContext, OrganizationServiceContext serviceContext, String identityProvider, String userName) +534
   Microsoft.Xrm.Portal.IdentityModel.Web.Handlers.FederationAuthenticationHandler.TryHandleSignInResponse(HttpContext context, WSFederationAuthenticationModule fam, IDictionary`2 signInContext) +115
   Microsoft.Xrm.Portal.IdentityModel.Web.Handlers.FederationAuthenticationHandler.TryHandleSignInResponse(HttpContext context, WSFederationAuthenticationModule fam) +36
   Microsoft.Xrm.Portal.IdentityModel.Web.Handlers.FederationAuthenticationHandler.ProcessRequest(HttpContext context) +214

[FederationAuthenticationException: Federated sign-in error.]
   Microsoft.Xrm.Portal.IdentityModel.Web.Handlers.FederationAuthenticationHandler.ProcessRequest(HttpContext context) +442
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +341
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69

It was working fine in the development ...  i have pushed this site into azure...  and i m accessing it through azurewebsites.net

How can i solve this problem????


confirmDialog Bug in Dynamics CRM 2013

$
0
0

All,

There seems to be an issue with the confirmDialogue function in Dynamics CRM 2013 in that it crashes the browser (Firefox, Internet Explorer 11).  When debugging the application, Visual Studio shows a message stating "Unhandled exception at 0x6961969C (mshtml.dll) in iexplore.exe: 0xC0000005: Access violation reading location 0x00000024." and when breaking on this error I get a mshtml.pdb not loaded.  To implement the confirmDialogue, I use the following code:

function saveRecordOnClearanceLevelChange() {
    var clearanceLevel = Xrm.Page.getAttribute("cats_clearancelevel").getText();
    if (clearanceLevel == "Top Secret") {
        var userRoleIds = Xrm.Page.context.getUserRoles();
        var hasClearance = checkClearance(userRoleIds);
        var message = "You do not have permission to view Top Secret records, are you sure you want to continue?";

        if (hasClearance == false) {
            //closeForm();
            Xrm.Utility.confirmDialog(message, closeForm, setFocus);
        }
    }
}

function checkClearance(userRoleIds) {
    var hasClearance = false;
    var clearanceLevel = Xrm.Page.getAttribute("cats_clearancelevel").getText();

    for (var x = 0; x < userRoleIds.length; x++) {
        if (clearanceLevel == "Top Secret" && userRoleIds[x] == "6924e225-2d90-e311-9408-00155dc8110b") {
            hasClearance = true;
            break;
        }
    }
    return hasClearance;
}

function closeForm() {

    Xrm.Page.data.entity.save("saveandclose");

}

function setFocus() {
    Xrm.Page.getControl("cats_clearancelevel").setFocus();
}
Any idea on why this block of JavaScript might be crashing these browsers?

CRM 2013: Hide system ribbon button for selected entities

$
0
0

Hello, 

I want to hide a system button on the Advanced Find ribbon for selected entities. I have customized the application ribbon and added a display rule (OrRule) to check for the list of entities. However, I am not able to get the InvertResult property work for the rule so that the button will be hidden for these entities.

I have used the Ribbon workbench as well as tried editing the ribbon xml manually. Both did not work. With the workbench solution, I can edit the display rule properties and set the InvertResult property to True. However, the changes are not being saved/published. I don't know what I'm missing.

Can someone please help me solve this issue ?

Here is the DisplayRule

<DisplayRule Id="new.ApplicationRibbon.Subgrid.SystemDeactivate.DisplayRule"><OrRule><Or><EntityRule EntityName="new_fcall" AppliesTo="SelectedEntity" Context="SubGridStandard" /></Or><Or><EntityRule EntityName="new_plan" AppliesTo="SelectedEntity" Context="SubGridStandard" /></Or><Or><EntityRule EntityName="new_automaticnotification" AppliesTo="SelectedEntity" Context="SubGridStandard" /></Or></OrRule></DisplayRule> 

CRM 2013 - Javascript - Can I stop my Javascript code running if a certain condition is met?

$
0
0

Hi, I've created a piece of JavaScript that runs when a account name is inputted by the customer, from the account name a account code is generated. Once the account code has been saved I do not want the account code to be edited again, but the account name can be. My problem is even when account code is set to read only my JavaScript will kick in and change the account code

I was wondering if there was a way of using the OnLoad event the programme could check if a Account code is present, if it is then my piece of javascript will be disabled?

Thanks, Shaun


S.Harrison

CRM 2011 - 443 HTTP/1.1 POST /test/XRMServices/2011/Organization.svc/web 400 2 BadRequest CRMAppPool

$
0
0

I have 2 organizations on my dev CRM on-premises installation. One is an imported production database and the other (named Test) was created new in the dev CRM. My javascript SOAP routine works in the imported production org and fails in the other (Test) with a 401 Access Denied error (visible when I use Wireshark). The Windows httperr##.log shows the message in the Title of this post.

Since the message seemed to suggest the problem was permissions related to the CRMAppPool, I added the runas of that app pool (NETWORK SERVICE) to the local administrators group and rebooted. The same error messages are displayed when I re-run the javascript.

I've been puzzling over this off and on for weeks. Any ideas? If it is a permissions issue, is there a good way to find out who is being denied what permission on what resource (so I can grant appropriate permissions in the Test org)?

Thanks!

Here's the code. The line of code that is executed to create the XRMServices url (in both instances)

 serverUrl = document.location.protocol + "//" + document.location.host + "/" + Xrm.Page.context.getOrgUniqueName();


//////////////////////////////////////////////////////////////////////////////////////////////////
// With thanks, adapted from:
// http://mileyja.blogspot.com/2011/08/close-case-using-jscript-or-net-in.html
//////////////////////////////////////////////////////////////////////////////////////////////////
if (typeof (SDK) == "undefined")
{ SDK = { __namespace: true }; }
//This will establish a more unique namespace for functions in this library. This will reduce the
// potential for functions to be overwritten due to a duplicate name when the library is loaded.
SDK.SAMPLES = {
    _getServerUrl: function () {
        ///<summary>
        /// Returns the URL for the SOAP endpoint using the context information available in the form
        /// or HTML Web resource.
        ///</summary>
        var OrgServicePath = "/XRMServices/2011/Organization.svc/web";
        var serverUrl = "";
        if (typeof GetGlobalContext == "function") {
            var context = GetGlobalContext();
            serverUrl = context.getServerUrl();
        }
        else {
            if (typeof Xrm.Page.context == "object") {
                //serverUrl = Xrm.Page.context.getServerUrl();
                serverUrl = document.location.protocol + "//" + document.location.host + "/" + Xrm.Page.context.getOrgUniqueName();
            }
            else
            { throw new Error("Unable to access the server URL"); }
        }
        if (serverUrl.match(/\/$/)) {
            serverUrl = serverUrl.substring(0, serverUrl.length - 1);
        }
        return serverUrl + OrgServicePath;
    },
    CloseIncidentRequest: function () {
        var incidentId = Xrm.Page.data.entity.getId();
        var requestMain = ""
        requestMain += "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">";
        requestMain += "  <s:Body>";
        requestMain += "    <Execute xmlns=\"http://schemas.microsoft.com/xrm/2011/Contracts/Services\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">";
        requestMain += "      <request i:type=\"b:CloseIncidentRequest\" xmlns:a=\"http://schemas.microsoft.com/xrm/2011/Contracts\" xmlns:b=\"http://schemas.microsoft.com/crm/2011/Contracts\">";
        requestMain += "        <a:Parameters xmlns:c=\"http://schemas.datacontract.org/2004/07/System.Collections.Generic\">";
        requestMain += "          <a:KeyValuePairOfstringanyType>";
        requestMain += "            <c:key>IncidentResolution</c:key>";
        requestMain += "            <c:value i:type=\"a:Entity\">";
        requestMain += "              <a:Attributes>";
        requestMain += "                <a:KeyValuePairOfstringanyType>";
        requestMain += "                  <c:key>incidentid</c:key>";
        requestMain += "                  <c:value i:type=\"a:EntityReference\">";
        requestMain += "                    <a:Id>" + incidentId + "</a:Id>";
        requestMain += "                    <a:LogicalName>incident</a:LogicalName>";
        requestMain += "                    <a:Name i:nil=\"true\" />";
        requestMain += "                  </c:value>";
        requestMain += "                </a:KeyValuePairOfstringanyType>";
        requestMain += "                <a:KeyValuePairOfstringanyType>";
        requestMain += "                  <c:key>subject</c:key>";
        requestMain += "                  <c:value i:type=\"d:string\" xmlns:d=\"http://www.w3.org/2001/XMLSchema\">Parent Case has been resolved</c:value>";
        requestMain += "                </a:KeyValuePairOfstringanyType>";
        requestMain += "              </a:Attributes>";
        requestMain += "              <a:EntityState i:nil=\"true\" />";
        requestMain += "              <a:FormattedValues />";
        requestMain += "              <a:Id>00000000-0000-0000-0000-000000000000</a:Id>";
        requestMain += "              <a:LogicalName>incidentresolution</a:LogicalName>";
        requestMain += "              <a:RelatedEntities />";
        requestMain += "            </c:value>";
        requestMain += "          </a:KeyValuePairOfstringanyType>";
        requestMain += "          <a:KeyValuePairOfstringanyType>";
        requestMain += "            <c:key>Status</c:key>";
        requestMain += "            <c:value i:type=\"a:OptionSetValue\">";
        requestMain += "              <a:Value>5</a:Value>";
        requestMain += "            </c:value>";
        requestMain += "          </a:KeyValuePairOfstringanyType>";
        requestMain += "        </a:Parameters>";
        requestMain += "        <a:RequestId i:nil=\"true\" />";
        requestMain += "        <a:RequestName>CloseIncident</a:RequestName>";
        requestMain += "      </request>";
        requestMain += "    </Execute>";
        requestMain += "  </s:Body>";
        requestMain += "</s:Envelope>";
        var req = new XMLHttpRequest();

var srvURL = SDK.SAMPLES._getServerUrl();
        req.open("POST", srvURL, true)
        // Responses will return XML. It isn't possible to return JSON.
        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");
        var successCallback = null;
        var errorCallback = null;
        req.onreadystatechange = function () { SDK.SAMPLES.CloseIncidentResponse(req, successCallback, errorCallback); };
        req.send(requestMain);
    },
    CloseIncidentResponse: function (req, successCallback, errorCallback) {
        ///<summary>
        /// Recieves the assign response
        ///</summary>
        ///<param name="req" Type="XMLHttpRequest">
        /// The XMLHttpRequest response
        ///</param>
        ///<param name="successCallback" Type="Function">
        /// The function to perform when an successfult response is returned.
        /// For this message no data is returned so a success callback is not really necessary.
        ///</param>
        ///<param name="errorCallback" Type="Function">
        /// The function to perform when an error is returned.
        /// This function accepts a JScript error returned by the _getError function
        ///</param>
        if (req.readyState == 4) {
            if (req.status == 200) {
                if (successCallback != null)
                { successCallback(); }
            }
            else {
                errorCallback(SDK.SAMPLES._getError(req.responseXML));
            }
        }
    },
    _getError: function (faultXml) {
        ///<summary>
        /// Parses the WCF fault returned in the event of an error.
        ///</summary>
        ///<param name="faultXml" Type="XML">
        /// The responseXML property of the XMLHttpRequest response.
        ///</param>
        var errorMessage = "Unknown Error (Unable to parse the fault)";
        if (typeof faultXml == "object") {
            try {
                var bodyNode = faultXml.firstChild.firstChild;
                //Retrieve the fault node
                for (var i = 0; i < bodyNode.childNodes.length; i++) {
                    var node = bodyNode.childNodes[i];
                    //NOTE: This comparison does not handle the case where the XML namespace changes
                    if ("s:Fault" == node.nodeName) {
                        for (var j = 0; j < node.childNodes.length; j++) {
                            var faultStringNode = node.childNodes[j];
                            if ("faultstring" == faultStringNode.nodeName) {
                                errorMessage = faultStringNode.text;
                                break;
                            }
                        }
                        break;
                    }
                }
            }
            catch (e) { };
        }
        return new Error(errorMessage);
    },
    __namespace: true
};

Viewing all 465 articles
Browse latest View live


Latest Images

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