Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Saturday, June 28, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Web Forums - SalesLogix Web Platform & Application Architect
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Web Platform & Application Architect | New ThreadView:  Search:  
 Author  Thread: Reference "current" entity from Account.aspx.cs
Remy
Posts: 42
 
Reference "current" entity from Account.aspx.csYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 May 11 7:47 AM
fiogf49gjkf0d

Hello,


I am trying to hide/unhide tabs based on Account Type. I was able to hide/unhide tabs from Account.aspx.cs using TabWorkspace, however, I'm not sure how to go about determining the current Account Type. On any given smartpart I would typically use: 


 



Sage.Entity.Interfaces.IAccount account = (Sage.Entity.Interfaces.IAccount)this.BindingSource.Current;


But in Account.aspx.cs, I get the error: this.BindingSource does not exist...


I have a feeling I know why this occurs but I'm not sure of a way to workaround. 


It is interesting that the AA Help file has instructions to do my specific task (I found it right after I had figured out the hide/unhide code), however, that code does not work.


Here is the help file code:




<h1>Hiding/Unhiding a Tab at Run-Time

You can hide and unhide a tab using code in a module. Take as an example Sage.SalesLogix.Client.Account.Module which among other things, controls the display of the AccountResellerOpportunities tab on the Account Detail page. If the account type is not 'Partner', it hides the tab. If the account type is 'Partner', it unhides the tab. Note that the explicit unhide is required since the tab state persists.


This was accomplished through code in the AccountModule.cs using the Hide method of tabWorkspace to hide and unhide.


 public void Load()


{


     I Account account = EntityFactory.GetById<IAccount>(EntityService.EntityID.ToString());


     if (account != null)


    {


        PageWorkItem workItem = PageWorkItemLocator.GetPageWorkItem();


        TabWorkspace tabWorkspace = workItem.Workspaces["TabControl"] as TabWorkspace;


         if (account.Type != Resource.ACCOUNT_TYPE_PARTNER)


         {


//   Hide


             tabWorkspace.Hide("AccountResellerOpportunities", true);


          }


          else


          {


//   Unhide


             tabWorkspace.Hide("AccountResellerOpportunities", false);


          }


     }


}


 



 


First, PageWorkItem and TabWorkspace need to have the full path to their assembly in front.


This is the code I used instead:



Sage.Platform.WebPortal.Workspaces.Tab.TabWorkspace workspace = this.PageWorkItem.Workspaces["TabControl"] as Sage.Platform.WebPortal.Workspaces.Tab.TabWorkspace;


So now I just need to find Account Type by using:



I Account account = EntityFactory.GetById<IAccount>(EntityService.EntityID.ToString());


Even when I fix it to:



Sage.Entity.Interfaces.IAccount accout = Sage.Platform.EntityFactory.GetById<Sage.Entity.Interfaces.IAccount>(EntityService.EntityID.ToString());


I get the error:


The name 'EntityService' does not exist in the current context


 


Any ideas?

[Reply][Quote]
Remy
Posts: 42
 
Re: Reference "current" entity from Account.aspx.csYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 May 11 8:30 AM
fiogf49gjkf0d

Oh btw, I have 7.5.3. And sorry for the long horizontal scrolling

[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: Reference "current" entity from Account.aspx.csYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 May 11 3:48 PM
fiogf49gjkf0d

This is how to do it:


For example, I added this code to the OnLoad event of Account.aspx.cs:



<span style="font-family: Consolas; font-size: x-small;">
ClientEntityContextService service = base.PageWorkItem.Services.Get<ClientEntityContextService>(); 

string entityID = service.EntityContext.EntityID == null ? "" : service.EntityContext.EntityID.ToString(); 
if (entityID != "" )  

{

    IAccount acct = Sage.Platform.EntityFactory.GetById<IAccount >(entityID); 

}

else

{

    // List View was loaded

}




[Reply][Quote]
Remy
Posts: 42
 
Re: Reference "current" entity from Account.aspx.csYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 May 11 10:16 AM
fiogf49gjkf0d

So much time wasted when all I needed was slxdeveloper.com and Raul. It worked perfect. Thanks Raul!


Small note: I needed to qualify IAccount...Sage.Entity.Interfaces.IAccount

[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: Reference "current" entity from Account.aspx.csYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 May 11 12:06 PM
fiogf49gjkf0d

On your need to qualify it, yes you would have to.


When I was playing with this I had added a using Statement to the Page.


 


Now, one thing I did not mention, but you probably are quite aware of is that Typicaly (unless you remove it), the Account.aspx.cs is created dynamically from the Account Detail Page Item on the App Architect, so you need to backup your changes and re-publish them after every Deploy from App Architect.

[Reply][Quote]
Remy
Posts: 42
 
Re: Reference "current" entity from Account.aspx.csYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 May 11 6:42 AM
fiogf49gjkf0d

Thanks Raul, I did actually know that beforehand but forgot and found out again the hard way yesterday. 

[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 6/28/2025 9:40:47 PM