Programatically Creating a Temporary Lookup Group for a specific entity in the SalesLogix web client

In SalesLogix you will often see behavior where after saving a record your are taken to the detail view of the new record and the current group has been set to just the new record.  In the LAN client there was a Application.BasicFunction method exposed to do this.  In the web client there is not a public function exposed for this, however there is a protected method in the Sage.SalesLogix.BusinessRules.dll assembly that shows you how to do it.  The method is called CreateTemporaryLookupGroupForCurrentEntity.  Unfortunately since of its protection level you can not just use this existing method but by using its code you can create your own.  Here is the code you need to do so.  Please note that you need a references to the Sage.SalesLogix.Client.GroupBuilder.dll and Sage.Platform.Application.dll for this code to work:

internal static void CreateTemporaryLookupGroupForCurrentEntity(string tableName, string entityID)
{
    Sage.SalesLogix.Client.GroupBuilder.IGroupContextService service = Sage.Platform.Application.ApplicationContext.Current.Services.Get<Sage.SalesLogix.Client.GroupBuilder.IGroupContextService>() as Sage.SalesLogix.Client.GroupBuilder.GroupContextService;

    if (service != null)
    {
        service.CurrentTable = tableName;
        Sage.SalesLogix.Client.GroupBuilder.EntityGroupInfo currentGroupInfo = service.GetGroupContext().CurrentGroupInfo;
        currentGroupInfo.LookupTempGroup.ClearConditions();
        currentGroupInfo.LookupTempGroup.AddLookupCondition(string.Format("{0}:{0}ID", tableName), entityID);
        currentGroupInfo.LookupTempGroup.GroupXML = Sage.SalesLogix.Client.GroupBuilder.GroupInfo.RebuildGroupXML(currentGroupInfo.LookupTempGroup.GroupXML);
        service.CurrentGroupID = "LOOKUPRESULTS";
    }
}

To build a group you simply do something like this:

CreateTemporaryLookupGroupForCurrentEntity("SALESORDER", entity.Id.ToString());
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) news and product updates!

You have Successfully Subscribed!