Quantcast
Channel: XrmServiceToolkit - A Microsoft Dynamics CRM 2015/2013/2011 JavaScript Library
Viewing all 589 articles
Browse latest View live

Commented Issue: getCurrentUserId - Cannot convert the XML string to a cross-browser XML object. [1236]

$
0
0
After installing Rollup 12-13, I get "Cannot convert the XML string to a cross-browser XML object." when callling XrmServiceToolkit.Soap.GetCurrentUserId().
Comments: ** Comment from web user: jaimieji **

Also if you are using IE10 with CRM 2011 rollup 11 and previous rollups. You will also need to add the CRM website URL to IE10 compatible view as IE10 is still not fully supported for previous rollups

Jaimie


New Post: Fix for retrieving party list fields

$
0
0
When retrieving an email, for example, XrmServiceToolkit (I am using 1.4.0) is returning an empty array for the Party List fields e.g., to, from, cc, etc... It looks like this line of code (line 1388):

if (itemNodes[z].childNodes[0].text == "partyid") {

Needs to be changed to:

if ($(itemNodes[z].childNodes[0]).text() == "partyid") {

or:

if (itemNodes[z].childNodes[0].textContent == "partyid" {

Updated Wiki: Documentation

$
0
0

XrmServiceToolkit is a JavaScript library which could be used to make

  • Common Methods: Change of CRM form like enable field, show field, etc
  • Rest EndPoint Methods: Create, Retrieve, Update a record, etc
  • Soap Request Methods: Create, Retrieve, Update a record, etc
  • Extension Methods: Setup Dependent OptionSet, Add Tooltip to fields, Add custom filter view to lookup field. All these methods are generic to use and configurable through editing of XML web resource.

Debug / Unit Test JavaScript Rest or Soap in Visual Studio For CRM 2011

Project Highlight and Notes: CRM 2011 Rollup 12 is coming, XrmServiceToolkit 1.4.0 beta is out

New year has always been very busy for lots of people. There is no doubt for us, MSCRM consultants...

Last week, i got an email from Microsoft CRM team to notice me that my personal CRM online subscription will be updated to Rollup 12 which was exciting news because i finally have an environment to test and develop XrmServiceToolkit and make an effort to support cross browser.

The upgrade obviously is a big deal for everyone. There are some immediate problems which i have seen for the toolkit after my instance is running RU12.

Version 1.4.0 is far from perfect at its current stage to support cross browser cause there are so many things to do and so much testing to be done. A quick summary for version 1.4.0 if you are keen.

* @current version : 1.4 (beta)

* Date: January, 2013

* Dependency: JSON2, jQuery (latest or 1.7.2 above)

* Feature: Add Cross Browser Support for RU12

* Tested Platform: IE9, IE10, Chrome Version 24.0.1312.56 m, Firefox 18.0.1

If you have used the toolkit previously for your project, thanks very much for your support. For version 1.4.0, download and try it out using atesting environment and let me know issues and bugs.

Happy Coding,
Jaimie 

For examples with qunit, please follow the links

 Whats new:

  • Version: 1.4.0
  • Dependency: JSON2, jQuery 1.7.2 above
  • Date: January, 2013
    • New Feature: Add cross browser support for RU12
    • Tested Browser: IE9, IE10, Chrome Version 24.0.1312.56 m, Firefox 18.0.1
  • Version: 1.3.2
  • Dependency: JSON2, jQuery 1.7.2 above
  • Date: January, 2013
    • New Fix: Fix an issue that XrmServiceToolit.Soap is not initialized properly when calling from ribbon for CRM Online
    • Add more cross browser support before RU12
  • Version: 1.3.1
  • Dependency: JSON2, jQuery 1.7.2 above
  • Date: November, 2012
    • New Feature:
      • A logic change to improvie performance when retrieving larger number of records
    • New Function:
      • XrmServiceToolkit.Soap.QueryAll: a method to return all records (>5k+). Similar to how to use XrmServiceToolkit.Soap.QueryByAttribute
    • New Fix:
      • XrmServiceToolkit.Rest.RetrieveMultiple not returning more than 50 records
      • XrmServiceToolkit.Soap.BusinessEntity not working properly with number attribute like int, double, decimal
      • XrmServiceToolkit.Soap not handling error message properly.
  • Version: 1.3
    • Dependency: JSON2, jQuery 1.7.2 above
    • Date: July, 2012
    • New Feature:
      • jQuery integration
      • Cross Browser support. More testings are required
    • New Category and Extension:
      • jQueryXrmDependentOptionSet: A generic configurable method to setup dependent option set in CRM 2011
      • jQueryXrmFieldTooltip: A generic configurable method to setup tooltip for crm fields
      • jQueryXrmLookupCustomFilterView: A generic configurable method to add custom filter view to crm lookup field 
  • Version: 1.2
    • Dependency: JSON2
    • Date: May, 2012
    • New Fix - Create, Update, Retrieve activity with PartyList type [From, To, Cc, Bcc]
  • Version: 1.1
    • Depdendency: JSON2
    • Date: April, 2012
    • New Function - XrmServiceToolkit.Soap.Assign
    • New Function - XrmServiceToolkit.Soap.GrantAccess
    • New Function - XrmServiceToolkit.Soap.ModifyAccess
    • New Function - XrmServiceToolkit.Soap.RevokeAccess
    • New Function - XrmServiceToolkit.Soap.RetrievePrincipalAccess

Cross Browser Support

There is still a long way to go until calling the library to support real cross browser. As downloaded from Microsoft website, CRM 2011 code validation tool is used during the upgrade process. Though testings are insufficient with real or RC environment of CRM 2011 RU9 o_0!

Code Validation

Qunit Refresh and Test Results

Qunit plays a big part during the development and continous development for this project.[NOTE] Qunit is for unit testing. You do not need the part of the code in live code

Qunit test result

Code Examples in the documentation.

All code examples or most of them are using in combination with Qunit. The qunit part of the code is not required in real life situation.

Synchronous and Asynchronous

The basics of synchronous and asynchronous calls are still the same without jQuery. As the reason not too sure yet , jQuery 1.8 will not support ajax asynch=false anymore. However in reality, there will be still usage, for example onSave, synchronous calls might still required. For best practise, asynchronous calls should be used for better performance.

XrmServiceToolkit.Rest funcitons use the last boolean parameter to indicate if the method runs asychronously or synchronously. If false is assigned, then the method will run synchronously, otherwise an asynchrounous method will be called.

 

var contact = {};
contact.FirstName = "Diane";
contact.LastName = "Morgan";
contact.MiddleName = "<&>";
contact.GenderCode = { Value: 2 };
contact.CreditLimit = { Value: "2.00" };
contact.BirthDate = birthDate;
contact.DoNotEMail = true;
contact.DoNotPhone = true;

XrmServiceToolkit.Rest.Create(
	contact,
	"ContactSet",function (result) {
		contactId = result.ContactId;
	},function (error) {
		alert(error.message);
	},false //synchronous call
); 
var contact = {};
contact.FirstName = "Diane";
contact.LastName = "Morgan";
contact.MiddleName = "<&>";
contact.GenderCode = { Value: 2 };
contact.CreditLimit = { Value: "2.00" };
contact.BirthDate = birthDate;
contact.DoNotEMail = true;
contact.DoNotPhone = true;

XrmServiceToolkit.Rest.Create(
	contact,
	"ContactSet",function (result) {
		contactId = result.ContactId;
	},function (error) {
		alert(error.message);
	},true //asynchronous call
);

 

XrmServiceTookit.Soap functions using the last function parameter to indicate if the method runs asychronously or synchronously. If the funciton is defined, the method will run asychronously. Otherwise, the method will be called synchronously.

var cols = ["firstname", "lastname", "middlename", "familystatuscode", "ownerid", "creditlimit", "birthdate", "donotemail", "donotphone"];var retrievedContact = XrmServiceToolkit.Soap.Retrieve("contact", contactId, cols); //synchronous callvar familyStatusLable = retrievedContact.attributes['familystatuscode'].formattedValue;var firstName = retrievedContact.attributes['firstname'].value;
var cols = ["firstname", "lastname", "middlename", "familystatuscode", "ownerid", "creditlimit", "birthdate", "donotemail", "donotphone"];
XrmServiceToolkit.Soap.Retrieve("contact", contactId, cols, function(result){    var familyStatusLable = result.attributes['familystatuscode'].formattedValue;	    var firstName = result.attributes['firstname'].value;
}); //asychronous call

Numbers

CRM 2011 has number like whole number (int), floating point (double) and Decimal number (decimal), Currency (Money).

When using the soap funcitons in the library, it is recommended to include type when assigning values. It is more likely to cause issue for fields like decimal or double

//overcome limitations of numbers with type specified.... 
createContact.attributes["numberofchildren"] = { value: 2, type: "int"}; 

createContact.attributes["exchangerate"] = {value: 1.5617, type: "decimal"}; 

createContact.attributes["address1_latitude"] = { value: 1.5617, type: "double" }; 

createContact.attributes["creditlimit"] = { value: 2, type: "Money" }; 

FormattedValue

The XrmServiceToolkit.Soap functions have an extra attribute returned as formattedValue. It could be very useful if you want to return some extra information. For example, to get the lable of OptionSet. The example is synchrous.

var cols = ["firstname", "lastname", "middlename", "familystatuscode", "ownerid", "creditlimit", "birthdate", "donotemail", "donotphone"];var retrievedContact = XrmServiceToolkit.Soap.Retrieve("contact", contactId, cols);var familyStatusLable = retrievedContact.attributes['familystatuscode'].formattedValue;//labelvar familyStatusValue = retrievedContact.attributes['familystatuscode'].value; //integer

An example to create email activity using the library.

test("Test XrmServiceToolkit.Soap.Create() method to create a email activity (email)", function () {var createEmail = new XrmServiceToolkit.Soap.BusinessEntity("email");
    createEmail.attributes["subject"] = "Test Email subject";
    createEmail.attributes["description"] = "This email was created by the XrmServiceToolkit.Soap.Create() sample.";var from = [
       { id: whoamiUserId, logicalName: "systemuser", type: "EntityReference" }
    ];

    createEmail.attributes["from"] = { value: from, type: "EntityCollection" };var to = [
       { id: accountId, logicalName: "account", type: "EntityReference" },
       { id: contactId, logicalName: "contact", type: "EntityReference" }
    ];

    createEmail.attributes["to"] = { value: to, type: "EntityCollection" };var cc = [
       { id: accountId, logicalName: "account", type: "EntityReference" },
       { id: contactId, logicalName: "contact", type: "EntityReference" }
    ];

    createEmail.attributes["cc"] = { value: cc, type: "EntityCollection" };var bcc = [
       { id: accountId, logicalName: "account", type: "EntityReference" },
       { id: contactId, logicalName: "contact", type: "EntityReference" }
    ];

    createEmail.attributes["bcc"] = { value: bcc, type: "EntityCollection" };

    createEmail.attributes["directioncode"] = true;

    emailId = XrmServiceToolkit.Soap.Create(createEmail);

    ok(guidExpr.test(emailId), "Creating an email should returned the new record's ID in GUID format. ");
  });

An example to retrieve an email is like this. The returned value of [From/To/Cc/Bcc] is an array of Entity reference.

 

 test("Test XrmServiceToolkit.Soap.Retrieve() method to retrieve a CRM record (email)", function () {var cols = ["subject", "description", "from", "to", "cc", "bcc", "directioncode"];var retrievedEmail = XrmServiceToolkit.Soap.Retrieve("email", emailId, cols);

    equals(retrievedEmail.attributes['subject'].value, "Test Email subject", "Subject matches");
    equals(retrievedEmail.attributes['description'].value, "This email was created by the XrmServiceToolkit.Soap.Create() sample.", "Description Matches");
    equals(retrievedEmail.attributes['from'].type, "EntityCollection", "CRM partylist type should be EntityCollection");
    equals(retrievedEmail.attributes['to'].type, "EntityCollection", "CRM partylist type should be EntityCollection"); ;
    equals(retrievedEmail.attributes['cc'].type, "EntityCollection", "CRM partylist type should be EntityCollection");
    equals(retrievedEmail.attributes['bcc'].type, "EntityCollection", "CRM partylist type should be EntityCollection");
    equals(retrievedEmail.attributes['directioncode'].type, "boolean", "CRM boolean type should be boolean");
 });

To get the value of an array item of the returned result. Using something like

var sender = retrievedEmail.attributes['from'].value[0];

Then you can get sender.id, sender.type, sender.logicalName, sender.Name per normal as a returned EntityReference value.

An example to use the GrantAccess is like this. For all other examples, please have a look at the attached aspx page.

  test("Test XrmServiceToolkit.Soap.GrantAccess() method to grant a user access to a CRM record (contact)", function () {var accessOptions = {
         targetEntityName: "contact",
         targetEntityId: contactId,
         principalEntityName: "systemuser",
         principalEntityId: currentUserId,
         accessRights: ["ReadAccess", "WriteAccess"]
     };var grantAccessResponse = XrmServiceToolkit.Soap.GrantAccess(accessOptions);
        ok(grantAccessResponse == "GrantAccess", "The current user should have the listed access to the contact");

     });

[NOTE] These functions regarding access should be combined with CRM 2011 security model and they could be useful if entities have to be controlled at record level. This obviously has to be used with consideration of user rights, security settings and all other security related configurations as the requirement of the project.

For details about how to use all these methods and updated examples. See attached .aspx page for examples.

Credi: The code example is based on Daniel Cai's CrmWebServiceKit.

XrmServiceToolkitTest.zip

Dependency

JSON2 javascript library is required in CRM 2011 as a web resource to make the library working.

jQuery 1.7.2 above is required from version 1.3

To Unit Test your code at local machine.

There is a way to test all your Rest / Soap calls directy from your development machine without modifying the library which is achieved by using the XrmPageTemplate.js and PageData.js. For details about how to using JavaScript Intellisense, please have a look at this wonderful blog

http://crmbusiness.wordpress.com/2011/12/01/crm-2011-using-javascript-intellisense-and-testpage-htm/

Once you have got the PageData.js generated from any entity, simply put it in the helper folder to replace the existing PageData.js in the source code project which you could download from the [Source Code] section here.

Now you could run and debug the XrmServiceToolkitTest.aspx from your visual studio.

Happy Coding,

Jaimie

Created Issue: error The SDK request could not be deserialized [1244]

$
0
0
I have this error for a week.
I use the last version 1.4. and CRM rollup 12

<error>
<code>0x8004416f</code>
<description>The SDK request could not be deserialized.</description>
<type>Platform</type>
</error>

Commented Issue: error The SDK request could not be deserialized [1244]

$
0
0
I have this error for a week
I use the last version 1.4. and CRM rollup 12

<error>
<code>0x8004416f</code>
<description>The SDK request could not be deserialized.</description>
<type>Platform</type>
</error>

the code

var xml = "" +
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" +
GenerateAuthenticationHeader() +
"<soap:Body>" +
"<Execute xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" +
"<Request xsi:type=\"ExecuteWorkflowRequest\">" +
"<EntityId>" + crmForm.ObjectId + "</EntityId>" +
"<WorkflowId>" + WorkflowId + "</WorkflowId>" + //WorkflowId = guid of the workflow
"</Request>" +
"</Execute>" +
"</soap:Body>" +
"</soap:Envelope>";

var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xmlHttpRequest.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/Execute");
xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
xmlHttpRequest.send(xml);
var resultXml = xmlHttpRequest.responseXML;
Comments: ** Comment from web user: jaimieji **

Hi.

I am not sure if this is the right place to ask a question for the library. But from your code, it seems you are still using CRM 4 code to run for a CRM 2011 server.

You could find some answers in the following link

http://stackoverflow.com/questions/11545895/execute-workflow-from-javascript-in-crm-2011

Jaimie

New Post: Fix for retrieving party list fields

$
0
0
Hi

Thanks for this. I have checked the code and there is a bug as you pointed out.

The fix will be included in the next release.

Jaimie

Created Issue: Soap.Execute issue with selectsinglenode [1246]

$
0
0
This worked prior to UR 12.

Console error from developertoolkit reveals

"SCRIPT438: Object doesn't support property or method 'selectSingleNode' ".

Code snippet (error is on response.selectSingleNode - see below)

```
function executeWorkflow(entityId, workflowId, successCallback, errorCallback) {
var requestMain = ""
requestMain += " <request i:type=\"b:ExecuteWorkflowRequest\" 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>EntityId</c:key>";
requestMain += " <c:value i:type=\"d:guid\" xmlns:d=\"http://schemas.microsoft.com/2003/10/Serialization/\">" + entityId + "</c:value>";
requestMain += " </a:KeyValuePairOfstringanyType>";
requestMain += " <a:KeyValuePairOfstringanyType>";
requestMain += " <c:key>WorkflowId</c:key>";
requestMain += " <c:value i:type=\"d:guid\" xmlns:d=\"http://schemas.microsoft.com/2003/10/Serialization/\">" + workflowId + "</c:value>";
requestMain += " </a:KeyValuePairOfstringanyType>";
requestMain += " </a:Parameters>";
requestMain += " <a:RequestId i:nil=\"true\" />";
requestMain += " <a:RequestName>ExecuteWorkflow</a:RequestName>";
requestMain += " </request>";

// Execute it
var response = XrmServiceToolkit.Soap.Execute(requestMain, function (response) {
var workflowId = response.selectSingleNode('//a:KeyValuePairOfstringanyType[c:key=\'Id\']/c:value').nodeTypedValue;
successCallback(workflowId);
}, errorCallback);
}
```

Commented Issue: Soap.Execute issue with selectsinglenode [1246]

$
0
0
This worked prior to UR 12.

Console error from developertoolkit reveals

"SCRIPT438: Object doesn't support property or method 'selectSingleNode' ".

Code snippet (error is on response.selectSingleNode - see below)

```
function executeWorkflow(entityId, workflowId, successCallback, errorCallback) {
var requestMain = ""
requestMain += " <request i:type=\"b:ExecuteWorkflowRequest\" 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>EntityId</c:key>";
requestMain += " <c:value i:type=\"d:guid\" xmlns:d=\"http://schemas.microsoft.com/2003/10/Serialization/\">" + entityId + "</c:value>";
requestMain += " </a:KeyValuePairOfstringanyType>";
requestMain += " <a:KeyValuePairOfstringanyType>";
requestMain += " <c:key>WorkflowId</c:key>";
requestMain += " <c:value i:type=\"d:guid\" xmlns:d=\"http://schemas.microsoft.com/2003/10/Serialization/\">" + workflowId + "</c:value>";
requestMain += " </a:KeyValuePairOfstringanyType>";
requestMain += " </a:Parameters>";
requestMain += " <a:RequestId i:nil=\"true\" />";
requestMain += " <a:RequestName>ExecuteWorkflow</a:RequestName>";
requestMain += " </request>";

// Execute it
var response = XrmServiceToolkit.Soap.Execute(requestMain, function (response) {
var workflowId = response.selectSingleNode('//a:KeyValuePairOfstringanyType[c:key=\'Id\']/c:value').nodeTypedValue;
successCallback(workflowId);
}, errorCallback);
}
```
Comments: ** Comment from web user: mtnmuncher **

Another issue I found while debugging the code is that, although I'm running IE9, the xmlparser function thinks I'm another browser. Instead of executing the ActiveXObject branch, it tries to execute , parser.parseFromString. The problem is that parseFromString doesn't exist in the object returned from window.DOMParser.

```
var xmlParser = function (txt) {
///<summary>
/// cross browser responseXml to return a XML object
///</summary>
var xmlDoc = null;
try {
// code for Mozilla, Firefox, Opera, etc.
if (window.DOMParser) {
// ReSharper disable InconsistentNaming
var parser = new DOMParser();
// ReSharper restore InconsistentNaming
xmlDoc = parser.parseFromString(txt, "text/xml");
}
else // Internet Explorer
{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = false;
xmlDoc.loadXML(txt);
}
} catch (e) {
alert("Cannot convert the XML string to a cross-browser XML object.");
}

return xmlDoc;
};
```


Commented Issue: Soap.Execute issue with selectsinglenode [1246]

$
0
0
This worked prior to UR 12.

Console error from developertoolkit reveals

"SCRIPT438: Object doesn't support property or method 'selectSingleNode' ".

Code snippet (error is on response.selectSingleNode - see below)

```
function executeWorkflow(entityId, workflowId, successCallback, errorCallback) {
var requestMain = ""
requestMain += " <request i:type=\"b:ExecuteWorkflowRequest\" 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>EntityId</c:key>";
requestMain += " <c:value i:type=\"d:guid\" xmlns:d=\"http://schemas.microsoft.com/2003/10/Serialization/\">" + entityId + "</c:value>";
requestMain += " </a:KeyValuePairOfstringanyType>";
requestMain += " <a:KeyValuePairOfstringanyType>";
requestMain += " <c:key>WorkflowId</c:key>";
requestMain += " <c:value i:type=\"d:guid\" xmlns:d=\"http://schemas.microsoft.com/2003/10/Serialization/\">" + workflowId + "</c:value>";
requestMain += " </a:KeyValuePairOfstringanyType>";
requestMain += " </a:Parameters>";
requestMain += " <a:RequestId i:nil=\"true\" />";
requestMain += " <a:RequestName>ExecuteWorkflow</a:RequestName>";
requestMain += " </request>";

// Execute it
var response = XrmServiceToolkit.Soap.Execute(requestMain, function (response) {
var workflowId = response.selectSingleNode('//a:KeyValuePairOfstringanyType[c:key=\'Id\']/c:value').nodeTypedValue;
successCallback(workflowId);
}, errorCallback);
}
```
Comments: ** Comment from web user: jaimieji **

Hi.

It seems that __executeWorkflow__is a function developed from your side which is not part of the toolkit. Yes, you will need to make sure the code is supporting multiply browser when you try to use the result from the Execute result (XrmServiceToolkit.Soap.Execute only cares the part that it will return the response from CRM server)

Jaimie

Source code checked in, #23041

$
0
0
Version 1.4.1 uploaded with many fixes and several new functions. 21/04/2013

Created Release: XrmServiceToolkit 1.4.1 (Apr 21, 2013)

$
0
0
  • Version: 1.4.1
  • Date: April, 2013
  • Dependency: JSON2, jQuery (latest or 1.7.2 above)
  • Tested Platform: IE9, IE10, Chrome Version 26.0.1410.64 m, Firefox 20.0.1
  • Feature: Add Cross Browser Support for RU12, RU13
    • New Fix - XrmServiceToolkit.Common.AddNotification method updated for RU12, RU13, still compatible for RU11 below
    • New Fix - XrmServiceToolkit.Soap.Fetch method did not format linked record correctly
    • New Fix - XrmServiceToolkit.Soap.Retrieve method did not return partylist data for activity
    • New Fix - Added manual conversion from String to Date conversion for cross browser
    • New Fix - getServerUrl method is updated as getClientUrl to align with RU12 SDK method getClientUrl(), still compatible to support RU11 below
    • New Function - getServerUrl private method is updated as getClientUrl to align with RU12 SDK method getClientUrl(), still compatible to support RU11 below
    • New Function - XrmServiceToolkit.Soap.RetrieveAllEntitiesMetadata method is a method to return all metadata for all entities by the specified entity filters
    • New Function - XrmServiceToolkit.Soap.RetrieveEntityMetadata method is a method to return the metadata for a certain entity by the specified entity filters
    • New Function - XrmServiceToolkit.Soap.RetrieveAttributeMetadata method is a method to return the metadata for a certain entity's attribute

Released: XrmServiceToolkit 1.4.1 (Apr 21, 2013)

$
0
0
  • Version: 1.4.1
  • Date: April, 2013
  • Dependency: JSON2, jQuery (latest or 1.7.2 above)
  • Tested Platform: IE9, IE10, Chrome Version 26.0.1410.64 m, Firefox 20.0.1
  • Feature: Add Cross Browser Support for RU12, RU13
    • New Fix - XrmServiceToolkit.Common.AddNotification method updated for RU12, RU13, still compatible for RU11 below
    • New Fix - XrmServiceToolkit.Soap.Fetch method did not format linked record correctly
    • New Fix - XrmServiceToolkit.Soap.Retrieve method did not return partylist data for activity
    • New Fix - Added manual conversion from String to Date conversion for cross browser
    • New Fix - getServerUrl method is updated as getClientUrl to align with RU12 SDK method getClientUrl(), still compatible to support RU11 below
    • New Function - getServerUrl private method is updated as getClientUrl to align with RU12 SDK method getClientUrl(), still compatible to support RU11 below
    • New Function - XrmServiceToolkit.Soap.RetrieveAllEntitiesMetadata method is a method to return all metadata for all entities by the specified entity filters
    • New Function - XrmServiceToolkit.Soap.RetrieveEntityMetadata method is a method to return the metadata for a certain entity by the specified entity filters
    • New Function - XrmServiceToolkit.Soap.RetrieveAttributeMetadata method is a method to return the metadata for a certain entity's attribute

Updated Release: XrmServiceToolkit 1.4.1 (Apr 21, 2013)

$
0
0
  • Version: 1.4.1
  • Date: April, 2013
  • Dependency: JSON2, jQuery (latest or 1.7.2 above)
  • Tested Platform: IE9, IE10, Chrome Version 26.0.1410.64 m, Firefox 20.0.1
  • Feature: Add Cross Browser Support for RU12, RU13
    • New Fix - XrmServiceToolkit.Common.AddNotification method updated for RU12, RU13, still compatible for RU11 below
    • New Fix - XrmServiceToolkit.Soap.Fetch method did not format linked record correctly
    • New Fix - XrmServiceToolkit.Soap.Retrieve method did not return partylist data for activity
    • New Fix - Added manual conversion from String to Date conversion for cross browser
    • New Fix - getServerUrl method is updated as getClientUrl to align with RU12 SDK method getClientUrl(), still compatible to support RU11 below
    • New Function - getServerUrl private method is updated as getClientUrl to align with RU12 SDK method getClientUrl(), still compatible to support RU11 below
    • New Function - XrmServiceToolkit.Soap.RetrieveAllEntitiesMetadata method is a method to return all metadata for all entities by the specified entity filters
    • New Function - XrmServiceToolkit.Soap.RetrieveEntityMetadata method is a method to return the metadata for a certain entity by the specified entity filters
    • New Function - XrmServiceToolkit.Soap.RetrieveAttributeMetadata method is a method to return the metadata for a certain entity's attribute

Updated Wiki: Documentation

$
0
0

XrmServiceToolkit is a JavaScript library which could be used to make

  • Common Methods: Change of CRM form like enable field, show field, etc
  • Rest EndPoint Methods: Create, Retrieve, Update a record, etc
  • Soap Request Methods: Create, Retrieve, Update a record, etc
  • Extension Methods: Setup Dependent OptionSet, Add Tooltip to fields, Add custom filter view to lookup field. All these methods are generic to use and configurable through editing of XML web resource.

Debug / Unit Test JavaScript Rest or Soap in Visual Studio For CRM 2011

Project Highlight and Notes: Current Release - Version 1.4.1 (April, 2013)

New year has always been very busy for lots of people. There is no doubt for us, MSCRM consultants...

Last week, i got an email from Microsoft CRM team to notice me that my personal CRM online subscription will be updated to Rollup 12 which was exciting news because i finally have an environment to test and develop XrmServiceToolkit and make an effort to support cross browser.

The upgrade obviously is a big deal for everyone. There are some immediate problems which i have seen for the toolkit after my instance is running RU12.

Version 1.4.0 is far from perfect at its current stage to support cross browser cause there are so many things to do and so much testing to be done. A quick summary for version 1.4.0 if you are keen.

* @current version : 1.4 (beta)

* Date: January, 2013

* Dependency: JSON2, jQuery (latest or 1.7.2 above)

* Feature: Add Cross Browser Support for RU12

* Tested Platform: IE9, IE10, Chrome Version 24.0.1312.56 m, Firefox 18.0.1

If you have used the toolkit previously for your project, thanks very much for your support. For version 1.4.0, download and try it out using atesting environment and let me know issues and bugs.

Happy Coding,
Jaimie 

For examples with qunit, please follow the links

 Whats new:

  • Version: 1.4.0
  • Dependency: JSON2, jQuery 1.7.2 above
  • Date: January, 2013
    • New Feature: Add cross browser support for RU12
    • Tested Browser: IE9, IE10, Chrome Version 24.0.1312.56 m, Firefox 18.0.1
  • Version: 1.3.2
  • Dependency: JSON2, jQuery 1.7.2 above
  • Date: January, 2013
    • New Fix: Fix an issue that XrmServiceToolit.Soap is not initialized properly when calling from ribbon for CRM Online
    • Add more cross browser support before RU12
  • Version: 1.3.1
  • Dependency: JSON2, jQuery 1.7.2 above
  • Date: November, 2012
    • New Feature:
      • A logic change to improvie performance when retrieving larger number of records
    • New Function:
      • XrmServiceToolkit.Soap.QueryAll: a method to return all records (>5k+). Similar to how to use XrmServiceToolkit.Soap.QueryByAttribute
    • New Fix:
      • XrmServiceToolkit.Rest.RetrieveMultiple not returning more than 50 records
      • XrmServiceToolkit.Soap.BusinessEntity not working properly with number attribute like int, double, decimal
      • XrmServiceToolkit.Soap not handling error message properly.
  • Version: 1.3
    • Dependency: JSON2, jQuery 1.7.2 above
    • Date: July, 2012
    • New Feature:
      • jQuery integration
      • Cross Browser support. More testings are required
    • New Category and Extension:
      • jQueryXrmDependentOptionSet: A generic configurable method to setup dependent option set in CRM 2011
      • jQueryXrmFieldTooltip: A generic configurable method to setup tooltip for crm fields
      • jQueryXrmLookupCustomFilterView: A generic configurable method to add custom filter view to crm lookup field 
  • Version: 1.2
    • Dependency: JSON2
    • Date: May, 2012
    • New Fix - Create, Update, Retrieve activity with PartyList type [From, To, Cc, Bcc]
  • Version: 1.1
    • Depdendency: JSON2
    • Date: April, 2012
    • New Function - XrmServiceToolkit.Soap.Assign
    • New Function - XrmServiceToolkit.Soap.GrantAccess
    • New Function - XrmServiceToolkit.Soap.ModifyAccess
    • New Function - XrmServiceToolkit.Soap.RevokeAccess
    • New Function - XrmServiceToolkit.Soap.RetrievePrincipalAccess

Cross Browser Support

There is still a long way to go until calling the library to support real cross browser. As downloaded from Microsoft website, CRM 2011 code validation tool is used during the upgrade process. Though testings are insufficient with real or RC environment of CRM 2011 RU9 o_0!

Code Validation

Qunit Refresh and Test Results

Qunit plays a big part during the development and continous development for this project.[NOTE] Qunit is for unit testing. You do not need the part of the code in live code

Qunit test result

Code Examples in the documentation.

All code examples or most of them are using in combination with Qunit. The qunit part of the code is not required in real life situation.

Synchronous and Asynchronous

The basics of synchronous and asynchronous calls are still the same without jQuery. As the reason not too sure yet , jQuery 1.8 will not support ajax asynch=false anymore. However in reality, there will be still usage, for example onSave, synchronous calls might still required. For best practise, asynchronous calls should be used for better performance.

XrmServiceToolkit.Rest funcitons use the last boolean parameter to indicate if the method runs asychronously or synchronously. If false is assigned, then the method will run synchronously, otherwise an asynchrounous method will be called.

 

var contact = {};
contact.FirstName = "Diane";
contact.LastName = "Morgan";
contact.MiddleName = "<&>";
contact.GenderCode = { Value: 2 };
contact.CreditLimit = { Value: "2.00" };
contact.BirthDate = birthDate;
contact.DoNotEMail = true;
contact.DoNotPhone = true;

XrmServiceToolkit.Rest.Create(
	contact,
	"ContactSet",function (result) {
		contactId = result.ContactId;
	},function (error) {
		alert(error.message);
	},false //synchronous call
); 
var contact = {};
contact.FirstName = "Diane";
contact.LastName = "Morgan";
contact.MiddleName = "<&>";
contact.GenderCode = { Value: 2 };
contact.CreditLimit = { Value: "2.00" };
contact.BirthDate = birthDate;
contact.DoNotEMail = true;
contact.DoNotPhone = true;

XrmServiceToolkit.Rest.Create(
	contact,
	"ContactSet",function (result) {
		contactId = result.ContactId;
	},function (error) {
		alert(error.message);
	},true //asynchronous call
);

 

XrmServiceTookit.Soap functions using the last function parameter to indicate if the method runs asychronously or synchronously. If the funciton is defined, the method will run asychronously. Otherwise, the method will be called synchronously.

var cols = ["firstname", "lastname", "middlename", "familystatuscode", "ownerid", "creditlimit", "birthdate", "donotemail", "donotphone"];var retrievedContact = XrmServiceToolkit.Soap.Retrieve("contact", contactId, cols); //synchronous callvar familyStatusLable = retrievedContact.attributes['familystatuscode'].formattedValue;var firstName = retrievedContact.attributes['firstname'].value;
var cols = ["firstname", "lastname", "middlename", "familystatuscode", "ownerid", "creditlimit", "birthdate", "donotemail", "donotphone"];
XrmServiceToolkit.Soap.Retrieve("contact", contactId, cols, function(result){    var familyStatusLable = result.attributes['familystatuscode'].formattedValue;	    var firstName = result.attributes['firstname'].value;
}); //asychronous call

Numbers

CRM 2011 has number like whole number (int), floating point (double) and Decimal number (decimal), Currency (Money).

When using the soap funcitons in the library, it is recommended to include type when assigning values. It is more likely to cause issue for fields like decimal or double

//overcome limitations of numbers with type specified.... 
createContact.attributes["numberofchildren"] = { value: 2, type: "int"}; 

createContact.attributes["exchangerate"] = {value: 1.5617, type: "decimal"}; 

createContact.attributes["address1_latitude"] = { value: 1.5617, type: "double" }; 

createContact.attributes["creditlimit"] = { value: 2, type: "Money" }; 

FormattedValue

The XrmServiceToolkit.Soap functions have an extra attribute returned as formattedValue. It could be very useful if you want to return some extra information. For example, to get the lable of OptionSet. The example is synchrous.

var cols = ["firstname", "lastname", "middlename", "familystatuscode", "ownerid", "creditlimit", "birthdate", "donotemail", "donotphone"];var retrievedContact = XrmServiceToolkit.Soap.Retrieve("contact", contactId, cols);var familyStatusLable = retrievedContact.attributes['familystatuscode'].formattedValue;//labelvar familyStatusValue = retrievedContact.attributes['familystatuscode'].value; //integer

An example to create email activity using the library.

test("Test XrmServiceToolkit.Soap.Create() method to create a email activity (email)", function () {var createEmail = new XrmServiceToolkit.Soap.BusinessEntity("email");
    createEmail.attributes["subject"] = "Test Email subject";
    createEmail.attributes["description"] = "This email was created by the XrmServiceToolkit.Soap.Create() sample.";var from = [
       { id: whoamiUserId, logicalName: "systemuser", type: "EntityReference" }
    ];

    createEmail.attributes["from"] = { value: from, type: "EntityCollection" };var to = [
       { id: accountId, logicalName: "account", type: "EntityReference" },
       { id: contactId, logicalName: "contact", type: "EntityReference" }
    ];

    createEmail.attributes["to"] = { value: to, type: "EntityCollection" };var cc = [
       { id: accountId, logicalName: "account", type: "EntityReference" },
       { id: contactId, logicalName: "contact", type: "EntityReference" }
    ];

    createEmail.attributes["cc"] = { value: cc, type: "EntityCollection" };var bcc = [
       { id: accountId, logicalName: "account", type: "EntityReference" },
       { id: contactId, logicalName: "contact", type: "EntityReference" }
    ];

    createEmail.attributes["bcc"] = { value: bcc, type: "EntityCollection" };

    createEmail.attributes["directioncode"] = true;

    emailId = XrmServiceToolkit.Soap.Create(createEmail);

    ok(guidExpr.test(emailId), "Creating an email should returned the new record's ID in GUID format. ");
  });

An example to retrieve an email is like this. The returned value of [From/To/Cc/Bcc] is an array of Entity reference.

 

 test("Test XrmServiceToolkit.Soap.Retrieve() method to retrieve a CRM record (email)", function () {var cols = ["subject", "description", "from", "to", "cc", "bcc", "directioncode"];var retrievedEmail = XrmServiceToolkit.Soap.Retrieve("email", emailId, cols);

    equals(retrievedEmail.attributes['subject'].value, "Test Email subject", "Subject matches");
    equals(retrievedEmail.attributes['description'].value, "This email was created by the XrmServiceToolkit.Soap.Create() sample.", "Description Matches");
    equals(retrievedEmail.attributes['from'].type, "EntityCollection", "CRM partylist type should be EntityCollection");
    equals(retrievedEmail.attributes['to'].type, "EntityCollection", "CRM partylist type should be EntityCollection"); ;
    equals(retrievedEmail.attributes['cc'].type, "EntityCollection", "CRM partylist type should be EntityCollection");
    equals(retrievedEmail.attributes['bcc'].type, "EntityCollection", "CRM partylist type should be EntityCollection");
    equals(retrievedEmail.attributes['directioncode'].type, "boolean", "CRM boolean type should be boolean");
 });

To get the value of an array item of the returned result. Using something like

var sender = retrievedEmail.attributes['from'].value[0];

Then you can get sender.id, sender.type, sender.logicalName, sender.Name per normal as a returned EntityReference value.

An example to use the GrantAccess is like this. For all other examples, please have a look at the attached aspx page.

  test("Test XrmServiceToolkit.Soap.GrantAccess() method to grant a user access to a CRM record (contact)", function () {var accessOptions = {
         targetEntityName: "contact",
         targetEntityId: contactId,
         principalEntityName: "systemuser",
         principalEntityId: currentUserId,
         accessRights: ["ReadAccess", "WriteAccess"]
     };var grantAccessResponse = XrmServiceToolkit.Soap.GrantAccess(accessOptions);
        ok(grantAccessResponse == "GrantAccess", "The current user should have the listed access to the contact");

     });

[NOTE] These functions regarding access should be combined with CRM 2011 security model and they could be useful if entities have to be controlled at record level. This obviously has to be used with consideration of user rights, security settings and all other security related configurations as the requirement of the project.

For details about how to use all these methods and updated examples. See attached .aspx page for examples.

Credi: The code example is based on Daniel Cai's CrmWebServiceKit.

XrmServiceToolkitTest.zip

Dependency

JSON2 javascript library is required in CRM 2011 as a web resource to make the library working.

jQuery 1.7.2 above is required from version 1.3

To Unit Test your code at local machine.

There is a way to test all your Rest / Soap calls directy from your development machine without modifying the library which is achieved by using the XrmPageTemplate.js and PageData.js. For details about how to using JavaScript Intellisense, please have a look at this wonderful blog

http://crmbusiness.wordpress.com/2011/12/01/crm-2011-using-javascript-intellisense-and-testpage-htm/

Once you have got the PageData.js generated from any entity, simply put it in the helper folder to replace the existing PageData.js in the source code project which you could download from the [Source Code] section here.

Now you could run and debug the XrmServiceToolkitTest.aspx from your visual studio.

Happy Coding,

Jaimie

Updated Wiki: Documentation

$
0
0

XrmServiceToolkit is a JavaScript library which could be used to make

  • Common Methods: Change of CRM form like enable field, show field, etc
  • Rest EndPoint Methods: Create, Retrieve, Update a record, etc
  • Soap Request Methods: Create, Retrieve, Update a record, etc
  • Extension Methods: Setup Dependent OptionSet, Add Tooltip to fields, Add custom filter view to lookup field. All these methods are generic to use and configurable through editing of XML web resource.

Debug / Unit Test JavaScript Rest or Soap in Visual Studio For CRM 2011

Project Highlight and Notes: Current Release - Version 1.4.1 (April, 2013)

New year has always been very busy for lots of people. There is no doubt for us, MSCRM consultants...

Last week, i got an email from Microsoft CRM team to notice me that my personal CRM online subscription will be updated to Rollup 12 which was exciting news because i finally have an environment to test and develop XrmServiceToolkit and make an effort to support cross browser.

The upgrade obviously is a big deal for everyone. There are some immediate problems which i have seen for the toolkit after my instance is running RU12.

Version 1.4.0 is far from perfect at its current stage to support cross browser cause there are so many things to do and so much testing to be done. A quick summary for version 1.4.0 if you are keen.

* @current version : 1.4.1

* Date: April, 2013

* Dependency: JSON2, jQuery (latest or 1.7.2 above)

* Feature: Add Cross Browser Support for RU12, RU13

* Tested Platform: IE9, IE10, Chrome Version (latest), Firefox (latest)

If you have used the toolkit previously for your project, thanks very much for your support. For version 1.4.1, download and try it out using atesting environment and let me know issues and bugs.

Happy Coding,
Jaimie 

For examples with qunit, please follow the links

 Whats new:

  • Version: 1.4.0
  • Dependency: JSON2, jQuery 1.7.2 above
  • Date: January, 2013
    • New Feature: Add cross browser support for RU12
    • Tested Browser: IE9, IE10, Chrome Version 24.0.1312.56 m, Firefox 18.0.1
  • Version: 1.3.2
  • Dependency: JSON2, jQuery 1.7.2 above
  • Date: January, 2013
    • New Fix: Fix an issue that XrmServiceToolit.Soap is not initialized properly when calling from ribbon for CRM Online
    • Add more cross browser support before RU12
  • Version: 1.3.1
  • Dependency: JSON2, jQuery 1.7.2 above
  • Date: November, 2012
    • New Feature:
      • A logic change to improvie performance when retrieving larger number of records
    • New Function:
      • XrmServiceToolkit.Soap.QueryAll: a method to return all records (>5k+). Similar to how to use XrmServiceToolkit.Soap.QueryByAttribute
    • New Fix:
      • XrmServiceToolkit.Rest.RetrieveMultiple not returning more than 50 records
      • XrmServiceToolkit.Soap.BusinessEntity not working properly with number attribute like int, double, decimal
      • XrmServiceToolkit.Soap not handling error message properly.
  • Version: 1.3
    • Dependency: JSON2, jQuery 1.7.2 above
    • Date: July, 2012
    • New Feature:
      • jQuery integration
      • Cross Browser support. More testings are required
    • New Category and Extension:
      • jQueryXrmDependentOptionSet: A generic configurable method to setup dependent option set in CRM 2011
      • jQueryXrmFieldTooltip: A generic configurable method to setup tooltip for crm fields
      • jQueryXrmLookupCustomFilterView: A generic configurable method to add custom filter view to crm lookup field 
  • Version: 1.2
    • Dependency: JSON2
    • Date: May, 2012
    • New Fix - Create, Update, Retrieve activity with PartyList type [From, To, Cc, Bcc]
  • Version: 1.1
    • Depdendency: JSON2
    • Date: April, 2012
    • New Function - XrmServiceToolkit.Soap.Assign
    • New Function - XrmServiceToolkit.Soap.GrantAccess
    • New Function - XrmServiceToolkit.Soap.ModifyAccess
    • New Function - XrmServiceToolkit.Soap.RevokeAccess
    • New Function - XrmServiceToolkit.Soap.RetrievePrincipalAccess

Cross Browser Support

There is still a long way to go until calling the library to support real cross browser. As downloaded from Microsoft website, CRM 2011 code validation tool is used during the upgrade process. Though testings are insufficient with real or RC environment of CRM 2011 RU9 o_0!

Code Validation

Qunit Refresh and Test Results

Qunit plays a big part during the development and continous development for this project.[NOTE] Qunit is for unit testing. You do not need the part of the code in live code

Qunit test result

Code Examples in the documentation.

All code examples or most of them are using in combination with Qunit. The qunit part of the code is not required in real life situation.

Synchronous and Asynchronous

The basics of synchronous and asynchronous calls are still the same without jQuery. As the reason not too sure yet , jQuery 1.8 will not support ajax asynch=false anymore. However in reality, there will be still usage, for example onSave, synchronous calls might still required. For best practise, asynchronous calls should be used for better performance.

XrmServiceToolkit.Rest funcitons use the last boolean parameter to indicate if the method runs asychronously or synchronously. If false is assigned, then the method will run synchronously, otherwise an asynchrounous method will be called.

 

var contact = {};
contact.FirstName = "Diane";
contact.LastName = "Morgan";
contact.MiddleName = "<&>";
contact.GenderCode = { Value: 2 };
contact.CreditLimit = { Value: "2.00" };
contact.BirthDate = birthDate;
contact.DoNotEMail = true;
contact.DoNotPhone = true;

XrmServiceToolkit.Rest.Create(
	contact,
	"ContactSet",function (result) {
		contactId = result.ContactId;
	},function (error) {
		alert(error.message);
	},false //synchronous call
); 
var contact = {};
contact.FirstName = "Diane";
contact.LastName = "Morgan";
contact.MiddleName = "<&>";
contact.GenderCode = { Value: 2 };
contact.CreditLimit = { Value: "2.00" };
contact.BirthDate = birthDate;
contact.DoNotEMail = true;
contact.DoNotPhone = true;

XrmServiceToolkit.Rest.Create(
	contact,
	"ContactSet",function (result) {
		contactId = result.ContactId;
	},function (error) {
		alert(error.message);
	},true //asynchronous call
);

 

XrmServiceTookit.Soap functions using the last function parameter to indicate if the method runs asychronously or synchronously. If the funciton is defined, the method will run asychronously. Otherwise, the method will be called synchronously.

var cols = ["firstname", "lastname", "middlename", "familystatuscode", "ownerid", "creditlimit", "birthdate", "donotemail", "donotphone"];var retrievedContact = XrmServiceToolkit.Soap.Retrieve("contact", contactId, cols); //synchronous callvar familyStatusLable = retrievedContact.attributes['familystatuscode'].formattedValue;var firstName = retrievedContact.attributes['firstname'].value;
var cols = ["firstname", "lastname", "middlename", "familystatuscode", "ownerid", "creditlimit", "birthdate", "donotemail", "donotphone"];
XrmServiceToolkit.Soap.Retrieve("contact", contactId, cols, function(result){    var familyStatusLable = result.attributes['familystatuscode'].formattedValue;	    var firstName = result.attributes['firstname'].value;
}); //asychronous call

Numbers

CRM 2011 has number like whole number (int), floating point (double) and Decimal number (decimal), Currency (Money).

When using the soap funcitons in the library, it is recommended to include type when assigning values. It is more likely to cause issue for fields like decimal or double

//overcome limitations of numbers with type specified.... 
createContact.attributes["numberofchildren"] = { value: 2, type: "int"}; 

createContact.attributes["exchangerate"] = {value: 1.5617, type: "decimal"}; 

createContact.attributes["address1_latitude"] = { value: 1.5617, type: "double" }; 

createContact.attributes["creditlimit"] = { value: 2, type: "Money" }; 

FormattedValue

The XrmServiceToolkit.Soap functions have an extra attribute returned as formattedValue. It could be very useful if you want to return some extra information. For example, to get the lable of OptionSet. The example is synchrous.

var cols = ["firstname", "lastname", "middlename", "familystatuscode", "ownerid", "creditlimit", "birthdate", "donotemail", "donotphone"];var retrievedContact = XrmServiceToolkit.Soap.Retrieve("contact", contactId, cols);var familyStatusLable = retrievedContact.attributes['familystatuscode'].formattedValue;//labelvar familyStatusValue = retrievedContact.attributes['familystatuscode'].value; //integer

An example to create email activity using the library.

test("Test XrmServiceToolkit.Soap.Create() method to create a email activity (email)", function () {var createEmail = new XrmServiceToolkit.Soap.BusinessEntity("email");
    createEmail.attributes["subject"] = "Test Email subject";
    createEmail.attributes["description"] = "This email was created by the XrmServiceToolkit.Soap.Create() sample.";var from = [
       { id: whoamiUserId, logicalName: "systemuser", type: "EntityReference" }
    ];

    createEmail.attributes["from"] = { value: from, type: "EntityCollection" };var to = [
       { id: accountId, logicalName: "account", type: "EntityReference" },
       { id: contactId, logicalName: "contact", type: "EntityReference" }
    ];

    createEmail.attributes["to"] = { value: to, type: "EntityCollection" };var cc = [
       { id: accountId, logicalName: "account", type: "EntityReference" },
       { id: contactId, logicalName: "contact", type: "EntityReference" }
    ];

    createEmail.attributes["cc"] = { value: cc, type: "EntityCollection" };var bcc = [
       { id: accountId, logicalName: "account", type: "EntityReference" },
       { id: contactId, logicalName: "contact", type: "EntityReference" }
    ];

    createEmail.attributes["bcc"] = { value: bcc, type: "EntityCollection" };

    createEmail.attributes["directioncode"] = true;

    emailId = XrmServiceToolkit.Soap.Create(createEmail);

    ok(guidExpr.test(emailId), "Creating an email should returned the new record's ID in GUID format. ");
  });

An example to retrieve an email is like this. The returned value of [From/To/Cc/Bcc] is an array of Entity reference.

 

 test("Test XrmServiceToolkit.Soap.Retrieve() method to retrieve a CRM record (email)", function () {var cols = ["subject", "description", "from", "to", "cc", "bcc", "directioncode"];var retrievedEmail = XrmServiceToolkit.Soap.Retrieve("email", emailId, cols);

    equals(retrievedEmail.attributes['subject'].value, "Test Email subject", "Subject matches");
    equals(retrievedEmail.attributes['description'].value, "This email was created by the XrmServiceToolkit.Soap.Create() sample.", "Description Matches");
    equals(retrievedEmail.attributes['from'].type, "EntityCollection", "CRM partylist type should be EntityCollection");
    equals(retrievedEmail.attributes['to'].type, "EntityCollection", "CRM partylist type should be EntityCollection"); ;
    equals(retrievedEmail.attributes['cc'].type, "EntityCollection", "CRM partylist type should be EntityCollection");
    equals(retrievedEmail.attributes['bcc'].type, "EntityCollection", "CRM partylist type should be EntityCollection");
    equals(retrievedEmail.attributes['directioncode'].type, "boolean", "CRM boolean type should be boolean");
 });

To get the value of an array item of the returned result. Using something like

var sender = retrievedEmail.attributes['from'].value[0];

Then you can get sender.id, sender.type, sender.logicalName, sender.Name per normal as a returned EntityReference value.

An example to use the GrantAccess is like this. For all other examples, please have a look at the attached aspx page.

  test("Test XrmServiceToolkit.Soap.GrantAccess() method to grant a user access to a CRM record (contact)", function () {var accessOptions = {
         targetEntityName: "contact",
         targetEntityId: contactId,
         principalEntityName: "systemuser",
         principalEntityId: currentUserId,
         accessRights: ["ReadAccess", "WriteAccess"]
     };var grantAccessResponse = XrmServiceToolkit.Soap.GrantAccess(accessOptions);
        ok(grantAccessResponse == "GrantAccess", "The current user should have the listed access to the contact");

     });

[NOTE] These functions regarding access should be combined with CRM 2011 security model and they could be useful if entities have to be controlled at record level. This obviously has to be used with consideration of user rights, security settings and all other security related configurations as the requirement of the project.

For details about how to use all these methods and updated examples. See attached .aspx page for examples.

Credi: The code example is based on Daniel Cai's CrmWebServiceKit.

XrmServiceToolkitTest.zip

Dependency

JSON2 javascript library is required in CRM 2011 as a web resource to make the library working.

jQuery 1.7.2 above is required from version 1.3

To Unit Test your code at local machine.

There is a way to test all your Rest / Soap calls directy from your development machine without modifying the library which is achieved by using the XrmPageTemplate.js and PageData.js. For details about how to using JavaScript Intellisense, please have a look at this wonderful blog

http://crmbusiness.wordpress.com/2011/12/01/crm-2011-using-javascript-intellisense-and-testpage-htm/

Once you have got the PageData.js generated from any entity, simply put it in the helper folder to replace the existing PageData.js in the source code project which you could download from the [Source Code] section here.

Now you could run and debug the XrmServiceToolkitTest.aspx from your visual studio.

Happy Coding,

Jaimie


Updated Wiki: Home

$
0
0

Project Description

XrmServiceToolkit is a JavaScript library which can be used for JavaScript Development under the platform forMicrosoft Dynamics CRM 2011 environments. The library contains four major parts regarding functions.

  • Common: General Methods used for various purpose.
  • Rest: Organization Data Service functions including CRUD, Associate, Disassociate, etc
  • Soap: Organization Service functions including CRUD, Fetch, Associate, Disassociate, etc
  • Extension: jQuery extension to utilize WebResource to extend CRM 2011 including dependent OptionSet, field tooltip, add custom filter view to lookup field. (Some Methods 'Unsupported')

Debug / Unit Test JavaScript Rest or Soap in Visual Studio For CRM 2011

* Whats new:

  • Version 1.4.1
  • Dependency: JSON2, jQuery 1.7.2 above
  • Date: April, 2013
    • New Feature: Add more cross browser support for RU12, RU13
    • Tested Browser: IE9, IE10, Chrome (latest), Firefox (latest)
    • New Fix: XrmServiceToolkit.Common.AddNotification method updated for RU12, RU13, still compatible for RU11 below
    • New Fix: XrmServiceToolkit.Soap.Fetch method did not format linked record correctly
    • New Fix: XrmServiceToolkit.Soap.Retrieve method did not return partylist data for activity
    • New Fix: Added manual conversion from String to Date conversion for cross browser
    • New Fix: getServerUrl method is updated as getClientUrl to align with RU12 SDK method getClientUrl(), still compatible to support RU11 below
    • New Function: getServerUrl private method is updated as getClientUrl to align with RU12 SDK method getClientUrl(), still compatible to support RU11 below
    • New Function: XrmServiceToolkit.Soap.RetrieveAllEntitiesMetadata method is a method to return all metadata for all entities by the specified entity filters
    • New Function: XrmServiceToolkit.Soap.RetrieveEntityMetadata method is a method to return the metadata for a certain entity by the specified entity filters
    • New Function: XrmServiceToolkit.Soap.RetrieveAttributeMetadata method is a method to return the metadata for a certain entity's attribute
  • Version: 1.4.0
  • Dependency: JSON2, jQuery 1.7.2 above
  • Date: January, 2013
    • New Feature: Add more cross browser support for RU12
    • Tested Browser: IE9, IE10, Chrome Version 24.0.1312.56 m, Firefox 18.0.1
  • Version: 1.3.2
  • Dependency: JSON2, jQuery 1.7.2 above
  • Date: January, 2013
    • New Fix: An issue where XrmServiceToolkit.Soap could not be initialized properly when calling from Ribbon for CRM Online
    • Add more cross browser support for coming RU12
  • Version: 1.3.1
  • Dependency: JSON2, jQuery 1.7.2 above
  • Date: November, 2012
    • New Feature:
      • A logic change to improvie performance when retrieving larger number of records
    • New Function:
      • XrmServiceToolkit.Soap.QueryAll: a method to return all records (>5k+). Similar to how to use XrmServiceToolkit.Soap.QueryByAttribute
    • New Fix:
      • XrmServiceToolkit.Rest.RetrieveMultiple not returning more than 50 records
      • XrmServiceToolkit.Soap.BusinessEntity not working properly with number attribute like int, double, decimal
      • XrmServiceToolkit.Soap not handling error message properly.
  • Version: 1.3
  • Dependency: JSON2, jQuery 1.7.2 above
  • Date: July, 2012
    • New Feature
      • Integration with jQuery
      • Cross Browser support (TODO: Testings for real 'cross-browser' support. Long Story)
    • New Extension:
      • JQueryXrmDependentOptionSet: Create Configurable Dependent Option Set to utilize CRM 2011 web resource.
      • JQueryXrmFieldTooltip: Create configurable tooltip for fields on CRM 2011 form
      • JQueryXrmCustomFilterView: Create configurable resource to add custom filter view to crm 2011 lookup field on the form
      • JQueryXrmFormatNotesControl: Format the notes control to allow insert, allow edit
  • Version: 1.2
  • Dependency: JSON2
  • Date: May, 2012
    • New Fix - Create, Update, Retrieve activity with Party List Type. See documentation and test page for details
  • Version: 1.1
  • Dependency: JSON2
  • Date: April, 2012
    • New Function - XrmServiceToolkit.Soap.Assign
    • New Function - XrmServiceToolkit.Soap.GrantAccess
    • New Function - XrmServiceToolkit.Soap.ModifyAccess
    • New Function - XrmServiceToolkit.Soap.RevokeAccess
    • New Function - XrmServiceToolkit.Soap.RetrievePrincipalAccess

 * Whats coming:

In the coming version (maybe 1.5), i would like to introduce two major changes which align with the roadmap of Microsoft CRM 2011 release notes. As i do not have access to any early beta to develop, test and debug for these changes. I would hope that i could catch up with the release sooner as i can.

  • Finalize Cross-Browser Support.
  • Tune performance

If you have suggestions, please also let me know.

[Credits and Licenses]

  • MSCRM 2011 Web Service Toolkit for JavaScript
    • @author Jaimie Ji
  • Credits:
    • The idea of this library was inspired by Daniel Cai's CrmWebServiceToolkit.
    • The idea of this Qunit testing was inspired by Daniel Cai's CrmWebServiceToolkit.
    • The idea of BusinessEntity was inspired by Daniel Cai && Ascentium CrmService JavaScript Library.
    • The REST Endpoint functions were inspired by MSCRM 2011 SDK javascript code and various resources from CRM websites and forums. Some of them were just copies with minor modification.
    • The Soap functions were inspired by Daniel Cai && Jamie Miley && Paul Way && Customer Effective.
    • Additional thanks to all contributors of MSCRM and i have learned a lot from you all.
  • Date: February, 2012

[Speical Thanks]

Thanks very much for JetBrains to provide me a free ReSharper open license for this project.

Features

  • Extension methods for common operations.
  • Support forsynchronous/asynchronouscall
  • Support for all models of Microsoft CRM 2011 (AD/IFD/CRM Online).
  • Lightweight and Simplicity - gives direct access to the Organization Data Service and Organization Service without having to generate SOAP request each time.

Common Functions

  • EnableField: A JavaScript Function to enable a crm field
  • DisableField: A JavaScript Functionto disable a crm field
  • ShowField: A JavaScript Functionto show a crm field
  • HideField: A JavaScript Functionto hide a crm field
  • UpdateRequiredLevel: A JavaScript Function to update the required level a crm field
  • GetObjectTypeCode: A JavaScript Function to get the object type code of a entity
  • CalculateDaysBetween: A JavaScript Function to calcuate days between two dates
  • AddNotification: A JavaScript Function to add a crm2011-like notification message on top of a form
  • ShowError: A JavaScript Function to show a alert of a error message
  • GuidsAreEqual : A JavaScript Function to check if two guids are the same
  • DisableAllControlsInTab : A JavaScript Function to disable all controls in a tab by tab number
  • DisableAllControlsInSection : A JavaScript Function to disable all controls in a section label

Rest Functions

  • Create: A JavaScript Fuction to perform a create Rest Endpoint request 
  • Retrieve: A JavaScript Fuction to perform a retrieve Rest Endpoint request
  • Update: A JavaScript Fuction to perform a update Rest Endpoint request
  • Delete: A JavaScript Fuction to perform a delete Rest Endpoint request
  • RetrieveMultiple: A JavaScript Fuction to perform a retrieveMultiple Rest Endpoint request
  • Associate: A JavaScript Fuction to perform a associate Rest Endpoint request
  • Disassociate: A JavaScript Fuction to perform a disassociate Rest Endpoint request

Soap Functions

  • Busines Entity: A JavaScript Object represents a business entity of CRM 2011
  • Execute: A JavaScript Function to perform a execute soap request
  • Fetch: A JavaScript Function to perform a fetch soap request
  • Retrieve: A JavaScript Function to perform a retrieve soap request
  • RetrieveMultiple: A JavaScript Function to perform a retrieve multiple soap request
  • Create: A JavaScript Function to perform a create soap request
  • Update: A JavaScript Function to perform a update soap request
  • Delete: A JavaScript Function to perform a delete soap request
  • QueryByAttribute: A JavaScript Function to perform a query by attribute soap request
  • QueryAll: A JavaScript Function to perform a query all soap request to return all records (>5k+)
  • SetState: A JavaScript Function to perform a set state soap request
  • Associate: A JavaScript Function to perform a associate soap request
  • Assign: A JavaScript Function to perform a assign soap request
  • RetrievePrincipalAccess: A JavaScript Function to perform a retrieve principal access soap request
  • GrantAccess: A JavaScript Function to perform a grant access soap request
  • ModifyAccess: A JavaScript Function to perform a modify access soap request
  • RevokeAccess: A JavaScript Function to perform a revoke access soap request
  • GetCurrentUserId : A JavaScript Function to get the id of the current user
  • GetCurrentUserBusinessUnitId : A JavaScript Function to get the business unit id of the current user
  • GetCurrentUserRoles : A JavaScript Function to get the list of the current user roles
  • IsCurrentUserRole : A JavaScript Function to check if the current user has certains roles
  • RetrieveAllEntitiesMetadata: A JavaScript Function to retrieve all entities' metadata according to the expected EntityFilter
  • RetrieveEntityMetadata: A JavaScript Function to retrieve one entity's metadata according to the expected entity name and EntityFilter
  • RetrieveAttributeMetadata: A JavaScript Function to retrieve one attribute's metadata according to the entity name and attribute name

Extension Functions

  • JQueryXrmDependentOptionSet: Create Configurable Dependent Option Set to utilize CRM 2011 web resource.
  • JQueryXrmFieldTooltip: Create configurable tooltip for fields on CRM 2011 form
  • JQueryXrmCustomFilterView: Create configurable ability to add custom filter view to crm 2011 lookup field on the form
  • JQueryXrmFormatNotesControl: Format the notes control to allow insert, allow edit

Commented Issue: Soap.Execute issue with selectsinglenode [1246]

$
0
0
This worked prior to UR 12.

Console error from developertoolkit reveals

"SCRIPT438: Object doesn't support property or method 'selectSingleNode' ".

Code snippet (error is on response.selectSingleNode - see below)

```
function executeWorkflow(entityId, workflowId, successCallback, errorCallback) {
var requestMain = ""
requestMain += " <request i:type=\"b:ExecuteWorkflowRequest\" 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>EntityId</c:key>";
requestMain += " <c:value i:type=\"d:guid\" xmlns:d=\"http://schemas.microsoft.com/2003/10/Serialization/\">" + entityId + "</c:value>";
requestMain += " </a:KeyValuePairOfstringanyType>";
requestMain += " <a:KeyValuePairOfstringanyType>";
requestMain += " <c:key>WorkflowId</c:key>";
requestMain += " <c:value i:type=\"d:guid\" xmlns:d=\"http://schemas.microsoft.com/2003/10/Serialization/\">" + workflowId + "</c:value>";
requestMain += " </a:KeyValuePairOfstringanyType>";
requestMain += " </a:Parameters>";
requestMain += " <a:RequestId i:nil=\"true\" />";
requestMain += " <a:RequestName>ExecuteWorkflow</a:RequestName>";
requestMain += " </request>";

// Execute it
var response = XrmServiceToolkit.Soap.Execute(requestMain, function (response) {
var workflowId = response.selectSingleNode('//a:KeyValuePairOfstringanyType[c:key=\'Id\']/c:value').nodeTypedValue;
successCallback(workflowId);
}, errorCallback);
}
```
Comments: ** Comment from web user: mtnmuncher **

I acknowledge that the issue with selectsinglenode is not in the library's code. However, the root of the problem, at least in my case, is that the library's method, xmlparser, is not working properly.

As I mentioned in my previous message, I was using IE 9, and yet the code resolved "if (window.DOMParser) {" to true. The consequence is that it tries to use DOMParser. From IE 9 , the call to " xmlDoc = parser.parseFromString(txt, "text/xml");" does not return any results.

If the aforementioned "if" condition worked properly, it would have resulted to 'false' and loaded "Microsoft.XMLDOM". Furthermore, the xmlparser had worked, then my calling code would have been able to use 'selectsinglenode'.

```
var xmlParser = function (txt) {
///<summary>
/// cross browser responseXml to return a XML object
///</summary>
var xmlDoc = null;
try {
// code for Mozilla, Firefox, Opera, etc.
if (window.DOMParser) {
// ReSharper disable InconsistentNaming
var parser = new DOMParser();
// ReSharper restore InconsistentNaming
xmlDoc = parser.parseFromString(txt, "text/xml");
}
else // Internet Explorer
{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = false;
xmlDoc.loadXML(txt);
}
} catch (e) {
alert("Cannot convert the XML string to a cross-browser XML object.");
}

return xmlDoc;
};

```

FWIW, my current workaround, from the SOAP execute method, skip the call to the XmlParser. Now, my calling code looks like this:

```
var response = XrmServiceToolkit.Soap.Execute(requestMain, function (response) {
var workflowId = $(response).find( "a\\:KeyValuePairOfstringanyType:first").find("c\\:value:first").text();
successCallback(workflowId);
}, errorCallback);

```

I believe this to be a bug in your latest version, 1.4.1.

Thanks for your patience.

Cheers.

Commented Issue: Soap.Execute issue with selectsinglenode [1246]

$
0
0
This worked prior to UR 12.

Console error from developertoolkit reveals

"SCRIPT438: Object doesn't support property or method 'selectSingleNode' ".

Code snippet (error is on response.selectSingleNode - see below)

```
function executeWorkflow(entityId, workflowId, successCallback, errorCallback) {
var requestMain = ""
requestMain += " <request i:type=\"b:ExecuteWorkflowRequest\" 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>EntityId</c:key>";
requestMain += " <c:value i:type=\"d:guid\" xmlns:d=\"http://schemas.microsoft.com/2003/10/Serialization/\">" + entityId + "</c:value>";
requestMain += " </a:KeyValuePairOfstringanyType>";
requestMain += " <a:KeyValuePairOfstringanyType>";
requestMain += " <c:key>WorkflowId</c:key>";
requestMain += " <c:value i:type=\"d:guid\" xmlns:d=\"http://schemas.microsoft.com/2003/10/Serialization/\">" + workflowId + "</c:value>";
requestMain += " </a:KeyValuePairOfstringanyType>";
requestMain += " </a:Parameters>";
requestMain += " <a:RequestId i:nil=\"true\" />";
requestMain += " <a:RequestName>ExecuteWorkflow</a:RequestName>";
requestMain += " </request>";

// Execute it
var response = XrmServiceToolkit.Soap.Execute(requestMain, function (response) {
var workflowId = response.selectSingleNode('//a:KeyValuePairOfstringanyType[c:key=\'Id\']/c:value').nodeTypedValue;
successCallback(workflowId);
}, errorCallback);
}
```
Comments: ** Comment from web user: jaimieji **

Hi There.

The second way is the correct method to consume response from SOAP. Please have a look at the other soap methods in the XrmServiceToolkit.cs (QueryByAttribute, QueryAll, Associate, etc), you will notice none of the methods use selectSingleNode

As far as I remember, DOMParser is supported since IE9, so that maybe the reason why your original code is not working.

Hope this helps.
Jaimie

New Post: Revised SOAP.queryAll and SOAP.fetchMore to allow sort order (asc or desc) parameter to be passed

$
0
0
I revised the SOAP.queryAll and SOAP.fetchMore methods to allow sort order (asc or desc) parameter to be passed. Below is the updated code for the queryAll method (the moreFetchXml var of the fetchMore method should mirror this as well):
var queryAll = function (queryOptions, callback) {
        ///<summary>
        /// Sends synchronous/asynchronous request to do a queryAll request. This is to return all records (>5k+).
        /// Consider Performance impact when using this method.
        ///</summary>
        ///<param name="queryOptions" type="Object">
        /// A JavaScript Object with properties corresponding to the queryByAttribute Criteria
        /// that are valid for queryByAttribute operations.
        /// queryOptions.entityName is a string represents the name of the entity
        /// queryOptions.attributes is a array represents the attributes of the entity to query
        /// queryOptions.values is a array represents the values of the attributes to query
        /// queryOptions.columnSet is a array represents the attributes of the entity to return
        /// queryOptions.orderBy is a array represents the order conditions of the results
        /// queryOptions.orderDescending is a boolean represents the sort order conditions of the results
        /// </param>
        ///<param name="callback" type="Function">
        /// A Function used for asynchronous request. If not defined, it sends a synchronous request.
        /// </param>
        var entityName = queryOptions.entityName;
        var attributes = queryOptions.attributes;
        var values = queryOptions.values;
        var columnSet = queryOptions.columnSet;
        var orderBy = queryOptions.orderBy || '';
        var orderDescending = queryOptions.orderDescending || '';

        attributes = isArray(attributes) ? attributes : [attributes];
        values = isArray(values) ? values : [values];
        orderBy = (!!orderBy && isArray(orderBy)) ? orderBy : [orderBy];
        orderDescending = (!!orderDescending && isArray(orderDescending)) ? orderDescending : [orderDescending];
        columnSet = (!!columnSet && isArray(columnSet)) ? columnSet : [columnSet];

        for (var i = 0; i < values.length; i++) {
            values[i] = encodeValue(values[i]);
        }

        var fetchXml =
                [
                    "<fetch mapping='logical'>",
                    "   <entity name='", entityName, "'>",
                           joinArray("<attribute name='", columnSet, "' />"),
                           joinArray("<order attribute='", orderBy, "'"),
                           joinArray(" descending='", orderDescending, "' />"),
                    "      <filter>",
                              joinConditionPair(attributes, values),
                    "      </filter>",
                    "   </entity>",
                    "</fetch>"
                ].join("");

        var msgBody = "<query i:type='a:FetchExpression' xmlns:a='http://schemas.microsoft.com/xrm/2011/Contracts'>" +
                            "<a:Query>" +
                                ((typeof window.CrmEncodeDecode != 'undefined') ? window.CrmEncodeDecode.CrmXmlEncode(fetchXml) : crmXmlEncode(fetchXml)) +
                            "</a:Query>" +
                        "</query>";
        var async = !!callback;

        return doRequest(msgBody, "RetrieveMultiple", !!callback, function (resultXml) {

            //Logic here is inspired by http://nishantrana.wordpress.com/2012/09/11/paging-cookie-is-required-when-trying-to-retrieve-a-set-of-records-on-any-high-pages-error-in-crm-2011/

            var fetchResult;
            var moreRecords;

            if ($(resultXml).find("a\\:Entities").length != 0) {
                fetchResult = $(resultXml).find("a\\:Entities").eq(0)[0];
            } else {
                fetchResult = $(resultXml).find("Entities").eq(0)[0]; //chrome
            }

            if ($(resultXml).find("a\\:MoreRecords").length != 0) {
                moreRecords = $(resultXml).find("a\\:MoreRecords").eq(0)[0].firstChild.text === "true";
            } else {
                moreRecords = $(resultXml).find("MoreRecords").eq(0)[0].firstChild.text === "true"; //chrome
            }

            var fetchResults = [];

            for (var ii = 0; ii < fetchResult.childNodes.length; ii++) {
                var entity = new businessEntity();

                entity.deserialize(fetchResult.childNodes[ii]);
                fetchResults.push(entity);
            }

            if (moreRecords) {
                var pageNumber = 2;
                var pageCookie;
                if ($(resultXml).find("a\\:PagingCookie").length != 0) {
                    pageCookie = $(resultXml).find("a\\:PagingCookie").eq(0)[0].firstChild.text.replace(/\"/g, '\'').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/'/g, '&quot;');
                } else {
                    pageCookie = $(resultXml).find("PagingCookie").eq(0)[0].firstChild.text.replace(/\"/g, '\'').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/'/g, '&quot;');
                }
                fetchMore(queryOptions, pageNumber, pageCookie, fetchResults);
            }

            if (!async)
                return fetchResults;
            else
                callback(fetchResults);
            // ReSharper disable NotAllPathsReturnValue
        });
    };

Created Issue: Object doesn't support property or method 'selectSingleNode' on Soap.Create [1262]

$
0
0
Getting " Object doesn't support property or method 'selectSingleNode' " script error while creating records using SOAP.Create() method.
This was working few weeks back and its become show stopper. Any fix/Workaround really help.
Viewing all 589 articles
Browse latest View live


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