Login / Register  search  syndication  about

          George Jensen's Blog

George Jensen on Reporting, Business Intelligence, Crystal Reports, Visual Analyzer, and more.

Adding Activities and History to a Custom Main Entity in the Saleslogix Web Client (Part 4)

I am near the end of a series of posts providing some easy to follow steps that will help a developer add the ability to associate Activity and History records for a custom main entity within the SalesLogix Web Client.  Read the previous three posts to catch up on where we are at. Part 1 Part 2, and  Part 3

Since the previous two posts went into great detail, today we are going to mostly focus on the code and where it goes.  You still need the definitions we used in your code in parts 2 and 3.  There are three areas we will modify today in the SalesLogix Application Architect(AA).  Please find and open the following:

CompleteActivity.ascx  (This holds the properties for the Complete Activity Page)
CompleteActivity.ascx.resx (This holds the definition for the labels the page above)
CompleteActivity.ascx.cs (This holds the code supporting the page)

Once again you find these files in the AA under the Project Explorer Tab following same process as detailed in parts 2 and 3.  

Let's get started with the CompleteActivity.ascx. To add our code navigate to the end of line 205, hit the enter button, and paste in the following lines:

<%--Start My Code --%>
<%--End My Code --%>

These should be lines 206 and 207. Go to the end of line 206 and hit the enter key again and then paste the following on empty line 207:

   </tr>
   <tr>
       <td colspan="2"> 
                    <span class="twocollbl"><asp:Label ID="FieldName_lz" AssociatedControlID="FieldName" runat="server" Text="<%$ resources: FieldName_lz.Text %>"></asp:Label></span>
                    <span class="twocoltextcontrol">
                            <SalesLogix:LookupControl Width="95%" runat="server" ID="FieldName" AutoPostBack="true" AllowClearingResult="true" LookupBindingMode="string" ReturnPrimaryKey="true" LookupEntityName="EntityName" LookupEntityTypeName="Sage.Entity.Interfaces.IEntityName, Sage.Entity.Interfaces, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"  >
                        <LookupProperties>
                            <SalesLogix:LookupProperty PropertyHeader="<%$ resources: Lookup_Field1.PropertyHeader %>" PropertyName="Field1" PropertyFormat="None"  UseAsResult="True"></SalesLogix:LookupProperty>
                            <SalesLogix:LookupProperty PropertyHeader="<%$ resources: Lookup_Field2.PropertyHeader %>" PropertyName="Field2" PropertyFormat="None"  UseAsResult="True"></SalesLogix:LookupProperty>
                            <SalesLogix:LookupProperty PropertyHeader="<%$ resources: Lookup_Field3.PropertyHeader %>" PropertyName="Field3" PropertyFormat="None"  UseAsResult="True"></SalesLogix:LookupProperty>
                        </LookupProperties>
                        <LookupPreFilters>
                        </LookupPreFilters>
                        </SalesLogix:LookupControl>
                    </span>
                </td>

Add your definitions using the lists we developed in Part 2.  

The modifications to the ScheduleCompleteActivity.ascx.resx field are pretty much as we did yesterday.  Here we want to navigate near to the very end of the file, on line 326, hit enter and paste in the following lines:

 <data name="FieldName_lz.Text" xml:space="preserve">
 <value>LookupLabel</value>
 </data>
 <data name="Lookup_Field1.PropertyHeader" xml:space="preserve">
 <value>Field1Label</value>
 </data>
 <data name="Lookup_Field2.PropertyHeader" xml:space="preserve">
  <value>Field2Label</value>
 </data>
 <data name="Lookup_Field3.PropertyHeader" xml:space="preserve">
  <value>Field3Label</value>
 </data>

For the CompleteActivity.ascx.cs file there are 6 events we will modify.  Remember to take your time.  The first event we will work on is labeled OnFormBound, just before the closing bracket for the event add the following code:

        Sage.Entity.Interfaces.IActivity act = this.BindingSource.Current as Sage.Entity.Interfaces.IActivity; //Mine
        if (act.FieldName != null) //Mine
        {
            FieldName.LookupResultValue = act.FieldName.ToString(); //Mine
        }

To make sure we are all on the same page here, "FieldName" is the name of the field in the Activity Entity that represents our custom main entity.  In my example FieldName = FXProjectId

 

For the Page_PreRender event, look for a line that looks similar to this:

TicketId.InitializeLookup = (TicketId.SeedValue.Length == 12);

Right under this line add the following line of code and then add your definition for FieldName to the code.

FieldName.InitializeLookup = (FieldName.SeedValue.Length == 12); //Mine

 

For the LeadId_LookupResultValueChanged event, look for a line that looks similar to this:

Activity.AccountId = null;

Right under this line add the following line of code and then add your definition for FieldName to the code.

Activity.FieldName = null;//Mine

 

For the AccountId_ChangeAction event, look for a line that looks similar to this:

Activity.LeadId = null;

Right under this line add the following line of code and then add your definition for FieldName to the code.

Activity.FieldName = null;//Mine

 

For the SetTacoDefaults event, look for a group of code that looks similar to this:

 if (GetParam("tid") != null)
 {
     Activity.TicketId = GetParam("tid")

 }

Right under this code add the following.  In Part 3 (UPDATE WITH LINK) of this series you established an "alias2", make sure to use that same definition for alias2 in this code.

if (GetParam("alias2") != null)//Mine

{

Activity.FieldName = GetParam("alias2");//Mine

}

Still in the SetTacoDefaults event, look for the case statements not to far below the code you just set in place.    You should find a case statement for ITicket.  Add the following group of code on the next line after the break of the ITicket case statement.

 case "IEntityName"://Mine
      found = true;
      IEntityName alias = EntityFactory.GetById<IEntityName>(hist.EntityId.ToString());
      Activity.FieldName = alias.Id.ToString();
      Activity.AccountId = alias.Account.Id.ToString();
      Activity.AccountName = alias.Account.AccountName;
      break;//Mine

This area is setting some defaults based on where you are launching the CompleteActivity page from.  Think about if you were launching from your custom main entity, what field can you pre-populate.  In the example I am providing the assumption there is a relationship to the Account entity named "Account".   You need another definition for alias and this can be anything,  as I did in the last post I am going to use a shorten version of my definition for EntityName so for me alias = fxproj.

The final event today is one labeled OnAddEntityBindings(),  at the end of this event add these two line of code:

 bs.Bindings.Add(new WebEntityBinding("FieldName", FieldName, "LookupResultValue"));//Mine
 bs.Bindings.Add(new WebEntityBinding("AccountId", FieldName, "SeedValue"));//Mine

Remember -  here again, if there is not a relationship to the account from your custom main entity name Account, then either delete or modify the second line as needed.

To test, save all files, build your web platform, then redeploy your site.  When the website comes up go to any open activity in one of the Activity List views, select "Complete" from the list.  When the Complete Activity page opens you should see your field, below you will see mine.

That's enough for today, we will finish out our seires with process for seeing the Activites and hitory Tabs on your custom main entity.

 

 

What's This?
  
Bookmark and Share

About George Jensen

   George Jensen is a Senior Developer for Customer FX Corporation.


Related Content
   Easily Showing and Hiding Tabs at Runtime in Infor CRM (Saleslogix)
Showing and hiding tabs in the Infor CRM (Saleslogix) client should be an easy thing. It should be someth
Posted on Dec 16, 2014 by Ryan Farley to Ryan Farley's Blog
 
   Problem setting SLXTextbox enabled property / Setting unexposed base control properties for a custom control
I recently had an issue with a Quickform where I was attempting to set the Enabled property of a TextBox
Posted on Dec 05, 2014 by Jason Buss to Jason Buss' Blog
 
   Checking Infor CRM (Saleslogix) Picklists for valid data
This week I received a question about a particular picklist. One of the picklist items, when chosen, wou
Posted on Dec 05, 2014 by Dale Richter to Infor CRM Questions & Answers
 
   Avoiding the Dirty Data Message When Programatically Redirecting to a Record in Infor CRM (Saleslogix)
In my last post I wrote about using the OnClientClick property of a control (or button) to run JavaScript
Posted on Dec 02, 2014 by Ryan Farley to Ryan Farley's Blog
 
   Infor CRM (formerly Saleslogix) Web- Dependency Lookup OnChange Event Not Working Correctly
In the Saleslogix 8.1 web client the dependency lookup still has a problem with the OnChange event. 
Posted on Nov 26, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
Comments

 

Twitter Trackbacks for SalesLogix Adding Activities and History to a Custom Main Entity in the Saleslogix Web Client (Part 4): I am near??... [customerfx.com] on Topsy.com said:

Pingback from  Twitter Trackbacks for                 SalesLogix Adding Activities and History to a Custom Main Entity in the Saleslogix Web Client (Part 4): I am near??...         [customerfx.com]        on Topsy.com

May 20, 2010 10:26 AM
 

George Jensen's Blog said:

Today I am sitting in the hospital helping my wonderful wife welcome our fourth child into this world

June 6, 2010 9:45 AM

Leave a Comment

(required)  
(optional)
(required)  
Add
All contents Copyright © 2014 Customer FX Corporation
Customer FX Corporation
2324 University Avenue West, Suite 115
Saint Paul, Minnesota 55114
Tel: 800.728.5783

  Follow @CustomerFX on twitter
Follow the best news, tips, and articles
  Subscribe to Customer FX on youtube
Watch SalesLogix tutorial videos from Customer FX
Login / Register