Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Bronze Super Contributor
Posts: 141
Registered: ‎02-22-2010

Filtering SLX Lookups Dynamically 7.5.3 Web Help Needed Urgently

Hi

 

I am having requirement where i need to restrict account lookup on add assocation form so that i need to return only broker type of accounts for one condition and all accounts for another condition

 

So i have written my code below

 

(if (my conition succeded))

 

{

 

luToIDText.LookupPreFilters.Add("Type", "Broker");

 

 

  }

 

i have written this code on form bound page of addeditaccountasociation.ascx.cs.

 

But it is not working .

 

 

When i give the same filter in static mode (like below) i am able to see the filtered accounts

 <SalesLogix:LookupPreFilter PropertyName = "Type" PropertyType = "System.String" OperatorCode = "=" FilterValue = "Broker">

 

 

but i want dynamically filtering lookup lease Help

 

 

Jack

 

  

Employee
Posts: 629
Registered: ‎04-24-2009

Re: Filtering SLX Lookups Dynamically 7.5.3 Web Help Needed Urgently

It would be something like the following, in an OnLoad event (e.g. QuickForm Load Action):

 

SalesLogix.HighLevelTypes.LookupPreFilter oFilter = new SalesLogix.HighLevelTypes.LookupPreFilter();
oFilter.LookupEntityName = "Sage.Entity.Interfaces.IAccount";
oFilter.PropertyName = "Type";
oFilter.OperatorCode = "=";
oFilter.FilterValue = "Broker";
oFilter.PropertyType = "System.String";
luToIDText.LookupPreFilters.Add(oFilter);

 

Thanks

 

Mike

Tuned Listener
Posts: 2
Registered: ‎08-12-2010

Re: Filtering SLX Lookups Dynamically 7.5.3 Web Help Needed Urgently

hi

Been trying this but doesn't seem to work, my code is:

 

In OnLoad Step Snippet

(Also added Sage SalesLogix.HighLevelTypes.dll" as Assembly Reference in Snippet)

 

form.lueBidAdmin.LookupPreFilters.Clear();

Sage.SalesLogix.HighLevelTypes.LookupPreFilter oFilter = new Sage.SalesLogix.HighLevelTypes.LookupPreFilter();

oFilter.LookupEntityName = "Sage.Entity.Interfaces.IUserInfo";

oFilter.PropertyName = "UserName";

oFilter.OperatorCode = "=";

oFilter.PropertyType = "System.String";

oFilter.FilterValue = "Gary Jeffery";

form.lueBidAdmin.LookupPreFilters.Add(oFilter);

Have I missed Anything?

Regards

Gary Jeffery

 

 

Employee
Posts: 629
Registered: ‎04-24-2009

Re: Filtering SLX Lookups Dynamically 7.5.3 Web Help Needed Urgently

You may have to set the On Repaint Event to True for the script. Please see the attachment. Also, is the Lookup control based on User or "User Info"? Assuming User Info, since that's what you're querying.

 

Thanks

 

Mike

Employee
Posts: 4
Registered: ‎06-17-2009

Re: Filtering SLX Lookups Dynamically 7.5.3 Web Help Needed Urgently

Hi Guys,

 

Since it sounds like you know the results of your condition on form load, it might be a little simpler to have two different lookups, one with each set of pre-filters required.  Then you can conditionally show/hide them in the quckform load action based on your criteria.  There would be a little more AA set up involved, but I believe there would be fewer points of failure.

 

Let us know how it goes.

 

 

Highlighted
Copper Contributor
Posts: 8
Registered: ‎10-03-2010

Re: Filtering SLX Lookups Dynamically 7.5.3 Web Help Needed Urgently

Greetings,

 

I know this thread is pretty old but I struggled with the same issue for quite some time and figure a consolidated answer would be helpful.

 

The problem with LookupPreFilters is that they are cached and are only reset when 1) the web server is restarted (not simply forcing a new login) and 2) your browser cache is flushed.  This means that once a condition is set, it will stay that way for quite a while.

 

Therefore, it's not possible to create dynamic filters using LookupPreFilter.  Instead, you should be using the Lookup.SeedValue and .SeedProperty values.

 

Kris Halsrud has a good explanation on how:

http://customerfx.com/pages/integrationblog/2009/11/18/dynamically-restricting-saleslogix-lookups-co...

 

An example:  I want to display users who are members of a specific business unit (a custom entity based on a complex view -- I have a second lookup that is for the user display that I am not describing here; this example wouldn't properly display an IUser entity -- I set that in an associated value-changed event)

 

_lueAMSearch.Lookup.LookupEntityName = "IUsersettinguserbuassociation";
_lueAMSearch.Lookup.LookupEntityTypeName = typeof(IUsersettinguserbuassociation).AssemblyQualifiedName;
_lueAMSearch.Lookup.LookupBindingMode = LookupBindingModeEnum.Object;
_lueAMSearch.Lookup.LookupProperties.Add(new LookupProperty() { PropertyHeader = "User", PropertyName =                "User.UserInfo.UserName", PropertyFormat = PropertyFormatEnum.None, UseAsResult = true });
_lueAMSearch.Lookup.LookupProperties.Add(new LookupProperty() { PropertyHeader = "BU", PropertyName = "Buname", PropertyFormat = PropertyFormatEnum.None, UseAsResult = false });

 

For this to work, I have to have the BU lookup property present.  Then I can set the filter value on the .PreRender() (haven't tested .Load() but it should work as we have the data bindings at that point).

_lueAMSearch.SeedProperty = "Buname";

_lueAMSearch.SeedValue = BoundEntity.OpportunityExtension.BusinessUnit.Name.ToString();

 

(Where BoundEntity is the current opportunity in our framework code.)

 

Hope this helps those in the future who run into the same problem...

 

Cheers,

Greg