As a top Microsoft Dynamics CRM consultant, we get a lot of inbound questions regarding development and training related to this powerful CRM. In this installment of our series on free dev tutorials, our team demonstrates a Dynamics CRM custom lookup feature. For more tutorials on Dynamics CRM you can visit our blog.

In Dynamics CRM, the addCustomFilter() function allows a developer to specify criteria to be applied as a filter to a lookup field. Adding filter criteria is easy until the field you want to filter on is not explicitly related to the entity you’re looking up. To help with this, today we’re demonstrating how to spin up a Dynamics CRM custom lookup feature. In this example, we have an “Account Short List” entity that we want to use as a custom filter for an account lookup. We’ve added 3 accounts to the list, but you could add as many accounts as you want.

Executing Dynamics CRM Custom Lookup

We also created a “Test Account” entity that has an Account lookup field.

We’ve added the account lookup field to the Test Account form layout.


One thing that’s important is that if possible, any data query happen asynchronously before the lookup is performed. In this case, we’re getting records from the account short list on page load. The query here does not have to be directly related to the lookup entity. If you have query filter criteria, which you probably will in a real-world scenario, you can use the $filter syntax in your OData query.

At this point, we have a javascript array populated with Account IDs that we want to use in our lookup filter. The fetchXml for the addCustomFilter() function allows an “in” operation. We’ll be using this feature to look for Account GUIDs. We can do a quick javascript loop over the array to build the fetchXml string and add the string as the account field’s filter. As a quick note, to keep the example simple, no check was added for an empty short list, but you should consider this scenario in production code.


Wrap-up — Dynamics CRM Custom Lookup

These tools should help your business successful execute a Dynamics CRM custom lookup feature inside of your instance. There a wide number of uses for this kind of functionality that are not just limited to a sales team. In fact, we’ve done a lot of our development work recently for service-facing organizations that want to mold the CRM to help manage other parts of their business. For more information about our ability to assist with Dynamics CRM custom development, or deployment of Dynamics CRM software system, contact our experts today.

Becky Lipnick

Recent Posts

Salesforce Integration Consulting And Solution Options

Salesforce integration consulting is about more than just finding a partner with experience in integrations.…

8 months ago

Hand-Picked Digital Marketing Platforms for Manufacturers

Platform: HubSpot Where It Shines: Email marketing - easy to use email lists, automation, and…

9 months ago

2024 Manufacturing Trends

Don’t be left behind by neglecting these 2024 manufacturing trends.

9 months ago

Maximizing ROI with CloudSuite Industrial

With a comprehensive ERP like CloudSuite Industrial (CSI) from Infor, there are countless possibilities for…

10 months ago

Infor ERP Releases Innovative Features

An Infor ERP solution isn’t just a temporary fix to today’s issues, it’s an investment…

10 months ago

Infor ERP Integrations

An Infor ERP can dramatically improve your operations, but with an ERP integration, you can…

10 months ago