<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sir Slur &#187; ms crm quote pricelist</title>
	<atom:link href="http://www.sirslur.com/tag/ms-crm-quote-pricelist/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sirslur.com</link>
	<description>Slinging around some technology stuff</description>
	<lastBuildDate>Mon, 24 Oct 2011 20:44:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>Get Product Price from Pricelist</title>
		<link>http://www.sirslur.com/2009/05/27/get-product-price-from-pricelist/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://www.sirslur.com/2009/05/27/get-product-price-from-pricelist/#comments</comments>
		<pubDate>Wed, 27 May 2009 04:43:22 +0000</pubDate>
		<dc:creator>sirslur</dc:creator>
				<category><![CDATA[MS CRM]]></category>
		<category><![CDATA[CRM]]></category>
		<category><![CDATA[crm product price list]]></category>
		<category><![CDATA[ms crm 4]]></category>
		<category><![CDATA[ms crm quote pricelist]]></category>

		<guid isPermaLink="false">http://www.sirslur.com/2009/05/27/get-product-price-from-pricelist/</guid>
		<description><![CDATA[I have created a custom entity in MS CRM 4.  I have a couple of lookups (one for product, one for currency), an integer field (quantity) and a couple of money fields (price per unit and total).  I wanted to be able to lookup the product and have it populate the price per unit and [...]]]></description>
			<content:encoded><![CDATA[<p>I have created a custom entity in MS CRM 4.  I have a couple of lookups (one for product, one for currency), an integer field (quantity) and a couple of money fields (price per unit and total).  I wanted to be able to lookup the product and have it populate the price per unit and total fields.  All of the code is entered into the OnSave event on the form.</p>
<p>What I did:</p>
<p>First,</p>
<p>//this is to get the proudctid guid that was selected<br />
var product = document.crmForm.all.new_productid;</p>
<p>var product2 = new Array();<br />
product2 = product.DataValue;</p>
<p>var productID = product2[0].id;</p>
<p>var product4 = productID;<br />
//this is where I stop getting the productid guid</p>
<p>//this is me setting the default pricelist to a var<br />
var pl = &#8220;{H5637A92-ZGQB-DE91-9J43-001543E82HL4}&#8221;;<br />
if (productID!=null)<br />
{</p>
<p>//put an alert message here.</p>
<p>}</p>
<p>// Prepare variables to retrieve Authentication<br />
var authenticationHeader = GenerateAuthenticationHeader();</p>
<p>// Prepare the SOAP message.  This is getting the information from the sever<br />
var xml = &#8220;&lt;?xml version=&#8217;1.0&#8242; encoding=&#8217;utf-8&#8242;?&gt;&#8221;+<br />
&#8220;&lt;soap:Envelope xmlns:soap=&#8217;<a href="http://schemas.xmlsoap.org/soap/envelope/'&quot;+">http://schemas.xmlsoap.org/soap/envelope/&#8217;&#8221;+</a><br />
&#8221; xmlns:xsi=&#8217;<a href="http://www.w3.org/2001/XMLSchema-instance'&quot;+">http://www.w3.org/2001/XMLSchema-instance&#8217;&#8221;+</a><br />
&#8221; xmlns:xsd=&#8217;<a href="http://www.w3.org/2001/XMLSchema'">http://www.w3.org/2001/XMLSchema&#8217;</a>&gt;&#8221;+<br />
authenticationHeader+<br />
&#8220;&lt;soap:Body&gt;&#8221;+<br />
&#8220;&lt;RetrieveMultiple xmlns=&#8217;<a href="http://schemas.microsoft.com/crm/2007/WebServices'">http://schemas.microsoft.com/crm/2007/WebServices&#8217;</a>&gt;&#8221;+<br />
&#8220;&lt;query xmlns:q1=&#8217;<a href="http://schemas.microsoft.com/crm/2006/Query'&quot;+">http://schemas.microsoft.com/crm/2006/Query&#8217;&#8221;+</a><br />
&#8221; xsi:type=&#8217;q1:QueryExpression&#8217;&gt;&#8221;+</p>
<p>//this is what entity I want to read<br />
&#8220;&lt;q1:EntityName&gt;productpricelevel&lt;/q1:EntityName&gt;&#8221;+<br />
&#8220;&lt;q1:ColumnSet xsi:type=&#8217;q1:ColumnSet&#8217;&gt;&#8221;+<br />
&#8220;&lt;q1:Attributes&gt;&#8221;+</p>
<p>//this is what fields from the entity I want to read<br />
&#8220;&lt;q1:Attribute&gt;amount&lt;/q1:Attribute&gt;&#8221;+<br />
&#8220;&lt;/q1:Attributes&gt;&#8221;+<br />
&#8220;&lt;/q1:ColumnSet&gt;&#8221;+<br />
&#8220;&lt;q1:Distinct&gt;false&lt;/q1:Distinct&gt;&#8221;+<br />
&#8220;&lt;q1:Criteria&gt;&#8221;+<br />
&#8220;&lt;q1:FilterOperator&gt;And&lt;/q1:FilterOperator&gt;&#8221;+<br />
&#8220;&lt;q1:Conditions&gt;&#8221;+<br />
&#8220;&lt;q1:Condition&gt;&#8221;+</p>
<p>//This is where I say what pricelevel I want to use<br />
&#8220;&lt;q1:AttributeName&gt;pricelevelid&lt;/q1:AttributeName&gt;&#8221;+<br />
&#8220;&lt;q1:Operator&gt;Equal&lt;/q1:Operator&gt;&#8221;+<br />
&#8220;&lt;q1:Values&gt;&#8221;+<br />
&#8220;&lt;q1:Value xsi:type=&#8217;xsd:string&#8217;&gt;&#8221;+pl+&#8221;&lt;/q1:Value&gt;&#8221;+<br />
&#8220;&lt;/q1:Values&gt;&#8221;+<br />
&#8220;&lt;/q1:Condition&gt;&#8221;+<br />
&#8220;&lt;/q1:Conditions&gt;&#8221;+<br />
&#8220;&lt;q1:FilterOperator&gt;And&lt;/q1:FilterOperator&gt;&#8221;+<br />
&#8220;&lt;q1:Conditions&gt;&#8221;+<br />
&#8220;&lt;q1:Condition&gt;&#8221;+</p>
<p>//this is where I pass the product<br />
&#8220;&lt;q1:AttributeName&gt;productid&lt;/q1:AttributeName&gt;&#8221;+<br />
&#8220;&lt;q1:Operator&gt;Equal&lt;/q1:Operator&gt;&#8221;+<br />
&#8220;&lt;q1:Values&gt;&#8221;+<br />
&#8220;&lt;q1:Value xsi:type=&#8217;xsd:string&#8217;&gt;&#8221;+product4+&#8221;&lt;/q1:Value&gt;&#8221;+<br />
&#8220;&lt;/q1:Values&gt;&#8221;+<br />
&#8220;&lt;/q1:Condition&gt;&#8221;+<br />
&#8220;&lt;/q1:Conditions&gt;&#8221;+<br />
&#8220;&lt;/q1:Criteria&gt;&#8221;+<br />
&#8220;&lt;/query&gt;&#8221;+<br />
&#8220;&lt;/RetrieveMultiple&gt;&#8221;+<br />
&#8220;&lt;/soap:Body&gt;&#8221;+<br />
&#8220;&lt;/soap:Envelope&gt;&#8221;;<br />
// Prepare the xmlHttpObject and send the request.<br />
var xHReq = new ActiveXObject(&#8220;Msxml2.XMLHTTP&#8221;);<br />
xHReq.Open(&#8220;POST&#8221;, &#8220;/mscrmservices/2007/CrmService.asmx&#8221;, false);<br />
xHReq.setRequestHeader(&#8220;SOAPAction&#8221;,&#8221;<a href="http://schemas.microsoft.com/crm/2007/WebServices/RetrieveMultiple&quot;);">http://schemas.microsoft.com/crm/2007/WebServices/RetrieveMultiple&#8221;);</a><br />
xHReq.setRequestHeader(&#8220;Content-Type&#8221;, &#8220;text/xml; charset=utf-8&#8243;);<br />
xHReq.setRequestHeader(&#8220;Content-Length&#8221;, xml.length);<br />
xHReq.send(xml);<br />
// Capture the result.<br />
var resultXml = xHReq.responseXML;</p>
<p>// Check for errors.<br />
var errorCount = resultXml.selectNodes(&#8216;//error&#8217;).length;<br />
if (errorCount != 0)<br />
{<br />
var msg = resultXml.selectSingleNode(&#8216;//description&#8217;).nodeTypedValue;<br />
alert(msg);<br />
}<br />
// Parse and display the results.<br />
else<br />
{<br />
var results = resultXml.getElementsByTagName(&#8216;BusinessEntity&#8217;);<br />
var msg = &#8220;&#8221;;<br />
if (results.length == 0)<br />
{<br />
msg = &#8220;No product was found.&#8221;;<br />
alert(msg);<br />
return;<br />
}<br />
else<br />
{<br />
for (i=0;i &lt; results.length;i++)<br />
{</p>
<p>//this is where I get the amount and pass it to the field I want<br />
var amount = results[i].selectSingleNode(&#8216;./q1:amount&#8217;).nodeTypedValue;<br />
crmForm.all.priceper.value = amount;</p>
<p>}<br />
}<br />
}</p>
<p>//this is where I calculate the total price</p>
<p>var pri = crmForm.all.priceper.value;<br />
var qt = crmForm.all.quantity.value;<br />
var total = (pri * qt);<br />
crmForm.all.amount.value = total;</p>
<p>Keep moving along now.</p>
<p><map name='google_ad_map_25_c392d43f49786b8a'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/25?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_25_c392d43f49786b8a' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=25&amp;url= http%3A%2F%2Fwww.sirslur.com%2F2009%2F05%2F27%2Fget-product-price-from-pricelist%2F' /></p>
<div class="sociable">
<div class="sociable_tagline">
<strong>Share</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.sirslur.com%2F2009%2F05%2F27%2Fget-product-price-from-pricelist%2F&amp;title=Get%20Product%20Price%20from%20Pricelist&amp;bodytext=I%20have%20created%20a%20custom%20entity%20in%20MS%20CRM%204.%C2%A0%20I%20have%20a%20couple%20of%20lookups%20%28one%20for%20product%2C%20one%20for%20currency%29%2C%20an%20integer%20field%20%28quantity%29%20and%20a%20couple%20of%20money%20fields%20%28price%20per%20unit%20and%20total%29.%C2%A0%20I%20wanted%20to%20be%20able%20to%20lookup%20the%20product%20and%20have%20it" title="Digg"><img src="http://www.sirslur.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.sirslur.com%2F2009%2F05%2F27%2Fget-product-price-from-pricelist%2F&amp;title=Get%20Product%20Price%20from%20Pricelist&amp;notes=I%20have%20created%20a%20custom%20entity%20in%20MS%20CRM%204.%C2%A0%20I%20have%20a%20couple%20of%20lookups%20%28one%20for%20product%2C%20one%20for%20currency%29%2C%20an%20integer%20field%20%28quantity%29%20and%20a%20couple%20of%20money%20fields%20%28price%20per%20unit%20and%20total%29.%C2%A0%20I%20wanted%20to%20be%20able%20to%20lookup%20the%20product%20and%20have%20it" title="del.icio.us"><img src="http://www.sirslur.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.sirslur.com%2F2009%2F05%2F27%2Fget-product-price-from-pricelist%2F&amp;t=Get%20Product%20Price%20from%20Pricelist" title="Facebook"><img src="http://www.sirslur.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.sirslur.com%2F2009%2F05%2F27%2Fget-product-price-from-pricelist%2F&amp;title=Get%20Product%20Price%20from%20Pricelist" title="Mixx"><img src="http://www.sirslur.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.sirslur.com%2F2009%2F05%2F27%2Fget-product-price-from-pricelist%2F&amp;title=Get%20Product%20Price%20from%20Pricelist&amp;annotation=I%20have%20created%20a%20custom%20entity%20in%20MS%20CRM%204.%C2%A0%20I%20have%20a%20couple%20of%20lookups%20%28one%20for%20product%2C%20one%20for%20currency%29%2C%20an%20integer%20field%20%28quantity%29%20and%20a%20couple%20of%20money%20fields%20%28price%20per%20unit%20and%20total%29.%C2%A0%20I%20wanted%20to%20be%20able%20to%20lookup%20the%20product%20and%20have%20it" title="Google Bookmarks"><img src="http://www.sirslur.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.sirslur.com%2F2009%2F05%2F27%2Fget-product-price-from-pricelist%2F&amp;title=Get%20Product%20Price%20from%20Pricelist" title="Reddit"><img src="http://www.sirslur.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://slashdot.org/bookmark.pl?title=Get%20Product%20Price%20from%20Pricelist&amp;url=http%3A%2F%2Fwww.sirslur.com%2F2009%2F05%2F27%2Fget-product-price-from-pricelist%2F" title="Slashdot"><img src="http://www.sirslur.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.sirslur.com%2F2009%2F05%2F27%2Fget-product-price-from-pricelist%2F&amp;title=Get%20Product%20Price%20from%20Pricelist" title="StumbleUpon"><img src="http://www.sirslur.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.sirslur.com%2F2009%2F05%2F27%2Fget-product-price-from-pricelist%2F" title="Technorati"><img src="http://www.sirslur.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.sirslur.com%2F2009%2F05%2F27%2Fget-product-price-from-pricelist%2F&amp;submitHeadline=Get%20Product%20Price%20from%20Pricelist&amp;submitSummary=I%20have%20created%20a%20custom%20entity%20in%20MS%20CRM%204.%C2%A0%20I%20have%20a%20couple%20of%20lookups%20%28one%20for%20product%2C%20one%20for%20currency%29%2C%20an%20integer%20field%20%28quantity%29%20and%20a%20couple%20of%20money%20fields%20%28price%20per%20unit%20and%20total%29.%C2%A0%20I%20wanted%20to%20be%20able%20to%20lookup%20the%20product%20and%20have%20it&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://www.sirslur.com/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="mailto:?subject=Get%20Product%20Price%20from%20Pricelist&amp;body=http%3A%2F%2Fwww.sirslur.com%2F2009%2F05%2F27%2Fget-product-price-from-pricelist%2F" title="email"><img src="http://www.sirslur.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.sirslur.com%2F2009%2F05%2F27%2Fget-product-price-from-pricelist%2F&amp;title=Get%20Product%20Price%20from%20Pricelist" title="Live"><img src="http://www.sirslur.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Get%20Product%20Price%20from%20Pricelist%20-%20http%3A%2F%2Fwww.sirslur.com%2F2009%2F05%2F27%2Fget-product-price-from-pricelist%2F" title="Twitter"><img src="http://www.sirslur.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.sirslur.com/2009/05/27/get-product-price-from-pricelist/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

