How the Owner field is enabled in the SalesLogix 7.5 web client

In the 7.5 web client the Owner lookup will become enabled/disabled based upon a built-in Account Entity business rule.

I posted this information on Good Training as well, but thought I would report here for those who do not frequent that site.

The Account Entity Business rule which determines if the Owner Lookup control is enabled or not is called CanChangeOwner Which is a boolean returning rule.  This rule is as follows:

public static void CanChangeOwner(IAccount account, out bool result)
{
result = false;
IUser user = ((SLXUserService) ApplicationContext.Current.Services.Get<IUserService>(true)).GetUser();
Owner owner = null;
try
{
owner = (Owner) account.Owner;
}
catch (ObjectNotFoundException)
{
result = false;
return;
}
if (!(user.Id.ToString().Trim() == "ADMIN"))
{
if (owner.OwnerType == OwnerType.System)
{
if ((owner.Id == "SYST00000001") || (owner.Id == "SYST00000002"))
{
result = false;
}
else
{
result = false;
}
}
if (owner.OwnerType == OwnerType.Team)
{
if (IsTeamLeader(owner, user))
{
result = true;
}
else
{
result = false;
}
}
else if (owner.OwnerType == OwnerType.User)
{
if (owner.Id.ToString() == user.DefaultOwner.Id.ToString())
{
result = true;
}
else
{
result = false;
}
}
}
else
{
result = true;
}
}
This routine returns true or false. False if edits are not allowed. 

The code basically it checks if the current user is not Admin, and within that if the current account is owned by a system team (Everyone or Everyone Read Only) then it returns false. If the Account is owned by a team then it checks if the user is a Team Leader (meaning the user has an Owner Security profile set on the team that owns the Account ) then it returns True otherwise False.  Finally if the account is owned by a user, only the default user (The person whose team it is) can change the owner.

This rule could be replaced with custom rule but it can not be modified as it is contained in the base Sage.SalesLogix.BusinessRules.dll.  It may also be possible to add a Post Execute Step to the default business rule to override the base boolean return code, though I have not tested that approach.

This business rule is called on the Account Details Page Load event:

//Begin Load Action

     Sage.Entity.Interfaces.IAccount account = this.BindingSource.Current as Sage.Entity.Interfaces.IAccount;
     Owner.Enabled = account.CanChangeOwner();
     pklSubType.PickListName = account.GetSubTypePickListName();

//End Load Action}

You could change this to a custom rule instead such as:

//Begin Load Action

     Sage.Entity.Interfaces.IAccount account = this.BindingSource.Current as Sage.Entity.Interfaces.IAccount;
     Owner.Enabled = account.CustomCanChangeOwner();
     pklSubType.PickListName = account.GetSubTypePickListName();

//End Load Action}

ABOUT THE AUTHOR

Kris Halsrud

Kris Halsrud is a Senior Analyst / Developer for Customer FX Corporation.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!