Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Saturday, July 5, 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: Setting Control properties from a business rule
Donovan Mitchell
Posts: 5
 
Setting Control properties from a business ruleYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Aug 09 12:35 PM
Hi All,

I'm having trouble implementing a business rule, setting a control property based on team membership. I'm hoping that someone can tell me if I'm going down the right path with how I'm trying to do this, and if so, to shed some light on an error I'm receiving.


The field is a picklist on the AccountDetail form. I created a business rule under account with the followng code:

namespace Sage.BusinessRules.CodeSnippets
{
public static partial class AccountBusinessRules
{
public static void CanEditDealerPriorityStep1(IAccount account)
{
// TODO: Complete business rule implementation
Sage.SalesLogix.Security.SLXUserService usersvc = (Sage.SalesLogix.Security.SLXUserService)Sage.Platform.Application.ApplicationContext.Current.Services.Get();
Sage.Entity.Interfaces.IUser user = usersvc.GetUser();

if (IsUserOnTeam(user, "test")) {
IAccountDetails.AccountType = true;
}
else {
IAccountDetails.AccountType = false;
}
}

private bool IsUserOnTeam(Sage.Entity.Interfaces.IUser user, string team)
{
using (NHibernate.ISession session = new Sage.Platform.Orm.SessionScopeWrapper()) {
return 0 < Convert.ToInt32(session.CreateQuery("select count(*) from OwnerRights r where r.Owner.OwnerTypeChar = :type and r.Owner.OwnerDescription = :teamname and r.User.Id = :accessid").SetAnsiString("type", Sage.SalesLogix.Security.StringEnum.GetStringValue(Sage.SalesLogix.Security.OwnerType.Team)).SetAnsiString("teamname", team).SetAnsiString("accessid", user.Id.ToString()).UniqueResult());
}
}
}
}



I added this business rule to the LoadAction items on the accountdetail form, but I get the following exception:

Exception information:
Exception type: DynamicMethodException
Exception message: Unable to locate type information 'Sage.BusinessRules.CodeSnippets.AccountBusinessRules, Sage.SnippetLibrary.CSharp' for business rule 'Account.CanEditAccountType'


I should add, I'm useing the code that Ryan provided in his blog to determine team membership:

http://customerfx.com/pages/crmdeveloper/2009/02/04/determining-if-a-user-is-a-member-of-a-team-in-saleslogix-web.aspx



Am I barking up the wrong tree here? If not, I'm sure I'm missing something basic...

Any ideas?

Thanks
[Reply][Quote]
Alexander Pfingstl
Posts: 43
 
Re: Setting Control properties from a business ruleYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 05 Aug 09 2:56 AM
Hi,

You can not modify controls from a business rule.
The business rule is just logic, it is not for modifying any controls.
What you can do is return a value from the rule, which you use in the load action to modify the control.
So if you e.g. return True, then you can do something like
if (account.myrule)
pklAccountType.Enabled = Fales;

This would work.

Thanks!
Alexander
[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): 7/5/2025 7:07:31 AM