function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
KirstyFranceKirstyFrance 

Product Lookup - How to eliminate inactive products

I have a product lookup on a custom object. Unfortunately it does not seem possible to eliminate in active products from the lookup, meaning people can easily make mistakes. 

 

Does any one know of a simple solution for this?

Best Answer chosen by Admin (Salesforce Developers) 
matermortsmatermorts

I think the validation rule is pretty simple. It'll take you all of five or ten minutes to implement, and no maintenance in the future. I agree it would be a lot easier if filters were available for Product.

 

Vote for this idea and/or this idea on the IdeaExchange (they're basically the same and will probably be merged at some point). Hopefully Salesforce will listen to us on this one.

All Answers

matermortsmatermorts

I hope this fits your definition of "simple" solution :-)

 

Since lookup filters are not available when looking up to the standard Product object, I think you have two options.

 

1) Create a custom object to store your product records. This will obviously mean that your OpportunityProduct object will be rendered useless, so I'm guessing this is out of the question.

 

2) Create a validation rule that basically says, if the product selected is inactive, don't allow saving the record. Syntax should look something like this: Product__r.IsActive = False (substitute "Product__r" for whatever the API name is on your product lookup). In addition to this, make sure your lookup results page shows the Active checkbox, so your users know before selecting a product, whether it's active or not. If they select an inactive product, they will be greeted with an error when trying to save. Hopefully they wouldn't even select the inactive product in the first place, noticing that the checkbox isn't checked, in the lookup results. But if they try to save it with the inactive product, at least they'll get the error, and will go back in and select a different product.

 

Does that help?

KirstyFranceKirstyFrance

Thanks for the reply.

 

As you suggested 1 does not work as we want to use products with opportunities. Number 2 would work, although I was looking for a solution where we could not see the products at all, in order to have a shorter list.

 

I've looked everywhere and it would seem there is no easy solution for that right now?

S AnandS Anand

Hi,

 

Are you using standard page or Visual force page for your custom object.

In case you are using Visual force page, I have a solution for you. My company is releasing a free component in Appexchange called Dynamic lookups where you can setup any filter and use the lookup as part of a visual force page. It works on all custom and standard objects including product.

 

If it suits you, let me know and I'll share the package details.

 

thanks

 

Anand

 

KirstyFranceKirstyFrance

Hi there,

 

We are using a standard page at the moment. Would be interested in the solution for the Visual Force page as we have not yet launched the functionality.


Many thanks

Kirsty

matermortsmatermorts

I think the validation rule is pretty simple. It'll take you all of five or ten minutes to implement, and no maintenance in the future. I agree it would be a lot easier if filters were available for Product.

 

Vote for this idea and/or this idea on the IdeaExchange (they're basically the same and will probably be merged at some point). Hopefully Salesforce will listen to us on this one.

This was selected as the best answer
KirstyFranceKirstyFrance

Voted!

 

Thanks

Jerun JoseJerun Jose
Hi,

I have a custom lookup to Product object and as a non-admin I find it impossible to select inactive products in the lookup.

Any insight on this?