Tuesday, December 15, 2009

Gettinng data into CRM with SSIS next step

Hi,

There is allready a year that we published a post of a Microsoft Dynamics CRM destination for SSIS (Sql Integration Services).
Now the CRM Destination Evolved to new level, the release 2.0 is even better and solves major issiues with lookups (customers etc.. )
The new destination also uses 2007 Web service wit AD or IFD authentication ...


Sunday, December 6, 2009

Setting the default unit of product

Hello,
Our team is continually getting the request from users that setting the default unit is »a click to far«
So there is a simple solution with using the web service …
I'm posting JavaScript code which is useful to setting the default unit on a product detail part (Opportunity, Quote, Sales Order or Invoice) enter the code bellow in the on change part of the product lookup.



// Setting the default unit***Tomaz Vodusek
var buid;
var productid = crmForm.all.productid.DataValue[0].id;
var authenticationHeader = GenerateAuthenticationHeader();
// Prepare the SOAP message.
var xml = "" +
"" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'" +
" xmlns:xsd='http://www.w3.org/2001/XMLSchema'>" +
authenticationHeader +
"" +
"" +
"product" +
"" + productid + "" +
"" +
"" +
"defaultuomid" +
"
" +
"
" +
"
" +
"
" +
"
";
// Prepare the xmlHttpObject and send the request.
var xHReq = new ActiveXObject("Msxml2.XMLHTTP");
xHReq.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xHReq.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/Retrieve");
xHReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xHReq.setRequestHeader("Content-Length", xml.length);
xHReq.send(xml);
// Capture the result.
var resultXml = xHReq.responseXML;

// Check for errors.
var errorCount = resultXml.selectNodes('//error').length;
if (errorCount != 0) {
var msg = resultXml.selectSingleNode('//description').nodeTypedValue;
alert(msg);
}
// Display the retrieved value.
else {
buid = resultXml.selectSingleNode("//q1:defaultuomid").nodeTypedValue;
}
var ime
// Prepare the SOAP message.
xml = "" +
"" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'" +
" xmlns:xsd='http://www.w3.org/2001/XMLSchema'>" +
authenticationHeader +
"" +
"" +
"uom" +
"" + buid + "" +
"" +
"" +
"name" +
"
" +
"
" +
"
" +
"
" +
"
";
// Prepare the xmlHttpObject and send the request.
xHReq = new ActiveXObject("Msxml2.XMLHTTP");
xHReq.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xHReq.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/Retrieve");
xHReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xHReq.setRequestHeader("Content-Length", xml.length);
xHReq.send(xml);
// Capture the result.
var resultXml = xHReq.responseXML;

// Check for errors.
errorCount = resultXml.selectNodes('//error').length;
if (errorCount != 0) {
var msg = resultXml.selectSingleNode('//description').nodeTypedValue;
alert(msg);
}
// Display the retrieved value.
else {
ime = resultXml.selectSingleNode("//q1:name").nodeTypedValue;
}
// Create an array to set as the DataValue for the lookup control.
var lookupData = new Array();
// Create an object to add to the array.
var lookupItem = new Object();
// Set the id, typename, and name properties to the object.
lookupItem.id = buid;
lookupItem.typename = 'uom';
lookupItem.name = ime;
// Add the object to the array.
lookupData[0] = lookupItem;
// Set the value of the lookup field to the value of the array.
crmForm.all.uomid.DataValue = lookupData;
//Konec Vnosa

Tuesday, February 5, 2008

Microsoft Dynamics CRM & SQL integration services




I finally have a good option to import data from different sources. Yes the Microsoft Dynamics CRM 4.0 comes with a good tool to import data with lot of features (mapping, duplicate detection) but when you would like to import data and after update it you have to export it and report it.



Our development team prepared a good add on for Microsoft SQL Integration service, which is capable to import and update records on selected unique key





You can set the parameters for the CRM server (we currently use 2006 web services)
And you decide in which entity you will import the data from the selected source.
You get the source columns and you can name them with the appropriate names in CRM (mapping)
For the selected columns you can set the compare key for the selected attribute.


So we have the right tool to import and update the records on schedule from different applications.
Well done Matej..