Retrieve Entity Record With JavaScript And XrmServiceToolkit Library

Client Side Programming Jan 24, 2017

The XrmServiceToolkit JavaScript Library provides a huge set of features which makes Client-Side Development much easier. The whole library contains four major parts as listed on their offical description:

  • 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 / CRM 2013 / CRM 2015 including dependent OptionSet, field tooltip, add custom filter view to lookup field. (Some Methods ‘Unsupported’. Some of these methods have either been replaced with supported methods or deprecated in CRM 2013 version)

If you want to retrieve a specific entity record and definded columns for optimized request you can use the example below:

var cols = ["name", "value1"];
var retrievedCampaign = XrmServiceToolkit.Soap.Retrieve("campaign", campaignId, cols);

if (retrievedCampaign.attributes["name"] != undefined) {
var name = retrievedCampaign.attributes["name"].value;



Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.