Showing posts with label SDK. Show all posts
Showing posts with label SDK. Show all posts

Monday, September 18, 2017

RetrieveMultiple Using Newest Dynamics 365 SDK Gives Weird Behavior When Filtering on StateCode

Why in the world would it now be necessary to search using a conditionexpression on statecode by the strings "Active" or "Inactive"  instead of just taking the integer values of the optionset when performing a retrievemultiple request in a custom workflow activity.




 if (targetChildStateCode == 0)
                {
                    strTargetChildStateCode = "Active";
                }
                else if (targetChildStateCode == 1)
                {
                    strTargetChildStateCode = "Inactive";
                }
                int targetChildStatusReason = TargetChildStatusReason.Get(activityContext);
                tracingService.Trace("targetChildStateCode: " + targetChildStateCode.ToString());
                tracingService.Trace("targetChildStatusReason: " + targetChildStatusReason.ToString());
                tracingService.Trace("got parameters");
                tracingService.Trace("defined criteria and paging info");
               
                RetrieveMultipleRequest rmr = new RetrieveMultipleRequest();
                RetrieveMultipleResponse resp = new RetrieveMultipleResponse();
               
                QueryExpression query = new QueryExpression()
                {
                    EntityName = childEntityName,
                    ColumnSet = new ColumnSet(true),
                    Criteria = new FilterExpression
                    {
                        FilterOperator = LogicalOperator.And,
                        Conditions =
                        {
                            new ConditionExpression
                            {
                                AttributeName = childLookupAttributeToParent,
                                Operator = ConditionOperator.Equal,
                                Values = { primaryEntityId.ToString() }
                            },
                            new ConditionExpression
                            {
                                AttributeName = "statecode",
                                Operator = ConditionOperator.NotEqual,
                                Values = { strTargetChildStateCode }
                            }
                        }
                    }
                };
 


-head scratcher....

Tuesday, November 12, 2013

CRM 4.0 Event.mode Syntax Killed at Some Point in CRM 2011

Don't know why (or with what Update Rollup) event.Mode was removed, but in UR-15, event.Mode does not work as documented here:

http://msdn.microsoft.com/en-us/library/cc150868.aspx

It's alright though, in CRM 2011 they have a new construct documented here you can change your code to utilize.

http://msdn.microsoft.com/en-us/library/gg509060.aspx

Just  a quick tip for your Tuesday in case you install UR-15 and bump into this!

UPDATE:  It helps to understand how to pass the context as the first parameter as shown in the blogpost below, if you are having trouble after reading the documentation below, check this out:
http://rajeevpentyala.wordpress.com/2011/12/13/jscript-validation-on-activationdeactivation-of-record-in-crm-2011/

UPDATE 2:  It seems that this might only be a problem if using IE 10.  There are other CRM 4.0 syntax items that won't work properly for IE 10 that I bumped into also yesterday, but most things still work.


-

Friday, September 27, 2013

So... Just How Performant Can the CRM 2011 SDK Be?

David Evans replied to a different blog post of mine and pointed out that the product team has done a very large amount of work to make things work quicker through the CRM SDK and shared the video below.   I have heard David Cai tout how he has seen well over 200 rows per second in SSIS though his product.  I thought this was AMAZING considering I was used to Scribe and if I got 15 records per second I was pretty dang happy.  I could run more than one thread at once though if I could chunk up the job properly.

In the video below I was blown away.  Literally you will see using the maximum threads per second against CRM Online which hasn't always been known for being the most performant depending on where in the country you are accessing it from. You will see here shortly after 3:10 in the video where in a matter of seconds the process they run revs up to OVER 650 ROWS PER SECOND!  They are running 16 threads, but now I have a new appreciation for just what the SDK is capable of handling if you hit it just the right way.

Check out the video here and just skip to 3:10-ish to see them start running first with one thread and then with 16.  WOW!!!  http://player.vimeo.com/video/74729381

- I hope you enjoy this video!

-

Friday, September 6, 2013

Solid Reasons Not To Do Direct Database (T-SQL) Operations on Dynamics CRM Database From the Pros

I got an email this morning from an old college classmate of mine in kind of a exasperated tone with a one word subject "HELP!".  It turns out that she has fellow IT folks that want to replace some updates she is doing regularly using workflow that have worked fine for a long time with nightly T-SQL batch jobs pushing the data from their data warehouse back into CRM, even though it was already in CRM to begin with.

I decided to delve into this a bit to see what are the real reasons for why this shouldn't happen.  I knew some but I also asked some of my other MVP buddies to get their feedback.  Here is what I came up with.   Feel free to use these arguments if you need to explain to your IT department why manual database operations are a bad idea.

Jamie Miley 
  • If you are using Auditing in CRM, it won't reflect any changes done by manual database update.
  • Modified, by, modified on, etc... will also not be adjusted properly
  • PrincipleObjectAccess table will not be updated based on manual updates and so permissions will not be properly set on any inserted, updated, deleted records.
Scott Sewell
  •  Database updates to CRM, if you did updates to something that affects security (owner, business unit, etc...) no updates would occur to PrincipleObjectAccess table
  • Updating Name fields will cause issues because lookups tend to cache names

Damian Sinay:
  • Plugins and/or workflows won't fire
  • Also caching is an issue, any cached data won't be invalidated by a database operation.
Gustaf Westerlund
  • If you are not 110% sure what youa re doing you are risking the stability of the entire system.
Julie Yack
  • It’s bad karma to do unsupported stuffs when a supported way will do it.
Carston Groth
  • Relations might get lost if you´re only performing the action on one datebase table ignoring all related tables
Joel Lindstrom

  • Biggest reason is that it will appear to work initially but problems will crop up later and you won’t be able to connect the dots to the real issue because the issue won’t be caught by the normal error reporting mechanisms.
Example:

Customer manually loaded contact records and later couldn’t reassign them. Turned out to be because in their manual load they didn’t populate businessunitid. The contacts worked, but couldn’t be reassigned later because that field wasn’t populated, but the error message generated didn’t explain what the problem was, because records created in a supported way always have that field populated

Different customer manually overwrote the createdby and modifiedby using unsupported T-SQL. Records initially appeared to work OK; however, when users attempted to forward the message in CRM, they got an error. Again, since this was a delayed error situation that showed up months later, it was very difficult to find the real reason for the error—all diagnostics did not show the real problem.

So to me, that is the biggest reason not to create records in an unsupported way. It is very difficult to verify that it is correct because standard system data validation does not fire, and if you miss anything, the real problem may not show up for months and will most likely be outside of the normal error reporting mechanism. You are on your own. Was it worth it?

In Conclusion

In the end, I think these are all great ideas regarding the issue.  I really just want to echo Gustaf above.  The fact is that it is considered unsupported for a reason.  Microsoft doesn't want to deal with it either.  All unsupported customizations are adding serious risk to your entire implementation as Microsoft would be entirely within their right to wipe their hands of the entire implementation when they can show that these types of things are being used.  The API and SDK are there for a reason, please use them. There are ways to do almost anything you could be trying to do that would cause you to go an unsupported route.  This is where a good partner can really steer you in the right direction.  You have already invested a lot of money on your Dynamics CRM implementation in software costs and in most cases consulting time to put it into place and get it customized properly, protect that investment!

- I hope this helps!

-

Wednesday, June 26, 2013

Connecting to CRM 2011 Through iOS (initial thoughts)

There is a good chance that in the near future I am going to have to start writing some CRM 2011 connection stuff for iOS.  Also, someone on LinkedIn asked me today what my thoughts were.

Some initial ideas:

I don't write much Objective-C. We use Xamarin quite a bit at RBA, which allows us to write most of the app once (in C#) and then just re-write the UI layer for iOS or Android.

For the connection you can do a couple of different things. Depending on what the app is for, you can create a SOAP-based .NET web service to broker the connection and pass data back and forth, otherwise you can usually use something similiar to a SOAP-only client like the one that is here: 
http://code.msdn.microsoft.com/windowsdesktop/CRM-Online-2011-WebServices-14913a16 (again, this will only work if your underlying app is still C#)

Here's some other great general information and links on non-.NET client development.
http://msdn.microsoft.com/en-us/library/gg327838.aspx

Tuesday, June 11, 2013

Format of Jscript SOAP Responses in Microsoft Dynamics CRM 2011 Organization Service has Changed in UR 12!

You used to be able to pass in your response.responseXML.xml into a function like the one below to parse out a response and pull individual attributes.

function parseResponse(responseXML, attributename) {

    debugger;
    xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.async="false";
    xmlDoc.loadXML(responseXML);
    x=xmlDoc.getElementsByTagName("a:KeyValuePairOfstringanyType");
    for (i=0;i<x.length;i++)
   {
      if (x[i].childNodes[0].text == attributename)
      {
         //we decode the base 64 contents and alert the HTML of the Iframe
          alert(x[i].childNodes[1].text);
      }
      
   } 
}

PROBLEM:  With UR 12 and above you can still use this type of function but the responseXML property no longer exists on the response object.

SOLUTION: now instead of passing in your myresponse.responseXML.xml property of your response, now the property of your reponse is just in a  new response property, so the new syntax would just be myresponse.response

I hope this helps!!

-

Wednesday, May 22, 2013

Arrrggghhh!! Mind Blown!

Pretty sure my mind just blew.  Guess it's time to restart Visual Studio.  Errors get really funky when you have .xaml files open sometimes.  WOW!!

Name of client is blacked out.



Hope this gets a laugh or two!

Friday, May 17, 2013

Using RetrieveAttribute Request in CRM 2011 To Get the Label Value for an OptionSet

Here is a quick way to get a label for an OptionSet value in Microsoft Dynamics CRM 2011 using RetrieveAttributeRequest.


private string GetCRMOptionSetLabel(IOrganizationService service, string entityname, string optionsetname, int value)
{
            
    RetrieveAttributeRequest reqOptionSet = new RetrieveAttributeRequest();
    reqOptionSet.EntityLogicalName = entityname;
    reqOptionSet.LogicalName = optionsetname;
    RetrieveAttributeResponse resp = (RetrieveAttributeResponse)service.Execute(reqOptionSet);
    PicklistAttributeMetadata opdata = (PicklistAttributeMetadata)resp.AttributeMetadata;
    var option = opdata.OptionSet.Options.FirstOrDefault(o => o.Value == value);

    return option.Label.LocalizedLabels.FirstOrDefault().Label;
}

- I hope this helps!

Monday, March 11, 2013

Dynamics XRM Application Speed Builder Now Supports Access and Relationships


Jason Lattimer and I have released the next version of the Dynamics XRM Application Speed Builder.  The new version adds support for:
- Microsoft ACCESS as a datasource (previously only supported SQL Server)
- Full Relationship Support (allows you to explicitly specify relationships, but will also optionally build them based on relationships that already exist in your data source.
Overview from the CodePlex Page:
The Dynamics Xrm Application Speed Builder will analyze databases, then create the entities, attributes, relationships and forms in CRM for you.
The current functionality will read a SQL Server or MS Access database and create new CRM entities, attributes, and relationships based on the existing table structure. Metadata required to create the objects is pulled in and data types are matched up with their corresponding CRM types to reduce the work needed to get things created. At the same time most everything can be overridden before being created just in case your source database isn't perfect :) Last but not least we've included the option to drop all the newly created fields on the main form to give you a head start for creating the first user interface. 
Download the new version here:

Friday, February 22, 2013

Dynamics CRM 2011 SDK 5.0.14 is Out, Contains Solution Downleveling Tool

Yesterday, Microsoft released the newest version of the Microsoft Dynamics CRM SDK and it contains a much needed feature called a solution down-leveling tool. 

This allows you to take exported Polaris release solutions and import them into UR 6+ environments.  The problem is that the new entities that contain the new forms have new system entities attached to them that older systems don't have.  This tool will strip out those dependencies so you can import the solution successfully into older systems.

Get it at the link below:

http://www.microsoft.com/en-us/download/details.aspx?id=24004

-Happy Thursday!

Tuesday, February 19, 2013

CRM 4 Client Side SDK Will Not Work In Orion Release

Heads up, if you still use the 4.0 client-side SDK you won't be able to in Orion.  It's not supported and it won't work.   You might want to start migrating those customizations over if you are going to be planning an upgrade to the Orion release.

-Happy Tuesday!


Tuesday, February 5, 2013

I Will Be Presenting at the CRMUG This Thursday!

Hello Everyone, I will be demoing some more advanced Sharepoint and CRM integration concepts at the CRMUG on Thursday February 7th at the MTC (Microsoft) at Centennial Lakes in Edina. Come check it out if you are in the Twin Cities area.

Register here: 
http://www.crmug.com/events/crmugMinnesota020713

-Jamie

Tuesday, November 13, 2012

Overriding the CreatedOn Attribute On Entities in Microsoft Dynamics CRM 2011

I wanted to write a quick blogpost because I think there are a lot of people out there that have never used the overriddencreatedon field that is on all CRM 2011 entities.  If you have ever tried to manipulate the createdon field manually using the CRM sdk you will find that it is basically read-only.

There is a workaround for this though.
If you populate the overriddencreatedon field when you insert your entities you can specify your own datetime for the createdon field.  Now when the field is saved the overriddencreatedon field datetime is put in the createdon field of the entity and the REAL createdon field is still saved in the overriddencreatedon field.

So all you have to do is populate the overriddencreatedon field and it will in turn populate the createdon field and the real date will then be saved in the overriddencreatedon field.

There is a limitation to this.
You cannot insert a datetime in the future.  This will throw an error.  If you are using an application on another server and using datetime.now you might want to also use .addminutes(-5) or something to that effect because if the server times are out of sync by even a little bit and the application server tries to insert a time that is in the future for the CRM server, it will fail.

-Happy Tuesday

Thursday, October 4, 2012

VB.NET Soap Logger for Microsoft Dynamics CRM Updated For OSDP / Office 365 Environments

I have updated my CRM 2011 VB.NET Soap Logger tool.  It now works with Office 365 / OSDP orgs.  Please check it out.  It's based very heavily on the C# version included in the SDK.  It basically allows you to write VB.NET code to the organization service and log the soap for the request and response.  I also put the new version in CodePlex now that I see there will be some minimal maintenance associated with the tool.

Get the new version of the tool here:
https://vbsoaplogger.codeplex.com/

Here is a link to the original informational blogpost on this tool

http://mileyja.blogspot.com/2012/01/microsoft-dynamics-crm-2011-soap-logger.html

- Happy Thursday!

Tuesday, September 18, 2012

Determine if an Entity is Eligible to Participate in a Relationship Type Using VB.NET in Microsoft Dynamics CRM 2011

This illustration shows how to programmatically determine if an entity is eligible to participate in a relationship typ  in Microsoft Dynamics CRM 2011 in code using VB.NET.  

There are three different SDK web service messages highlighted in this post.  They are:
  • GetValidManyToManyRequest: Get list of entities that can participate in many to many relationships
  • GetValidReferencedEntitiesRequest: Get list of entities that can particaipate in one to many relationships as the "many" entity
  • GetValidReferencingEntitiesRequest: Get list of entities that can particaipate in one to many relationships as the "one" entity

Ok, here is what the code looks like!
Here's the VB.NET Code:

Dim req As New GetValidManyToManyRequest()
Dim resp As GetValidManyToManyResponse = DirectCast(slos.Execute(req), GetValidManyToManyResponse)

'Get list of entities that can particaipate in one to many relationships as the "many" entity
Dim req2 As New GetValidReferencedEntitiesRequest()
Dim resp2 As GetValidReferencedEntitiesResponse = DirectCast(slos.Execute(req2), GetValidReferencedEntitiesResponse)

'Get list of entities that can particaipate in one to many relationships as the "one" entity
Dim req3 As New GetValidReferencingEntitiesRequest()
Dim resp3 As GetValidReferencingEntitiesResponse = DirectCast(slos.Execute(req3), GetValidReferencingEntitiesResponse)

'now you can get the entitie names this way for each response by examining the response.entitynames property



Thats all there is to it!

I hope this helps!

Wednesday, September 12, 2012

Dynamics Xrm Application Speed Builder Project Kicks Off!

I have just kicked off a project to build an application that will hopefully help immensely in the porting of standard database driven applications to Microsoft Dynamics CRM.

The vision is pretty simple:

  • Analyze the database schema (first db targets will be MySQL and MS Sql Server)
  • Allow user to decide what tables should be made into custom entities in CRM and create them
  • Analyze foreign keys between between tables in database that correspond to custom entities and build      appropriate relationships.
  • Allow user to determine on a per-table basis what fields should be added as custom attributes.
  • Allow user to determine which of those custom attributes should be placed on the application form.

The current team is (more to come in future most likely):

  • Jason Lattimer - Developer
  • Maarten Docter - Developer
  • Thomas Canaple - Developer
  • Myself - Coordinator /  Developer

There is a project live on CodePlex for you to follow if you would like at:
http://xrmspeedy.codeplex.com/

Just understand that there is no code released as of yet as the project still hasn't been coded.  :)

-

Tuesday, September 11, 2012

Powerful Multi-Threading to the CRM 2011 SOAP Endpoint

I have run into several situations where people want a very quick delete functionality or they have an application that needs to hit the webservice many times in very quick succession.  This usually means multi-threading your application and that can cause problems if you hit it too many times too quickly and you can get errors because the available ports get used up and are not recycled fast enough.  I have overcame this to some degree in .NET by using stacks and when an atomic operation fails it just get's put back on the stack for another thread to pick up and try again.

It seems that there is another way to crank up the horsepower and increase throughput by changing a couple registry settings.  One to increase the number of ports available and another to decrease the amount of time they take to recycle.

Check out more here:

http://community.dynamics.com/product/crm/crmtechnical/b/billoncrm/archive/2009/01/20/crm-webservice-error-58-only-one-usage-of-each-socket-address-40-protocol-47-network-address-47-port-41-is-normally-permitted.aspx

Friday, August 24, 2012

Microsoft Dynamics CRM 2011 Compatibility With .NET 4.5

I have been doing some tests lately and have had a lot of luck recently with .NET 4.5 being compatible with Microsoft Dynamics CRM 2011.  I haven't run into an unsuccessful scenario yet but I am wondering if anyone else in the community has.

According to this KB article it seems to be compatible since Update Rollup 8:
http://support.microsoft.com/kb/2669061

Here is what I have tried so far and all of these worked:

  • Creating applications that talk to CRM compiled in 4.5 that reference the 4.0 assemblies included with the SDK
  •  Registering 4.5 compiled plugins using the plugin registration tool (also recompiled to 4.5).
  • Using new .NET 4.5 functionality in plugins (required 4.5 framework to be installed on server and a server reboot)

Interestingly enough my first .NET 4.5 plugin fired successfully even though .NET 4.5 wasn't installed on the CRM server.  You only need the 4.5 framework installed if you use new 4.5 functionality.  When I added some new code functionality in my plugin it did fail on that line of code until I installed the 4.5 framework on the server and rebooted.  That fixed the issue and the plugin fired normally.

I am wondering if anyone has found anything that doesn't work so far?  Let me know!

-Happy Friday!

Wednesday, August 22, 2012

Query a User's Schedule for Open Time Slots Using VB.NET in Microsoft Dynamics CRM 2011

This illustration shows how to query a user's schedule for open time blocks using VB.NET  in Microsoft Dynamics CRM 2011 with QueryScheduleRequest.
    Ok, here is what the code looks like!
    In VB.NET

    Dim reqWAI As New WhoAmIRequest()
    Dim respWAI As WhoAmIResponse = DirectCast(_serviceProxy.Execute(reqWAI), WhoAmIResponse)
    
    Dim reqSchedule As New QueryScheduleRequest()
    reqSchedule.ResourceId = respWAI.UserId
    reqSchedule.Start = DateTime.Now
    reqSchedule.End = DateTime.Today.AddDays(3)
    Dim tmc As New TimeCode()
    tmc = TimeCode.Available
    reqSchedule.TimeCodes = New TimeCode() {TimeCode.Available}
    
    Dim respSchedule As QueryScheduleResponse = DirectCast(slos.Execute(reqSchedule), QueryScheduleResponse)
    
    If respSchedule.TimeInfos.Length > 0 Then
        'act on timeslots
    Else
        'user has no free time that meets these parameters
    End If
    
    

    If you need help instantiating a service object in .NET within a plugin check out this post:
    http://mileyja.blogspot.com/2011/04/instantiating-service-object-within.html

    I hope this helps!
    -

    Monday, August 20, 2012

    Query a User's Schedule for Open Time Blocks Using .NET and Jscript in Microsoft Dynamics CRM 2011

    This illustration shows how to query a user's schedule for open time blocks using C# or Jscript in Microsoft Dynamics CRM 2011 with QueryScheduleRequest.
      Ok, here is what the code looks like!
      First in C#:

       WhoAmIRequest reqWAI = new WhoAmIRequest();
       WhoAmIResponse respWAI = (WhoAmIResponse)_serviceProxy.Execute(reqWAI);
      
                                                    
       QueryScheduleRequest reqSchedule = new QueryScheduleRequest();
       reqSchedule.ResourceId = respWAI.UserId;
       reqSchedule.Start = DateTime.Now;
       reqSchedule.End = DateTime.Today.AddDays(3);
       reqSchedule.TimeCodes = new TimeCode[] { TimeCode.Available };
      
       QueryScheduleResponse respSchedule = (QueryScheduleResponse)service.Execute(reqSchedule);
      
       
       if (respSchedule.TimeInfos.Length > 0)
       {
           //act on time slots
       }
      

      If you need help instantiating a service object in .NET within a plugin check out this post:
      http://mileyja.blogspot.com/2011/04/instantiating-service-object-within.html

      Now here is the Jscript nicely formatted by the CRM 2011 SOAP formatter. Available at: http://crm2011soap.codeplex.com/

      Now in Jscript


      This example is asynchronous, if you want to learn how to make JScript SOAP calls synchronously please visit this post: http://mileyja.blogspot.com/2011/07/using-jscript-to-access-soap-web.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 ServicePath = "/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();
                         }
                         else
                         { throw new Error("Unable to access the server URL"); }
                         }
                        if (serverUrl.match(/\/$/)) {
                             serverUrl = serverUrl.substring(0, serverUrl.length - 1);
                         } 
                         return serverUrl + ServicePath;
                     }, 
                 QueryScheduleRequest: function () {
                     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:QueryScheduleRequest\" 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>ResourceId</c:key>";
                     requestMain += "            <c:value i:type=\"d:guid\" xmlns:d=\"http://schemas.microsoft.com/2003/10/Serialization/\">6e219f51-0310-4c4d-8c60-1c524e2ba7b3</c:value>";
                     requestMain += "          </a:KeyValuePairOfstringanyType>";
                     requestMain += "          <a:KeyValuePairOfstringanyType>";
                     requestMain += "            <c:key>Start</c:key>";
                     requestMain += "            <c:value i:type=\"d:dateTime\" xmlns:d=\"http://www.w3.org/2001/XMLSchema\">2012-08-20T10:10:38.910063-05:00</c:value>";
                     requestMain += "          </a:KeyValuePairOfstringanyType>";
                     requestMain += "          <a:KeyValuePairOfstringanyType>";
                     requestMain += "            <c:key>End</c:key>";
                     requestMain += "            <c:value i:type=\"d:dateTime\" xmlns:d=\"http://www.w3.org/2001/XMLSchema\">2012-08-23T00:00:00-05:00</c:value>";
                     requestMain += "          </a:KeyValuePairOfstringanyType>";
                     requestMain += "          <a:KeyValuePairOfstringanyType>";
                     requestMain += "            <c:key>TimeCodes</c:key>";
                     requestMain += "            <c:value i:type=\"b:ArrayOfTimeCode\">";
                     requestMain += "              <b:TimeCode>Available</b:TimeCode>";
                     requestMain += "            </c:value>";
                     requestMain += "          </a:KeyValuePairOfstringanyType>";
                     requestMain += "        </a:Parameters>";
                     requestMain += "        <a:RequestId i:nil=\"true\" />";
                     requestMain += "        <a:RequestName>QuerySchedule</a:RequestName>";
                     requestMain += "      </request>";
                     requestMain += "    </Execute>";
                     requestMain += "  </s:Body>";
                     requestMain += "</s:Envelope>";
                     var req = new XMLHttpRequest();
                     req.open("POST", SDK.SAMPLES._getServerUrl(), true)
                     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.QueryScheduleResponse(req, successCallback, errorCallback); };
                     req.send(requestMain);
                 },
             QueryScheduleResponse: 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
      };
      
      


      To understand how to parse the response please review my post on using the DOM parser.
      Now you can call the SDK.SAMPLES.QueryScheduleRequest function from your form jscript handler.


      Thats all there is to it!
      -