tag:blogger.com,1999:blog-91189374715414126962024-02-19T12:28:07.209+02:00Biz-Forward.comMicrosoft Dynamics CRM, NAV, AX, SharePoint, .NET, C#, WPF, WCF, Silverlight, ASP, JavaScript, HTML, SQL Server, Office, MBA etc.CSChttp://www.blogger.com/profile/10391093134355090986noreply@blogger.comBlogger61125tag:blogger.com,1999:blog-9118937471541412696.post-14778605783472022682011-09-16T14:48:00.003+03:002011-09-16T14:51:20.204+03:00Last postThis is the last post here. From now on you can reach us at <b><span class="Apple-style-span" >www.biz-forward.com</span></b> . Thanks for understanding.CSChttp://www.blogger.com/profile/10391093134355090986noreply@blogger.com0tag:blogger.com,1999:blog-9118937471541412696.post-63592952626144618012011-05-31T02:28:00.001+03:002011-05-31T02:28:58.404+03:00proud to present MCC Award: <a href="http://ping.fm/vbyRY">http://ping.fm/vbyRY</a>CSChttp://www.blogger.com/profile/10391093134355090986noreply@blogger.com0tag:blogger.com,1999:blog-9118937471541412696.post-52834568251435829962011-03-10T23:57:00.001+02:002011-03-10T23:57:21.830+02:003D SoccerBall Model for WPF: <a href="http://ping.fm/WlGDd">http://ping.fm/WlGDd</a>CSChttp://www.blogger.com/profile/10391093134355090986noreply@blogger.com3tag:blogger.com,1999:blog-9118937471541412696.post-30260093029455096232011-03-10T23:56:00.001+02:002011-03-10T23:56:15.852+02:00Media Player (Video & Audio) Controls for WPF: _<a href="http://ping.fm/jCBem">http://ping.fm/jCBem</a>CSChttp://www.blogger.com/profile/10391093134355090986noreply@blogger.com0tag:blogger.com,1999:blog-9118937471541412696.post-74039981639950442902011-02-16T23:47:00.001+02:002011-02-16T23:47:39.386+02:00Am proud to present www.Croitoriu.NET - up & running!CSChttp://www.blogger.com/profile/10391093134355090986noreply@blogger.com0tag:blogger.com,1999:blog-9118937471541412696.post-17335774677323453842011-02-05T03:03:00.004+02:002011-02-05T03:05:12.025+02:00BIZ-FORWARD.COM<b><span class="Apple-style-span" >IMPORTANT ANNOUNCEMENT:</span></b> we moved to <b><a href="http://www.Biz-Forward.com"><span class="Apple-style-span" >www.Biz-Forward.com</span></a></b> . Meet us there.CSChttp://www.blogger.com/profile/10391093134355090986noreply@blogger.com0tag:blogger.com,1999:blog-9118937471541412696.post-69713097568309933672011-01-31T18:50:00.001+02:002011-01-31T18:50:17.463+02:00Dare to be GREAT! <a href="http://www.bizforward.cws-international.com/2011/01/31/dare-to-be-great/">http://www.bizforward.cws-international.com/2011/01/31/dare-to-be-great/</a>CSChttp://www.blogger.com/profile/10391093134355090986noreply@blogger.com0tag:blogger.com,1999:blog-9118937471541412696.post-25413325013265442122011-01-30T02:30:00.001+02:002011-01-30T02:30:42.370+02:00Contest: <a href="http://www.bizforward.cws-international.com/contests/">http://www.bizforward.cws-international.com/contests/</a> Good luck :)CSChttp://www.blogger.com/profile/10391093134355090986noreply@blogger.com0tag:blogger.com,1999:blog-9118937471541412696.post-6217199042168324312011-01-30T02:27:00.001+02:002011-01-30T02:27:49.030+02:00Important! you can be one of us! Join the best team... one click away! <a href="http://www.bizforward.cws-international.com/we-recruit/">http://www.bizforward.cws-international.com/we-recruit/</a>CSChttp://www.blogger.com/profile/10391093134355090986noreply@blogger.com0tag:blogger.com,1999:blog-9118937471541412696.post-75951519683495434632011-01-29T11:41:00.002+02:002011-01-29T17:17:50.842+02:00Website launchedOur website just launched. Please check it out: <a href="http://biz-forward.com/">http://biz-forward.com</a> . ThanksCSChttp://www.blogger.com/profile/10391093134355090986noreply@blogger.com0tag:blogger.com,1999:blog-9118937471541412696.post-63109241795913532702011-01-29T10:50:00.002+02:002011-01-29T10:53:28.274+02:00Format date fields in CRMSpecial thanks to <a href="http://a33ik.blogspot.com/"><span style="font-weight: bold; color: rgb(153, 0, 0);">Andriy a33ik Butenko</span></a> for this post.<br /><br /><span style="color: rgb(0, 102, 0);">// Formats the date into a certain format</span><br /><span style="color: rgb(51, 102, 255);">Date.prototype.Format = function(format)</span><br /><span style="color: rgb(51, 102, 255);">{</span><br /><span style="color: rgb(51, 102, 255);">var d = this;</span><br /><span style="color: rgb(51, 102, 255);">var f = "";</span><br /><span style="color: rgb(51, 102, 255);">f = f + format.replace( /dd|mm|yyyy|MM|hh|ss|ms|APM|\s|\/|\-|,|\./ig ,</span><br /><span style="color: rgb(51, 102, 255);">function match()</span><br /><span style="color: rgb(51, 102, 255);">{</span><br /><span style="color: rgb(51, 102, 255);">switch(arguments[0])</span><br /><span style="color: rgb(51, 102, 255);">{</span><br /><span style="color: rgb(51, 102, 255);">case "dd":</span><br /><span style="color: rgb(51, 102, 255);">var dd = d.getDate();</span><br /><span style="color: rgb(51, 102, 255);">return (dd <></span><br /><span style="color: rgb(51, 102, 255);">case "mm":</span><br /><span style="color: rgb(51, 102, 255);">var mm = d.getMonth() + 1;</span><br /><span style="color: rgb(51, 102, 255);">return (mm <></span><br /><span style="color: rgb(51, 102, 255);">case "yyyy": return d.getFullYear();</span><br /><span style="color: rgb(51, 102, 255);">case "hh":</span><br /><span style="color: rgb(51, 102, 255);">var hh = d.getHours();</span><br /><span style="color: rgb(51, 102, 255);">return (hh <></span><br /><span style="color: rgb(51, 102, 255);">case "MM":</span><br /><span style="color: rgb(51, 102, 255);">var MM = d.getMinutes();</span><br /><span style="color: rgb(51, 102, 255);">return (MM <></span><br /><span style="color: rgb(51, 102, 255);">case "ss":</span><br /><span style="color: rgb(51, 102, 255);">var ss = d.getSeconds();</span><br /><span style="color: rgb(51, 102, 255);">return (ss <></span><br /><span style="color: rgb(51, 102, 255);">case "ms": return d.getMilliseconds();</span><br /><span style="color: rgb(51, 102, 255);">case "APM":</span><br /><span style="color: rgb(51, 102, 255);">var apm = d.getHours();</span><br /><span style="color: rgb(51, 102, 255);">return (apm <></span><br /><span style="color: rgb(51, 102, 255);">default: return arguments[0];</span><br /><span style="color: rgb(51, 102, 255);">}</span><br /><span style="color: rgb(51, 102, 255);">});</span><br /><br /><span style="color: rgb(51, 102, 255);">return f;</span><br /><span style="color: rgb(51, 102, 255);">}</span><br /><br /><span style="color: rgb(0, 102, 0);">// Formats the date to CRM format</span><br /><span style="color: rgb(51, 102, 255);">Date.prototype.toCRMFormat = function()</span><br /><span style="color: rgb(51, 102, 255);">{</span><br /><span style="color: rgb(51, 102, 255);">var d = this;</span><br /><span style="color: rgb(51, 102, 255);">var f = d.Format("yyyy-mm-ddThh:MM:ss+" + (-d.getTimezoneOffset()/60) + ":00");</span><br /><br /><span style="color: rgb(51, 102, 255);">return f;</span><br /><span style="color: rgb(51, 102, 255);">}</span>CSChttp://www.blogger.com/profile/10391093134355090986noreply@blogger.com0tag:blogger.com,1999:blog-9118937471541412696.post-69386884229241305822011-01-28T23:48:00.018+02:002011-01-29T14:24:12.709+02:00Authors<div style="text-align: justify;">Our <span style="font-weight: bold;">crew </span>just got bigger. Let's welcome our newest <span style="font-weight: bold;">authors</span>. Here's a brief description about each author.<br /><br /><a href="http://biz-forward.com/"><span style="font-weight: bold; color: rgb(51, 102, 255);">Mirel APOSTOL - Tech Mastermind</span></a><br />- he got his title for a good reason, he's the most skilled developer/architect I met so far. There's no technology he can't master or teach others. But his skills go beyong programming, Mirel being a good manager/leader. He proved himself in each and every project he was a part of. He has a good sense of humour, enthusiasm and he is the man you need on your side, if you want to get your <span style="font-weight: bold; color: rgb(153, 0, 0);">business forward</span> :) Let's all welcome <span style="font-weight: bold; color: rgb(153, 0, 0);">Mirel</span>.<br /><br /><a href="http://ro.linkedin.com/in/octaviancucuta"><span style="color: rgb(51, 102, 255); font-weight: bold;">Octavian CUCUTA - Software Developer</span></a><br />- and a very good friend of mine. <span style="font-weight: bold; color: rgb(153, 0, 0);">Tavi </span>is the developer that thinks in general terms and the code he writes can serve more than just the problem it was written for. Design is also one of his skills. Tavi puts passion in every single line of code he writes, he documents his job very well and, to be honest, am glad I can collaborate with him. Let's welcome <span style="font-weight: bold; color: rgb(153, 0, 0);">Tavi</span>.<br /><br /><a href="http://ro.linkedin.com/pub/walter-hauptmann/12/10a/171"><span style="font-weight: bold; color: rgb(51, 102, 255);">Walter HAUPTMANN - Business Consultant</span></a><br />- my friend, my neighbour, my colleague, my managing partner @ CWS. <span style="font-weight: bold; color: rgb(153, 0, 0);">Walter</span> started as a developer and now he's a very skilled business analyst, consultant and project manager. He often has innovative ideas and likes to express himself via design, painting being one of his hobbies. Also, he's the funniest man I've met. In my opinion, he should consider a stand-up comedian career :) Let's welcome <span style="font-weight: bold; color: rgb(153, 0, 0);">Walter</span>.<br /><br /><a href="http://www.facebook.com/profile.php?id=831485826"><span style="font-weight: bold; color: rgb(51, 102, 255);">Alina ANDREESCU - Software Developer</span></a><br />- a lovely and funny presence, very smart and skilled .NET developer. She's the type of person that treats all the tasks seriously, making the final products work smooth. <span style="font-weight: bold; color: rgb(153, 0, 0);">Alina </span>is a bit shy, so let's encourage her writing skill :) Let's welcome <span style="font-weight: bold; color: rgb(153, 0, 0);">Alina</span>.<br /><br /><a href="http://www.facebook.com/profile.php?id=100000266382212"><span style="font-weight: bold; color: rgb(51, 102, 255);">Radu CHIRAN - Business Consultant</span></a><br />- he's the party-animal type. I can't imagine a good party, without him there. He's more of a dancer than human (to quote the famous <a href="http://www.youtube.com/watch?v=RIZdjT1472Y"><span style="font-weight: bold; color: rgb(51, 102, 255);">song</span></a>). <span style="font-weight: bold; color: rgb(153, 0, 0);">Radu </span>also has the vision of a product manager. He can easily track business goals & needs and analyse them, so coders can make it happen. Also, his sense of humour is one thing you'll surely notice if you get the honor to meet him in person. All my respect for him, let's welcome <span style="font-weight: bold; color: rgb(153, 0, 0);">Radu</span>.<br /><br /><a href="http://www.facebook.com/dpinsler"><span style="font-weight: bold; color: rgb(51, 102, 255);">Daniel PINSLER - Software Developer</span></a><br />- and also a very good product support professional who likes to get the job done well. If you got a question with no answer, don't worry, he has all the answers (yes boys & girls, when you have a dilemma, contact <span style="font-weight: bold; color: rgb(153, 0, 0);">Dani</span>). He also loves house music and house events and. Let's welcome <span style="font-weight: bold; color: rgb(153, 0, 0);">Daniel</span>.<br /><br /><a href="http://bg.linkedin.com/pub/nikolay-eftimov/21/524/483"><span style="font-weight: bold; color: rgb(51, 102, 255);">Nikolay EFTIMOV - Solutions Architect</span></a><br />- I met <span style="font-weight: bold; color: rgb(153, 0, 0);">Nikolay </span>in a Microsoft vs. Oracle PoC competition. He made a real good impression. He easily masters more than just Microsoft Dynamics CRM platform. The final product he worked on for that competition was more than I personally expected. He's a skilled coder & architect and I'm sure there's no task he can't complete. Let's welcome <span style="font-weight: bold; color: rgb(153, 0, 0);">Nikolay</span>.<br /><br /><a style="color: rgb(153, 0, 0); font-weight: bold;" href="http://www.mbe.ro/"></a><a style="color: rgb(51, 102, 255); font-weight: bold;" href="http://www.mbe.ro/">Ciprian MOCANU - Web Developer</a><br />- he's the best friend one can have. He's a very skilled web developer, leading <a style="color: rgb(153, 0, 0); font-weight: bold;" href="http://www.mbe.ro">MBE</a> to success daily (he's <a href="http://mbe.ro/about/"><span style="font-weight: bold; color: rgb(153, 0, 0);">"the duck behind the operation"</span></a>). Let's all welcome <span style="font-weight: bold; color: rgb(153, 0, 0);">Ciprian</span>.<br /><br /><a href="http://ro.linkedin.com/in/cscorpion"><span style="font-weight: bold; color: rgb(51, 102, 255);">Cornel CROITORIU - Senior Software Developer & Founder</span></a><br />- My mission is simple. Here's why I did this: <span style="font-style: italic;">"Because I strongly believe that a good business solution is a must for every business, no matter the stage. This blog will help both developers & consultants achieve their goals, making the final product exactly what the customer wanted."</span><br /><br /><span>And a song I hope from all my heart that this blog will be one day, thanks to all of you - the community. Welcome to the new <a href="http://biz-forward.com/"><span style="font-weight: bold; color: rgb(51, 102, 255);">Biz-Forward.com</span></a>!</span><br /><br /><span style="font-style: italic;"><div align="center"><iframe title="YouTube video player" class="youtube-player" type="text/html" src="http://www.youtube.com/embed/ra12L1Bl0Z4" allowfullscreen="" width="480" frameborder="0" height="390"></iframe></div></span><br /><br /><br /><span style="font-style: italic;">Cornel</span><br /></div>CSChttp://www.blogger.com/profile/10391093134355090986noreply@blogger.com0tag:blogger.com,1999:blog-9118937471541412696.post-84761162024151093182011-01-28T23:48:00.015+02:002011-01-29T13:40:18.749+02:00Areas of interestThese are the <span style="font-weight: bold;">areas</span> we will cover in our posts:<br /><br /><a href="http://crm.dynamics.com/en-us/"><span style="color: rgb(51, 102, 255); font-weight: bold;">Microsoft Dynamics CRM</span></a><br /><a href="http://www.microsoft.com/en-us/dynamics/products/nav-overview.aspx"><span style="color: rgb(51, 102, 255); font-weight: bold;">Microsoft Dynamics NAV</span></a><br /><a href="http://msdn.microsoft.com/en-us/dynamics/ax/default"><span style="color: rgb(51, 102, 255); font-weight: bold;">Microsoft Dynamics AX</span></a><br /><a href="http://sharepoint.microsoft.com/en-us/Pages/default.aspx"><span style="color: rgb(51, 102, 255); font-weight: bold;">Microsoft SharePoint</span></a><br /><a href="http://office.microsoft.com/en-us/"><span style="color: rgb(51, 102, 255); font-weight: bold;">Microsoft Office</span></a><br /><a href="http://www.microsoft.com/sqlserver/2008/en/us/default.aspx"><span style="color: rgb(51, 102, 255); font-weight: bold;">Microsoft SQL Server</span></a><br /><a href="http://msdn.microsoft.com/en-us/vcsharp/aa336809"><span style="color: rgb(51, 102, 255); font-weight: bold;">C#</span></a><br /><a href="http://windowsclient.net/default.aspx"><span style="color: rgb(51, 102, 255); font-weight: bold;">WPF</span></a><br /><a href="http://msdn.microsoft.com/en-us/library/ms731082.aspx"><span style="color: rgb(51, 102, 255); font-weight: bold;">WCF</span></a><br /><a href="http://www.silverlight.net/"><span style="color: rgb(51, 102, 255); font-weight: bold;">Silverlight</span></a><br /><a href="http://www.asp.net/"><span style="color: rgb(51, 102, 255); font-weight: bold;">ASP</span></a><br /><a href="http://www.w3schools.com/html/default.asp"><span style="font-weight: bold; color: rgb(51, 102, 255);">HTML</span></a><br /><a href="http://www.w3schools.com/js/default.asp"><span style="font-weight: bold; color: rgb(51, 102, 255);">JavaScript</span></a><br /><a href="http://www.microsoft.com/net/"><span style="font-weight: bold; color: rgb(51, 102, 255);">.NET Framework</span></a><br /><a href="http://windows.microsoft.com/windows-7?os=win7"><span style="font-weight: bold; color: rgb(51, 102, 255);">Windows 7</span></a><br /><a href="http://support.microsoft.com/kb/931937"><span style="font-weight: bold; color: rgb(51, 102, 255);">Windows Mobile</span></a><br /><a href="http://www.microsoft.com/windowsphone/en-us/default.aspx"><span style="font-weight: bold; color: rgb(51, 102, 255);">Windows Phone 7</span></a><br /><a href="http://msdn.microsoft.com/en-us/library/dd831853.aspx"><span style="font-weight: bold; color: rgb(51, 102, 255);">Visual Studio 2010</span></a><br /><a href="http://www.microsoft.com/surface/"><span style="font-weight: bold; color: rgb(51, 102, 255);">Microsoft Surface</span></a><br /><a href="http://en.wikipedia.org/wiki/Project_management"><span style="font-weight: bold; color: rgb(51, 102, 255);">Project Management</span></a><br /><a href="http://en.wikipedia.org/wiki/Product_management"><span style="font-weight: bold; color: rgb(51, 102, 255);">Product Management</span></a><br /><a href="http://en.wikipedia.org/wiki/Public_relations"><span style="font-weight: bold; color: rgb(51, 102, 255);">PR</span></a><br /><a href="http://en.wikipedia.org/wiki/Marketing"><span style="color: rgb(51, 102, 255); font-weight: bold;">Marketing</span></a>CSChttp://www.blogger.com/profile/10391093134355090986noreply@blogger.com0tag:blogger.com,1999:blog-9118937471541412696.post-80871417594003441552011-01-28T20:34:00.002+02:002011-01-28T20:39:54.898+02:00RebrandingOur blog will "suffer" some minor adjustments. It won't be just a CRM blog from now on, but a Microsoft Business Solutions blog, with topics about <span style="font-weight: bold;">Dynamics CRM, NAV, AX, SharePoint, Office, .NET (C#, WPF, WCF, Silverlight, asp), HTML & JavaScript</span> and much more. Stay tuned, we are gonna move your business process forward, for our new name/brand is <a style="color: rgb(51, 102, 255); font-weight: bold;" href="http://biz-forward.com">Biz Forward</a>.CSChttp://www.blogger.com/profile/10391093134355090986noreply@blogger.com0tag:blogger.com,1999:blog-9118937471541412696.post-79123942847528873212011-01-27T16:25:00.003+02:002011-01-27T16:27:07.740+02:00Change attachment file limitMore details about this issue can be found here: <a style="color: rgb(51, 102, 255);" href="http://rahulsalunkhe.wordpress.com/2010/08/26/increasing-the-crm-4-0-attachment-size-limit/">http://rahulsalunkhe.wordpress.com/2010/08/26/increasing-the-crm-4-0-attachment-size-limit</a> . This should work under CRM 2011 as well.CSChttp://www.blogger.com/profile/10391093134355090986noreply@blogger.com0tag:blogger.com,1999:blog-9118937471541412696.post-30183235107007623622011-01-26T23:04:00.003+02:002011-01-26T23:06:50.021+02:00CRM Usage ReportA very nice thread about this issue, written by <a style="color: rgb(153, 0, 0); font-weight: bold;" href="http://blogs.msdn.com/b/crm/archive/2007/10/02/bio-mvp-david-jennaway.aspx">David Jennaway - MVP</a>, can be found <a style="color: rgb(51, 102, 255);" href="http://blogs.msdn.com/b/crm/archive/2009/04/08/crm-usage-reporting-unleashed.aspx">here</a>.CSChttp://www.blogger.com/profile/10391093134355090986noreply@blogger.com0tag:blogger.com,1999:blog-9118937471541412696.post-44133656030489595752011-01-26T16:28:00.001+02:002011-01-26T16:29:40.659+02:00Generate a new Guid in JavaScript<span style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 0, 0);">As easy as that :)</span><br /><br />// Generate new Guid</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;">function Hexa4()</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;">{</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> return (((1+Math.random())*0x10000)|0).toString(16).substring(1);</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;">}</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;">function GenerateGuid() </span><br /><span style="color: rgb(51, 102, 255); font-style: italic;">{</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> return (Hexa4()+Hexa4()+"-"+Hexa4()+"-"+Hexa4()+"-"+Hexa4()+"-"+Hexa4()+Hexa4()+Hexa4()).toUpperCase();</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;">}</span><br /><br /><span style="color: rgb(0, 102, 0);">// USE</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;">var guid = GenerateGuid();</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;">alert(guid);</span>CSChttp://www.blogger.com/profile/10391093134355090986noreply@blogger.com0tag:blogger.com,1999:blog-9118937471541412696.post-78499758301956082892011-01-26T15:58:00.005+02:002011-01-26T16:17:21.890+02:00Create a custom filtered lookup view in runtime - CRM 2011<span style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 0, 0);">Starting<span style="font-weight: bold; color: rgb(153, 0, 0);"> CRM 2011</span> you can filter a certain <span style="color: rgb(153, 0, 0); font-weight: bold;">lookup view</span> based on related entities or other system/custom views. But sometimes this is not enough. For example, if you wanna make a <span style="font-weight: bold; color: rgb(153, 0, 0);">custom filtered view</span>, that uses several filters, you can use the following approach.</span><br /><br /><span style="color: rgb(0, 0, 0);">Starting scenario (all of the completed lookup fields will be used as filters):</span><br /><br /></span><a href="http://img502.imageshack.us/img502/1893/oppproductcrm5.png"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 399px; height: 163px;" src="http://img502.imageshack.us/img502/1893/oppproductcrm5.png" alt="" border="0" /></a><br /><a style="color: rgb(0, 102, 0);" href="http://img502.imageshack.us/img502/1893/oppproductcrm5.png"><span style="font-weight: bold;"></span></a><span style="color: rgb(0, 102, 0);">// *** ALL IN 1 CODE</span><span style="color: rgb(0, 102, 0);"> ***</span><br /><span style="color: rgb(0, 102, 0);">// Structs</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">var FilterBy = MakeStruct("SchemaName Operator Value");</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">var ViewColumn = MakeStruct("SchemaName Width");</span><br /><br /><span style="color: rgb(0, 102, 0);">// Advanced Filtered Lookup</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">function AdvancedFilteredLookup(lookupSchemaName, viewId, entityName, primaryKeyName, primaryFieldName, viewDisplayName, filterBy, orderBy, viewColumns) </span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">{</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>" +</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> "<entity name='" + entityName + "'>" +</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> "<attribute name='" + primaryFieldName + "' />" +</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> "<order attribute='" + orderBy + "' descending='false' />" +</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> "<filter type='and'>" + </span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> "<filter type='and'>"; </span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> for(var i=0; i< filterBy.length; i++)</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> fetchXml += "<condition attribute='" + filterBy[i].SchemaName + "' operator='" + filterBy[i].Operator + "' value='" + filterBy[i].Value + "' />"; </span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> fetchXml += "</filter></filter></entity></fetch>";</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> </span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> var layoutXml = "<grid name='resultset' " +</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> "object='1' " +</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> "jump='name' " +</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> "select='1' " +</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> "icon='1' " +</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> "preview='1'>" +</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> "<row name='result' " +</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> "id='" + primaryKeyName + "'>";</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> for(var i=0; i< viewColumns.length; i++)</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> layoutXml += "<cell name='" + viewColumns[i].SchemaName + "' width='" + viewColumns[i].Width.toString() + "' />";</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> layoutXml += "</row></grid>";</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> </span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> try { </span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> var lookupControl = Xrm.Page.ui.controls.get(lookupSchemaName);</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> lookupControl.addCustomView(viewId, entityName, viewDisplayName, fetchXml, layoutXml, true);</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> }</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> catch(err) {</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> }</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">}<br /><br /></span><span style="color: rgb(51, 102, 255);"><span style="color: rgb(0, 102, 0);">// USE</span></span><span style="font-style: italic; color: rgb(51, 102, 255);"> </span><span style="color: rgb(51, 102, 255);"><span style="color: rgb(0, 102, 0);">- we gonna create a custom filtered lookup view for the new_productid lookup field</span></span><span style="font-style: italic; color: rgb(51, 102, 255);"><br /></span><span style="color: rgb(0, 102, 0);">// Note: this function should be called on the OnChange() event of all the filter-fields (for example: new_type1id)</span><span style="font-style: italic; color: rgb(51, 102, 255);"><br />function FilterProducts()<br />{<br />try {<br /><span style="color: rgb(0, 102, 0);"> // Parameters</span><br />var customViewId = "{FD140AAF-4DF4-11DD-BD17-0019B9312238}"; // new id<br />var customViewName = "Type Filtered Products";<br />var lookupFieldName = "new_productid";<br />var entityName = "product";<br />var primaryKeyName = "productid";<br />var primaryFieldName = "name";<br />var orderBy = "name";<br /><br /><span style="color: rgb(0, 102, 0);"> // Generate Filters</span><br />var type1id = crmForm.all.item("nov_type1id").DataValue != null ? crmForm.all.item("nov_type1id").DataValue[0].id : null;<br />var type2id = crmForm.all.item("nov_type2id").DataValue != null ? crmForm.all.item("nov_type2id").DataValue[0].id : null;<br />var type3id = crmForm.all.item("nov_type3id").DataValue != null ? crmForm.all.item("nov_type3id").DataValue[0].id : null;<br />var type4id = crmForm.all.item("nov_type4id").DataValue != null ? crmForm.all.item("nov_type4id").DataValue[0].id : null;<br />var clientneedid = crmForm.all.item("nov_clientneedid").DataValue != null ? crmForm.all.item("nov_clientneedid").DataValue[0].id : null;<br />var vendorid = crmForm.all.item("nov_vendorid").DataValue != null ? crmForm.all.item("nov_vendorid").DataValue[0].id : null;<br />var filters = new Array();<br />var index = 0;<br />if(type1id != null)<br /> filters[index++] = new FilterBy("new_type1id", LogicalOperator.Eq, type1id);<br />if(type2id != null)<br /> filters[index++] = new FilterBy("new_type2id", LogicalOperator.Eq, type2id);<br />if(type3id != null)<br /> filters[index++] = new FilterBy("new_type3id", LogicalOperator.Eq, type3id);<br />if(type4id != null)<br /> filters[index++] = new FilterBy("new_type4id", LogicalOperator.Eq, type4id);<br />if(clientneedid != null)<br /> filters[index++] = new FilterBy("new_clientneedid", LogicalOperator.Eq, clientneedid);<br />if(vendorid != null)<br /> filters[index++] = new FilterBy("nov_vendorid", LogicalOperator.Eq, vendorid);<br /><br /><span style="color: rgb(0, 102, 0);"> // View Columns</span><br />var viewColumns = [new ViewColumn("name", 200), new ViewColumn("productnumber", 100), new ViewColumn("new_type1id", 100), new ViewColumn("new_type2id", 100), new ViewColumn("new_type3id", 100), new ViewColumn("new_type4id", 100), new ViewColumn("new_clientneedid", 100), new ViewColumn("nov_vendorid", 100)];<br /><br /><span style="color: rgb(0, 102, 0);"> // Create Dynamics View</span><br />AdvancedFilteredLookup(lookupFieldName, customViewId, entityName, primaryKeyName, primaryFieldName, customViewName, filters, orderBy, viewColumns);<br /><br /><span style="color: rgb(0, 102, 0);"> // Clear Previous Product Value</span><br />crmForm.all.item(lookupFieldName).DataValue = null;<br />}<br />catch(err) {<br />}<br />}<br /><br /></span><span style="color: rgb(0, 0, 0);">And now, the custom filtered lookup view for the new_productid lookup field will look like this:<br /></span><span style="font-style: italic; color: rgb(51, 102, 255);"><br /></span><a href="http://img831.imageshack.us/img831/142/filteredviewcrm5.png"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 399px; height: 283px;" src="http://img831.imageshack.us/img831/142/filteredviewcrm5.png" alt="" border="0" /></a><br />Hope you'll find this article useful.<br /><br />P.S.: In my opinion, filtering a lookup this way is a lot more efficient than altering the lookupsingle.aspx file (the unsupported method used in CRM 4.0) ;)CSChttp://www.blogger.com/profile/10391093134355090986noreply@blogger.com1tag:blogger.com,1999:blog-9118937471541412696.post-68408345629562716672011-01-26T15:31:00.011+02:002011-01-28T16:41:30.705+02:00Creating records in CRM 2011 using JavaScriptUsing the<span style="font-weight: bold; color: rgb(153, 0, 0);"> CRM Web Service</span>, you can create new entity records, just using JavaScript. The following code demonstrates this:<br /><br /><span style="color: rgb(0, 102, 0);">// Make Struct</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">function MakeStruct(names) {<br />var names = names.split(' ');<br />var count = names.length;<br />function constructor() {<br /> for (var i = 0; i < count; i++) {<br /> this[names[i]] = arguments[i];<br /> }<br />}<br />return constructor;<br />}</span><br /><br /><span style="color: rgb(0, 102, 0);">// CRM Field Struct</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">var CRMField = MakeStruct("SchemaName Value");</span><br /><br /><span style="color: rgb(0, 102, 0);">// Call Crm Service</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">function CallCrmService(soapBody, method)</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">{</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">try {</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">xmlHttpRequest.Open("POST", '/mscrmservices/2007/CrmService.asmx', false);</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">xmlHttpRequest.setRequestHeader("SOAPAction", 'http://schemas.microsoft.com/crm/2007/WebServices/' + method);</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> var xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?</span><span style="font-style: italic; color: rgb(51, 102, 255);">></span><span style="font-style: italic; color: rgb(51, 102, 255);">" +<br /> "</span><span style="font-style: italic; color: rgb(51, 102, 255);"><</span><span style="font-style: italic; color: rgb(51, 102, 255);">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\'</span><span style="font-style: italic; color: rgb(51, 102, 255);">></span><span style="font-style: italic; color: rgb(51, 102, 255);">" +</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">GenerateAuthenticationHeader() + "<soap:Body</span><span style="font-style: italic; color: rgb(51, 102, 255);">></span><span style="font-style: italic; color: rgb(51, 102, 255);">" + soapBody + "</span><span style="font-style: italic; color: rgb(51, 102, 255);"><</span><span style="font-style: italic; color: rgb(51, 102, 255);">/soap:Body</span><span style="font-style: italic; color: rgb(51, 102, 255);">></span><span style="font-style: italic; color: rgb(51, 102, 255);"><</span><span style="font-style: italic; color: rgb(51, 102, 255);">/soap:Envelope</span><span style="font-style: italic; color: rgb(51, 102, 255);">></span><span style="font-style: italic; color: rgb(51, 102, 255);">";</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">xmlHttpRequest.setRequestHeader("Content-Length", xml.length);</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">xmlHttpRequest.send(xml);</span><br /><br /><span style="font-style: italic; color: rgb(51, 102, 255);">var resultXml = xmlHttpRequest.responseXML;</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">var errorCount = resultXml.selectNodes('//error').length;</span><br /><br /><span style="font-style: italic; color: rgb(51, 102, 255);">if (errorCount != 0) {</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">var msg = resultXml.selectSingleNode('//description').nodeTypedValue;</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">alert(msg);</span><br /><br /><span style="font-style: italic; color: rgb(51, 102, 255);">return null;</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">}</span><br /><br /><span style="font-style: italic; color: rgb(51, 102, 255);">return resultXml;</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">}</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">catch(err) {</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">}</span><br /><br /><span style="font-style: italic; color: rgb(51, 102, 255);">return null;</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">}</span><br /><br /><span style="color: rgb(0, 102, 0);">// Create Record</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">function CreateRecord(entityName, fields)</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">{</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">try {<br /> var resultArray = new Array();<br /> var attributesList = '';<br /><br /> for(var i = 0; i <span style="font-style: italic; color: rgb(51, 102, 255);">< fields.length; i++)<br /></span><span style="font-style: italic; color: rgb(51, 102, 255);">attributesList += "<" + </span></span><span style="font-style: italic; color: rgb(51, 102, 255);"><span style="font-style: italic; color: rgb(51, 102, 255);">fields[i].SchemaName </span></span><span style="font-style: italic; color: rgb(51, 102, 255);"><span style="font-style: italic; color: rgb(51, 102, 255);">+ ">" + fields[i].Value + "</span><span style="font-style: italic; color: rgb(51, 102, 255);"><</span><span style="font-style: italic; color: rgb(51, 102, 255);">/"+fields[i].SchemaName+"</span><span style="font-style: italic; color: rgb(51, 102, 255);">></span><span style="font-style: italic; color: rgb(51, 102, 255);">";<br /> }<br /><br /> var xml = "</span><span style="font-style: italic; color: rgb(51, 102, 255);"><</span><span style="font-style: italic; color: rgb(51, 102, 255);">Create xmlns='http://schemas.microsoft.com/crm/2007/WebServices'</span><span style="font-style: italic; color: rgb(51, 102, 255);">></span><span style="font-style: italic; color: rgb(51, 102, 255);"><</span><span style="font-style: italic; color: rgb(51, 102, 255);">entity xsi:type='"+entityName+"'</span><span style="font-style: italic; color: rgb(51, 102, 255);">></span><span style="font-style: italic; color: rgb(51, 102, 255);">" + attributesList + "</span><span style="font-style: italic; color: rgb(51, 102, 255);"><</span><span style="font-style: italic; color: rgb(51, 102, 255);">/entity</span><span style="font-style: italic; color: rgb(51, 102, 255);">></span><span style="font-style: italic; color: rgb(51, 102, 255);"><</span><span style="font-style: italic; color: rgb(51, 102, 255);">/Create</span><span style="font-style: italic; color: rgb(51, 102, 255);">></span><span style="font-style: italic; color: rgb(51, 102, 255);">";<br /> var resultXml = CallCrmService(xml, 'Create');<br /><br /> if (resultXml) {<br /> var newid = resultXml.selectSingleNode('//CreateResult').nodeTypedValue;<br /> return newid;<br /> }<br />}<br />catch(err) {<br />}<br /><br />return null;</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">}</span><br /><br /><span style="color: rgb(0, 102, 0);">// USE</span><br /><span style="color: rgb(0, 102, 0);">// Create new Contact</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">function CreateContact()</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">{</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">var fields = [new CRMField('firstname', 'Cornel'), new CRMField('lastname, 'Croitoriu')];</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">return CreateRecord('contact', fields); // return new contact id</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">}</span><br /><br /><span style="color: rgb(0, 102, 0);">// Create new Annotation</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">function CreateAnnotation(parentEntityName, parentEntityId, title, text)</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">{</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">var fields = [new CRMField('objecttypecode', parentEntityName), new CRMField('objectid', parentEntityId), new CRMField('subject', title), new CRMField('notetext', text), new CRMField('isdocument', false), new CRMField("mimetype", "text/html")];</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">return CreateRecord('annotation', fields); // return new note id</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">}</span><br /><br /><span style="color: rgb(0, 102, 0);">// Example</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;">CreateAnnotation('opportunity', 'FD140AAF-4DF4-11DD-BD17-0019B9312238', 'dynamic generated note', 'text goes here...');</span></span>CSChttp://www.blogger.com/profile/10391093134355090986noreply@blogger.com0tag:blogger.com,1999:blog-9118937471541412696.post-35959731867486577762011-01-26T10:05:00.002+02:002011-01-26T10:06:58.559+02:00Microsoft Dynamics CRM 2011 Online Global Availability<span style="font-weight: bold; color: rgb(153, 0, 0);">Microsoft Dynamics CRM 2011</span> goes international: 40 countries, 41 languages. Click <a style="font-weight: bold; color: rgb(51, 102, 255);" href="http://www.switched-online.com/microsoft-dynamics-crm-2011-online-international-availability/">here</a> for more details.CSChttp://www.blogger.com/profile/10391093134355090986noreply@blogger.com0tag:blogger.com,1999:blog-9118937471541412696.post-66231583459288161642011-01-26T09:38:00.001+02:002011-01-26T09:40:13.340+02:00Set a lookup value in CRM 2011<span style="color: rgb(0, 102, 0);">// Sets the lookup value for a certain field</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">function SetLookupValue(fieldName, id, name, entityType) {</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> if(fieldName != null) {</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> var lookupValue = new Array();</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> lookupValue[0] = new Object();</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> lookupValue[0].id = id;</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> lookupValue[0].name = name;</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> lookupValue[0].entityType = entityType;</span><br /><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> Xrm.Page.getAttribute(fieldName).setValue(lookupValue);</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);"> }</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">}<br /><br /></span><span style="color: rgb(0, 102, 0);">// USE</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">SetLookupValue("new_blogid", "{FD140AAF-4DF4-11DD-BD17-0019B9312238}", "CRM Stuff", "new_blog");</span>CSChttp://www.blogger.com/profile/10391093134355090986noreply@blogger.com0tag:blogger.com,1999:blog-9118937471541412696.post-81497521129926361002011-01-26T09:30:00.007+02:002011-01-26T09:47:52.119+02:00JavaScript structuresHere's a brief example of how to create structures in JavaScript. We'll use this function a lot from now on in our code.<br /><br /><span style="color: rgb(0, 102, 0);">// Make Struct</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;">function MakeStruct(names) {</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> var names = names.split(' ');</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> var count = names.length;</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> function constructor() {</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> for (var i = 0; i < count; i++) {</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> this[names[i]] = arguments[i];</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> }</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> }</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> return constructor;</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;">}</span><br /><br />// Use<br /><span style="color: rgb(0, 102, 0);">// Declaring the struct</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;">var Person = MakeStruct("ID FirstName LastName Email");</span><br /><span style="color: rgb(0, 102, 0);">// Instance</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;">var person1 = new Person(21, "Cornel", "Croitoriu", "cscmediadesign@yahoo.com");</span><br /><br />Hope you'll find this useful ;)CSChttp://www.blogger.com/profile/10391093134355090986noreply@blogger.com0tag:blogger.com,1999:blog-9118937471541412696.post-49659092840426186962011-01-25T19:07:00.004+02:002011-01-25T23:26:09.268+02:00CRM Stuff - 4 years together<span style="font-weight: bold; color: rgb(153, 0, 0);">CRM Stuff</span> has reached its 4th anniversary. I'd like to thank the community for all the support, comments, ideas, suggestions and thoughts.<br /><br />Best of luck,<br />Cornel<br />CRM StuffCSChttp://www.blogger.com/profile/10391093134355090986noreply@blogger.com1tag:blogger.com,1999:blog-9118937471541412696.post-5843698892418045012011-01-25T16:27:00.011+02:002011-01-26T09:55:45.008+02:00CRM 2011 Custom Form Button<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://img94.imageshack.us/img94/1608/crm4button.png"><br /></a><br />Using some of the basic DOM vs JavaScript capabilities, you can use the following code to dynamically generate a <span style="font-weight: bold; color: rgb(153, 0, 0);">custom button</span> for your<span style="color: rgb(153, 0, 0); font-weight: bold;"> CRM Form</span> in Microsoft Dynamics CRM 2011 (scroll to the end of this post to see an example of how to use it). The button will look just like the ones in the toolbar.<br />All you need is a random CRM field (the type doesn't matter) to host the button (the original field content will be hidden). Also, you'll need a custom function to pass for the <span style="font-weight: bold; color: rgb(153, 0, 0);">onclick</span> event.<br />Note: the <span style="font-weight: bold; color: rgb(153, 0, 0);">image </span>you use for the button must be placed inside the <span style="font-weight: bold; color: rgb(0, 0, 0);">%programfiles%\Microsoft Dynamics CRM\CRMWeb\_imgs\ico</span> folder.<br /><br />The final output looks like this:<br /><br /><div align="center"><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://img402.imageshack.us/img402/254/crm5button.png"><img style="text-align: center; margin: 0pt 10px 10px 0pt; cursor: pointer; width: 325px; height: 232px;" src="http://img402.imageshack.us/img402/254/crm5button.png" alt="" border="0" /></a><br /></div><br />And... here's the code masterpiece :)...<br /><br /><span style="color: rgb(0, 102, 0);">// CODE</span><br /><br /><span style="color: rgb(0, 102, 0);">// Create Dynamic Button for CRM 5</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">function CreateButtonCRM5(fieldName, buttonText, buttonWidth, iconName, clickEvent)</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">{</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">functiontocall=clickEvent;</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">crmForm.all.item(fieldName + "_c").style.display = "none";</span><br /><br /><span style="font-style: italic; color: rgb(51, 102, 255);">var li = document.createElement("LI");</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">li.setAttribute('id', fieldName + 'LI');</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">li.setAttribute('className', 'ms-crm-Menu');</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">li.setAttribute('title', buttonText);</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">li.setAttribute('onclick', functiontocall);</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">li.setAttribute('onmousedown', push_custom_button);</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">li.setAttribute('onmouseup', release_custom_button);</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">li.style.width=buttonWidth;</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">li.style.cursor="hand";</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">li.style.textAlign="center";</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">li.style.overflow="hidden";</span><br /><br /><span style="font-style: italic; color: rgb(51, 102, 255);">var span = document.createElement("span");</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">span.setAttribute('className', 'ms-crm-Menu-Label');</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">span.setAttribute('id', fieldName + 'Span');</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">span.style.cursor = "hand";</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">li.appendChild(span);</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">li.onmouseover = function() { span.setAttribute('className', 'ms-crm-Menu-Label-Hovered'); }</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">li.onmouseout = function() { span.setAttribute('className', 'ms-crm-Menu-Label'); }</span><br /><br /><span style="font-style: italic; color: rgb(51, 102, 255);">var a = document.createElement("a");</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">a.setAttribute('id', fieldName + 'A');</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">a.setAttribute('className', 'ms-crm-Menu-Label');</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">a.onclick = function() { return false; }</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">a.setAttribute('target', '_self');</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">a.setAttribute('href', 'javascript:onclick();');</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">a.style.cursor = "hand";</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">span.appendChild(a);</span><br /><br /><span style="font-style: italic; color: rgb(51, 102, 255);">var img = document.createElement("img");</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">img.setAttribute('id', fieldName + 'Img');</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">img.setAttribute('className', 'ms-crm-Menu-ButtonFirst');</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">img.setAttribute('src', '/_imgs/ico/' + iconName);</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">img.style.cursor = "hand";</span><br /><br /><span style="font-style: italic; color: rgb(51, 102, 255);">var span2 = document.createElement("span");</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">span2.setAttribute('id', fieldName + 'Span2');</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">span2.setAttribute('className', 'ms-crm-MenuItem-TextRTL');</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">span2.innerText = buttonText;</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">span2.style.cursor = "hand";</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">a.appendChild(img);</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">a.appendChild(span2);</span><br /><br /><span style="font-style: italic; color: rgb(51, 102, 255);">removeChildNodes(crmForm.all.item(fieldName + "_d"));</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">crmForm.all.item(fieldName + "_d").appendChild(li);</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">}</span><br /><br /><span style="font-style: italic; color: rgb(51, 102, 255);">function push_custom_button()</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">{</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">window.event.srcElement.style.marginLeft="1px";</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">window.event.srcElement.style.marginTop="1px";</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">}</span><br /><br /><span style="font-style: italic; color: rgb(51, 102, 255);">function release_custom_button()</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">{</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">window.event.srcElement.style.marginLeft="0px";</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">window.event.srcElement.style.marginTop="0px";</span><br /><span style="font-style: italic; color: rgb(51, 102, 255);">}</span><br /><br /><span style="color: rgb(0, 102, 0);">// USE</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;">function CustomClickFunction()</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;">{</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;">alert("your code goes here...");</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;">}</span><br /><br /><span style="color: rgb(0, 102, 0);">// Create the button, using the new_custombutton field as a container</span><br /><span style="color: rgb(51, 102, 255);"><span style="font-style: italic;">CreateButtonCRM5('new_custombutton', 'Custom Button','100 px', '16_cancel.png', CustomClickFunction);</span></span><span style="font-weight: bold; color: rgb(153, 0, 0);"><br /><br /></span><span style="color: rgb(0, 0, 0);"><br /><span style="font-weight: bold; color: rgb(153, 0, 0);">BONUS:</span><br />For the developers out there who are still using <span style="font-weight: bold;">CRM 4.0</span>, you can use the following <span style="font-weight: bold;">function </span>to generate a custom button, CRM styled, based on the same principles as previous article/function.<br /><br /><span style="color: rgb(0, 102, 0);">// Create Dynamic Button for CRM 4</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;">function CreateButtonCRM4(fieldName, buttonText, buttonWidth, clickEvent)</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;">{</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> functiontocall=clickEvent; </span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> crmForm.all.item(fieldName + "_c").style.display = "none";</span><br /><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> crmForm.all.item(fieldName).DataValue = buttonText;</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> crmForm.all.item(fieldName).style.borderRight="#3366cc 1px solid";</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> crmForm.all.item(fieldName).style.paddingRight="5px";</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> crmForm.all.item(fieldName).style.borderTop="#3366cc 1px solid";</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> crmForm.all.item(fieldName).style.paddingLeft="5px";</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> crmForm.all.item(fieldName).style.fontSize="11px";</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> crmForm.all.item(fieldName).style.backgroundImage="url(/_imgs/btn_rest.gif)";</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> crmForm.all.item(fieldName).style.borderLeft="#3366cc 1px solid";</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> crmForm.all.item(fieldName).style.width=buttonWidth;</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> crmForm.all.item(fieldName).style.cursor="hand";</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> crmForm.all.item(fieldName).style.lineHeight="18px";</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> crmForm.all.item(fieldName).style.borderBottom="#3366cc 1px solid";</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> crmForm.all.item(fieldName).style.backgroundRepeat="repeat-x";</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> crmForm.all.item(fieldName).style.fontFamily="Tahoma";</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> crmForm.all.item(fieldName).style.height="20px";</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> crmForm.all.item(fieldName).style.backgroundColor="#cee7ff";</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> crmForm.all.item(fieldName).style.textAlign="center";</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> crmForm.all.item(fieldName).style.overflow="hidden";</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> crmForm.all.item(fieldName).attachEvent("onmousedown",push_custom_button);</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> crmForm.all.item(fieldName).attachEvent("onmouseup",release_custom_button);</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> crmForm.all.item(fieldName).attachEvent("onclick",functiontocall); </span><br /><span style="color: rgb(51, 102, 255); font-style: italic;"> crmForm.all.item(fieldName).contentEditable= false;</span><br /><span style="color: rgb(51, 102, 255); font-style: italic;">}</span></span><span style="font-weight: bold; color: rgb(153, 0, 0);"><br /><br /></span><span style="color: rgb(0, 0, 0);">and the output:</span><span style="font-weight: bold; color: rgb(153, 0, 0);"><br /><br /></span><a href="http://img94.imageshack.us/img94/1608/crm4button.png"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 275px; height: 181px;" src="http://img94.imageshack.us/img94/1608/crm4button.png" alt="" border="0" /></a><br /><span style="font-weight: bold; color: rgb(153, 0, 0);"><br /><br /></span>CSChttp://www.blogger.com/profile/10391093134355090986noreply@blogger.com4tag:blogger.com,1999:blog-9118937471541412696.post-39449020072570255812010-09-29T11:35:00.011+03:002010-09-29T11:51:51.904+03:00Marketing List History<span style="font-family:arial;font-size:78%;">Greetings guys,<br /><br />Last week I worked on a very strange requirement to implement some kind of a marketing list auditing mechanism. The customer wants to be able to track which user added particular contact in a given marketing list. <br />Since the list <–> contact relationship is many-to-many and therefore the relations are stored in a third table (called ListMemberBase in this case), there is no event available to trigger a workflow or do something out of the box. Technically nor the list is updated neither the contact. Since I didn’t have much time to do this I decided to use database trigger to achieve the goal. Yes it is unsupported but it works very fast and nice so I decided to share it.<br />I first created a custom field of type ntext called Marketing List History (new_marketinglisthistory) on the Contact Entity. Added this to the contact form.<br />Then created the following trigger:<br /></span><br /><em><span style="font-size:78%;color:#3366ff;">USE [XXX_MSCRM]<br />GO<br />/****** Object: Trigger [dbo].[trg_ListHistory] Script Date: 09/28/2010 17:09:44 ******/<br />SET ANSI_NULLS ON<br />GO<br />SET QUOTED_IDENTIFIER ON<br />GO<br />CREATE TRIGGER [dbo].[trg_ListHistory]<br />ON [dbo].[ListMemberBase]<br />AFTER INSERT<br />AS <br />BEGIN<br />SET NOCOUNT ON;<br />if (select EntityType from inserted) = 2<br />begin<br />if (select New_MarketingListHistory from Contact, inserted where Contact.contactid=inserted.entityid) is null<br />begin <br />UPDATE Contact<br />SET New_MarketingListHistory = (select l.createdbyname+' --> '+listname from listmember l inner join list m on l.listid=m.listid where l.ListMemberId=inserted.ListMemberId)<br />FROM inserted<br />WHERE Contact.contactid = inserted.entityid<br />end<br />else<br />begin<br />UPDATE Contact<br />SET New_MarketingListHistory = (select l.createdbyname+' --> '+listname + char(13) from listmember l inner join list m on l.listid=m.listid where l.ListMemberId=inserted.ListMemberId) + (select New_MarketingListHistory from Contact where Contact.contactid=inserted.entityid) <br />FROM inserted<br />WHERE Contact.contactid = inserted.entityid<br />end<br />end<br />END<br /></span></em><br /><span style="font-family:arial;font-size:78%;"> Done! Here is the result:<br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXPUqgWMxA5iskmKl88a0Ewb2lDUtANea76XMPnlonQabHlzIoH5xGCiHnDvlfQojX8mN0NxatIdIzLGHUWaNngF2-MAnYi9DhHCxzJ6vHQ_85wOm-xZEyHmgSMk-x6HP38JVPg6QYxzVY/s1600/1.jpg"><img style="cursor:pointer; cursor:hand;width: 400px; height: 224px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXPUqgWMxA5iskmKl88a0Ewb2lDUtANea76XMPnlonQabHlzIoH5xGCiHnDvlfQojX8mN0NxatIdIzLGHUWaNngF2-MAnYi9DhHCxzJ6vHQ_85wOm-xZEyHmgSMk-x6HP38JVPg6QYxzVY/s400/1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5522254247828121186" /></a><br /><br />The last addition in a given marketing list goes on top of the history. <br />You can also put this column in the marketing list view – all members to look like this:<br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifLcqru6dTctRyvHDCel9SEujSspc6HO0CINu64QnSjs3c9TkgRNN3F9FRYcWQTBjiqpXyLdpQvNbbd6gRUm-jomxnSPMs5wZPy8nMsIBNT2Dx5eg3e1aNgRtZIxm9bDUl_hwC-lGW3Ens/s1600/2.jpg"><img style="cursor:pointer; cursor:hand;width: 400px; height: 78px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifLcqru6dTctRyvHDCel9SEujSspc6HO0CINu64QnSjs3c9TkgRNN3F9FRYcWQTBjiqpXyLdpQvNbbd6gRUm-jomxnSPMs5wZPy8nMsIBNT2Dx5eg3e1aNgRtZIxm9bDUl_hwC-lGW3Ens/s400/2.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5522253799736408562" /></a><br /><br />Regards!<br />Rinshwind<br /></span>Rinshwindhttp://www.blogger.com/profile/02129736349299455418noreply@blogger.com1