Checking If the Current User is on the Same Team as the Account Manager in Infor CRM Web

Checking to see if the current user is on the same team as an account’s account manager is an easy task. Luckily, the User entity has a built-in business rule called GetUserTeamMembers which returns a list of OwnerJoin entities. For these OwnerJoin entries, the Child property will contain the Owner entity for each team member for the user. You can check if the current user is on the same team as the account manager using the following code:

var account = this.BindingSource.Current as Sage.Entity.Interfaces.IAccount;
var currentUser = Sage.SalesLogix.API.MySlx.Security.CurrentSalesLogixUser;

// get account manager's team members
var teamMembers = account.AccountManager.GetUserTeamMembers();

// now check if current user is on account manager's team
if (teamMembers.FirstOrDefault(x => x.Child.Id == currentUser.DefaultOwner.Id) != null)
{
    // current user is on same team as account manager
}

Note, the code uses FirstOrDefault so if this is in a business rule (or anything other than a C# Snippet Action) you’ll need to add using System.Linq to your using directives.

ABOUT THE AUTHOR

Ryan Farley

Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He’s been blogging regularly about SalesLogix since 2001 and believes in sharing with the community. He loves C#, Javascript, Python, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

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) news and product updates!

You have Successfully Subscribed!