<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://customerfx.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Ryan Farley&amp;#39;s Blog : C#, Customization</title><link>http://customerfx.com/pages/crmdeveloper/archive/tags/C_2300_/Customization/default.aspx</link><description>Tags: C#, Customization</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP2 (Build: 20611.960)</generator><item><title>Displaying the Primary Contact on the Account Detail Form Revisited and Custom Properties in 7.2.2</title><link>http://customerfx.com/pages/crmdeveloper/2008/04/18/displaying-the-primary-contact-on-the-account-detail-form-revisited-and-custom-properties-in-7-2-2.aspx</link><pubDate>Fri, 18 Apr 2008 20:29:00 GMT</pubDate><guid isPermaLink="false">e15581aa-2787-4c59-a940-524c09f5d256:39178</guid><dc:creator>Ryan Farley</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://customerfx.com/pages/crmdeveloper/rsscomments.aspx?PostID=39178</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://customerfx.com/pages/crmdeveloper/commentapi.aspx?PostID=39178</wfw:comment><comments>http://customerfx.com/pages/crmdeveloper/2008/04/18/displaying-the-primary-contact-on-the-account-detail-form-revisited-and-custom-properties-in-7-2-2.aspx#comments</comments><description>&lt;p&gt;&lt;a class="" href="http://customerfx.com/pages/crmdeveloper/2008/01/08/Custom-Entity-Properties-and-Displaying-the-Primary-Contact-on-the-Account-Detail-Form.aspx"&gt;I posted before&lt;/a&gt; about adding the primary contact to the Account Details form in the SalesLogix 7.2 Web Client. This solution made use of &amp;quot;Custom Properties&amp;quot; which was a feature available in 7.2.1. However, since that time, a change was introduced to how custom properties are built in 7.2.2 and later. Custom Properties are no longer available (although custom properties built prior to 7.2.2 will still work when you upgrade without change). &lt;/p&gt;
&lt;p&gt;Let&amp;#39;s take a look at how this changes things using the same example as before (placing the account&amp;#39;s primary contact on the account details form). As I mentioned, Custom Properties are gone. We now have &amp;quot;Code Snippet Properties&amp;quot;. The major difference between a 7.2.1 Custom Property and a 7.2.2 Code Snippet Property is that a Code Snippet Property is the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;div&gt;Code Snippet Properties are read-only. That is, they have a getter only, no setter.&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;The code in a Code Snippet property is no longer exactly a part of the entity. This measn that before, you could reference properties/methods of the entity using &amp;quot;this&amp;quot;, while now, you are passed in a reference of the entity as a parameter.&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;The implementation of the&amp;nbsp;actual code for the Code Snippet Property is a void method. That&amp;#39;s right. It doesn&amp;#39;t actually &amp;quot;return&amp;quot; anything. Instead, there is an out parameter (of type &amp;quot;object&amp;quot;) that you set as the return value.&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;While the implementation code is a void method with an out param for the result, you still use it as a property. There is a property that will wrap the method and allow you to use it like a property. This allows you to still easily bind it.&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;All of this change was mainly to separate the code for the property from the entity itself, allowing the implementation code to be in C# or VB.NET, whereas before you could only use C# (which was fine with me, hehe).&lt;/p&gt;
&lt;p&gt;Anyway, to create the &amp;quot;PrimaryContact&amp;quot; property, there are only small changes we&amp;#39;ll need to make. First of all, right-click on the Account entity Properties folder and select &amp;quot;New Code Snippet Property&amp;quot;. You&amp;#39;ll get the following:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://customerfx.com/blogs/crmdeveloper/Property-PrimaryContact.jpg" border="0" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;You&amp;#39;ll want to set the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;div&gt;&lt;strong&gt;Property Name&lt;/strong&gt;: PrimaryContact&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;&lt;strong&gt;Return Type&lt;/strong&gt;: Sage.Entity.Interfaces.IContact (just like before, you&amp;#39;ll have to just type this in. It won&amp;#39;t appear in the drop-down list)&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;&lt;strong&gt;Click Add&lt;/strong&gt;. This will create the step&amp;#39;s snippet stub&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;&lt;strong&gt;Click Edit Code Snippet&lt;/strong&gt;. This will bring up the code window&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Now enter in the following code:&lt;br /&gt;&lt;pre&gt;&lt;span style="COLOR:blue;"&gt;namespace&lt;/span&gt; Sage.BusinessRules.CodeSnippets
{
    &lt;span style="COLOR:blue;"&gt;public&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;static&lt;/span&gt; partial &lt;span style="COLOR:blue;"&gt;class&lt;/span&gt; AccountBusinessRules
    {
        &lt;span style="COLOR:blue;"&gt;public&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;static&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;void&lt;/span&gt; GetPrimaryContactStep1(IAccount account, out Sage.Entity.Interfaces.IContact result)
        {
            Sage.Entity.Interfaces.IContact primarycontact &lt;span style="COLOR:navy;"&gt;=&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;null&lt;/span&gt;;
            &lt;span style="COLOR:blue;"&gt;foreach&lt;/span&gt; (IContact contact &lt;span style="COLOR:blue;"&gt;in&lt;/span&gt; account.Contacts)
            {
                &lt;span style="COLOR:blue;"&gt;if&lt;/span&gt; (contact.IsPrimary.HasValue &amp;amp;&amp;amp; contact.IsPrimary.Value)
                {
                    primarycontact &lt;span style="COLOR:navy;"&gt;=&lt;/span&gt; contact;
                    &lt;span style="COLOR:blue;"&gt;break&lt;/span&gt;;
                }
            }
            result &lt;span style="COLOR:navy;"&gt;=&lt;/span&gt; primarycontact;
        }
    }
}&lt;/pre&gt;
&lt;p&gt;You&amp;#39;ll notice that the current account reference is passed in as a parameter to the method and that you&amp;#39;ll set the out param as the return value. That is it. Build the interfaces and then you can add it to the Account Details form just like I had posted earlier (&lt;a class="" href="http://customerfx.com/pages/crmdeveloper/2008/01/08/Custom-Entity-Properties-and-Displaying-the-Primary-Contact-on-the-Account-Detail-Form.aspx"&gt;see previous post&lt;/a&gt;).&lt;/p&gt;&lt;img src="http://customerfx.com/aggbug.aspx?PostID=39178" width="1" height="1"&gt;</description><category domain="http://customerfx.com/pages/crmdeveloper/archive/tags/New+Finds/default.aspx">New Finds</category><category domain="http://customerfx.com/pages/crmdeveloper/archive/tags/SalesLogix+Web/default.aspx">SalesLogix Web</category><category domain="http://customerfx.com/pages/crmdeveloper/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://customerfx.com/pages/crmdeveloper/archive/tags/Customization/default.aspx">Customization</category><category domain="http://customerfx.com/pages/crmdeveloper/archive/tags/Entity+Model/default.aspx">Entity Model</category></item><item><title>Default Page for New SalesLogix 7.2 Web Users</title><link>http://customerfx.com/pages/crmdeveloper/2007/10/02/default-page-for-new-saleslogix-7-2-web-users.aspx</link><pubDate>Tue, 02 Oct 2007 17:36:00 GMT</pubDate><guid isPermaLink="false">e15581aa-2787-4c59-a940-524c09f5d256:38250</guid><dc:creator>Ryan Farley</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://customerfx.com/pages/crmdeveloper/rsscomments.aspx?PostID=38250</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://customerfx.com/pages/crmdeveloper/commentapi.aspx?PostID=38250</wfw:comment><comments>http://customerfx.com/pages/crmdeveloper/2007/10/02/default-page-for-new-saleslogix-7-2-web-users.aspx#comments</comments><description>&lt;p&gt;When a SalesLogix user logs into the SalesLogix 7.2 Web Client for the first time, they will, by default, end up at a blank area since they have not yet selected a default in their user options (Such as the account or contact area). Chnaging this behavior is a simple thing as long as you know where to do it.&lt;/p&gt;
&lt;p&gt;Let&amp;#39;s say for example, you want to have any users, who have not yet selected a default area,&amp;nbsp;go to the accounts area by default. To do this you will do the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the &amp;#8220;Sage SalesLogix&amp;#8221;&amp;nbsp;portal in the Application Architect 
&lt;li&gt;Go to the Support Files tab 
&lt;li&gt;Navigate to &amp;#8220;SmartParts\Options&amp;#8220; 
&lt;li&gt;Right-click the OptionsRedirector.ascx.cs and select Open. The C# file will now open in the Application Architect for you to edit. You&amp;#39;ll see the following code:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="COLOR:blue;"&gt;protected&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;void&lt;/span&gt; Page_PreRender(object sender, EventArgs e)
{
    Sage.SalesLogix.IUserOptionsService opts &lt;span style="COLOR:navy;"&gt;=&lt;/span&gt; &lt;br /&gt;        Sage.Platform.Application.ApplicationContext.Current.Services.Get();
    &lt;span style="COLOR:blue;"&gt;string&lt;/span&gt; defPage &lt;span style="COLOR:navy;"&gt;=&lt;/span&gt; opts.GetCommonOption(&lt;span style="COLOR:#008080;"&gt;&amp;quot;ShowOnStartup&amp;quot;&lt;/span&gt;, &lt;span style="COLOR:#008080;"&gt;&amp;quot;General&amp;quot;&lt;/span&gt;);
    &lt;span style="COLOR:blue;"&gt;if&lt;/span&gt; (defPage !&lt;span style="COLOR:navy;"&gt;=&lt;/span&gt; &lt;span style="COLOR:#008080;"&gt;&amp;quot;&amp;quot;&lt;/span&gt;)
    {
        Server.Transfer(defPage);  
        &lt;span style="COLOR:green;"&gt;//Response.Redirect(defPage, true);
&lt;/span&gt;        &lt;span style="COLOR:blue;"&gt;return&lt;/span&gt;;
    }
}&lt;/pre&gt;&lt;br /&gt;
&lt;li&gt;Edit it to add the following:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="COLOR:blue;"&gt;protected&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;void&lt;/span&gt; Page_PreRender(object sender, EventArgs e)
{
    Sage.SalesLogix.IUserOptionsService opts &lt;span style="COLOR:navy;"&gt;=&lt;/span&gt; &lt;br /&gt;        Sage.Platform.Application.ApplicationContext.Current.Services.Get();
    &lt;span style="COLOR:blue;"&gt;string&lt;/span&gt; defPage &lt;span style="COLOR:navy;"&gt;=&lt;/span&gt; opts.GetCommonOption(&lt;span style="COLOR:#008080;"&gt;&amp;quot;ShowOnStartup&amp;quot;&lt;/span&gt;, &lt;span style="COLOR:#008080;"&gt;&amp;quot;General&amp;quot;&lt;/span&gt;);
    &lt;span style="COLOR:blue;"&gt;if&lt;/span&gt; (defPage !&lt;span style="COLOR:navy;"&gt;=&lt;/span&gt; &lt;span style="COLOR:#008080;"&gt;&amp;quot;&amp;quot;&lt;/span&gt;)
    {
        Server.Transfer(defPage);  
        &lt;span style="COLOR:green;"&gt;//Response.Redirect(defPage, true);
&lt;/span&gt;        &lt;span style="COLOR:blue;"&gt;return&lt;/span&gt;;
    }
    &lt;span style="COLOR:blue;"&gt;else&lt;/span&gt; &lt;span style="COLOR:green;"&gt;// &amp;lt;-- start new code
&lt;/span&gt;    {
        &lt;span style="COLOR:green;"&gt;// set the account page as the default if no
&lt;/span&gt;        &lt;span style="COLOR:green;"&gt;// current default has been selected by user
&lt;/span&gt;        Server.Transfer(&lt;span style="COLOR:#008080;"&gt;&amp;quot;Account.aspx&amp;quot;&lt;/span&gt;);
    } &lt;span style="COLOR:green;"&gt;// &amp;lt;-- end new code
&lt;/span&gt;}&lt;/pre&gt;&lt;br /&gt;
&lt;li&gt;Save and close the file 
&lt;li&gt;Now just redeploy the portal&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Enjoy.&lt;/p&gt;&lt;img src="http://customerfx.com/aggbug.aspx?PostID=38250" width="1" height="1"&gt;</description><category domain="http://customerfx.com/pages/crmdeveloper/archive/tags/Development/default.aspx">Development</category><category domain="http://customerfx.com/pages/crmdeveloper/archive/tags/New+Finds/default.aspx">New Finds</category><category domain="http://customerfx.com/pages/crmdeveloper/archive/tags/SalesLogix+Web/default.aspx">SalesLogix Web</category><category domain="http://customerfx.com/pages/crmdeveloper/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://customerfx.com/pages/crmdeveloper/archive/tags/Customization/default.aspx">Customization</category></item></channel></rss>