back to top

Limiting a Product lookup to current Account Product records in Infor CRM (Formerly Saleslogix)

I recently worked on a project which contained a Product Lookup control on an Account-level tab.  In this case, the lookup is only supposed to return products that are also AccountProducts for the current Account.  To do this, you can set the Lookup control to pull from the AccountProduct entity, then use code to save the Product from that entity and save it to your custom entity.

In your lookup control:

Set the Lookup Binding Mode to “Object”, and set the Lookup Entity Name property to “AccountProduct”.  Also, set the SeedProperty property to be “Account.Id”. You will have to type in that value.  Do not set the Data Bindings property on the lookup control.  Since the lookup will return an AccountProduct entity record, we need to handle everything via code.

On the OnChange action of the Lookup Control, create a new C# Snippet Action item.  The code reads as follows:




Sage.Entity.Interfaces.IAccountProduct AP = lkeProductLookup.LookupResultValue as Sage.Entity.Interfaces.IAccountProduct;
if (AP != null)
{
    Sage.Entity.Interfaces.INewTable new = this.BindingSource.Current as Sage.Entity.Interfaces.INewTable;
    new.Product = AP.Product;
}

 

In this code, we are creating an AccountProduct object (AP), and then we create an object for the current entity called “NewTable” (new).  Once we have both entity objects, we simply set the Product entity property with the AccountProduct entity property, and we are good to go.

 

Now that we’re saving the correct Product, we need to add additional code to the form in order to set the seed property of the lookup control.  If we don’t do this, the lookup will return all AccountProduct records instead of just the current Account’s AccountProduct records.  We’re also using the GetParentEntity function to return an Account Entity object for the record we are currently working with.


Sage.Entity.Interfaces.IAccount acc = this.GetParentEntity() as Sage.Entity.Interfaces.IAccount;

if (acc != null) {
    lkeProductLookup.SeedValue = acc.Id.ToString();    
    
}

 

This sets the SeedValue to the current AccountID, restricting the lookup to this Account’s product records.  We already set the SeedProperty property, and this code sets the SeedValue property.

 

One final item…  Since the Lookup control is unbound, we would normally need to add some code on the Load action of the form, to show the records product value in the product control.  When working on this, I found that you couldn’t set the Lookup control’s LookupResult property.  Even if setting that property, the value wouldn’t display.  In order to get around this, I changed the Lookup Display Mode to be “Button Only”, and I added that control, along with a bound text box control to a control container.  The text box has it’s DataBindings set to NewTable.Product.Name, so no code is needed to display the records Product record at all.

 That’s all there is to it!  I hope you find this post helpful.  Thanks for reading!

 Jason

 

 

Contact Customer FX for your CRM project
We let our expertise speak for itself - let us know how our all-star team can help on your CRM project
About the Author
Jason Buss
Jason Buss
Jason is a senior application developer with Customer FX.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Infor CRM Sync for Exchange: Action Required by August 31, 2026

Using Infor CRM Sync for Exchange with Microsoft 365? Your Exchange administrator must update tenant settings by August 31, 2026 to prevent sync disruption.

[Webinar] What’s Coming Next for Infor CRM SLX and Why v10 Matters

See what’s coming next for Infor CRM SLX, including new marketing workflows, automation improvements, and reasons to consider upgrading to v10.

Disable Caching in Infor CRM SLX Web Client

In the rare case caching is causing issues in the Infor CRM SLX web client, it is possible to disable specific types of caching by making edits using Application Architect, and then deploying.

Exploring AI Options for Infor CRM v10

I've started taking a closer look at the AI capabilities built into Infor CRM v10. Over the next several posts, I'll share what I learn. From the built-in features and supported AI providers to implementation considerations, costs, and practical use cases.

Infor CRM SLX 10.0: Delegate Ownership Changes for “Everyone” Records

Learn how the new EveryoneOwnerAssignment secured action in Infor CRM SLX 10.0 allows designated users to change ownership of Everyone-owned records without requiring Administrator access.

Related Articles

Infor CRM Sync for Exchange: Action Required by August 31, 2026

Using Infor CRM Sync for Exchange with Microsoft 365? Your Exchange administrator must update tenant settings by August 31, 2026 to prevent sync disruption.

[Webinar] What’s Coming Next for Infor CRM SLX and Why v10 Matters

See what’s coming next for Infor CRM SLX, including new marketing workflows, automation improvements, and reasons to consider upgrading to v10.

Disable Caching in Infor CRM SLX Web Client

In the rare case caching is causing issues in the Infor CRM SLX web client, it is possible to disable specific types of caching by making edits using Application Architect, and then deploying.

Exploring AI Options for Infor CRM v10

I've started taking a closer look at the AI capabilities built into Infor CRM v10. Over the next several posts, I'll share what I learn. From the built-in features and supported AI providers to implementation considerations, costs, and practical use cases.

Related Videos