+ Start a Discussion
bathybathy 

Make Products entry compulsory for all opporutnites

Hi All,

Any way to make Product entry compuslory for all opportunities other than just propmpting users to attach products to an opportunity?

Please advise.

Thanks,
bathybathy
I tried a validation rule NOT(OR(ISNEW(),HasOpportunityLineItem)) provided by salesforce but it is not working. It is giving error while changing the opportunity and also giving error while adding products

please help!!!
sweetzsweetz
Please refer this 

https://help.salesforce.com/apex/HTViewSolution?id=000003656&language=en_US (https://help.salesforce.com/apex/HTViewSolution?id=000003656&language=en_US)

bathybathy
@sweetz@salesforce, I tried this but it didn't work

sweetzsweetz

It worked for me... Did you enable the checkbox on opportunity settings? How you created opportunity?

 

bathybathy
@sweetz how will this work can you please explain me?

Will it ask the user to attach products to the opportunity while creating an opportunity or while changing the opportunity?

And amount field is not being used in any of the page layouts we currently use.

Please advise.

Thanks

bathybathy
@sweetz
I have changed the field level security if the amount field cutomise>>opportuities>>felds>>Amount>>set field level secuirty and then check box "Read only" for all the profiles and also enabled the opportunity settings "propmt users to add products and services".

It prompts users to add products and services to the oppty but if the user clicks "cancel" button then the oppty gets saved without a product attached to it.

Or requirement is to enforce product entry while creating oppty. PLease advise if any other way exists.

Thanks in advance
sweetzsweetz
Yes , if we click cancel then only opportunity will get saved. thats a known issue. If u read the knowledge article which also tells u under what circumstances that wont work. We can have a trigger to achieve this functionality. 
bathybathy
Can you please guide me how to develop Trigger for this?

Thanks,
sweetzsweetz
please have a look on this following trigger

http://salesforce.stackexchange.com/questions/4225/opportunity-management
bathybathy
Hi Sweetz, 


My requirement is to force the users to attach products to an oppty. These triggers genarate errors when we press save button and doesn't allow the user to add products to that oppty. 

sweetzsweetz
On intially if you want to do then have that prompt user method, we can override the save button to navigate that to create a new product. else after creating an opportunity say on particualr stage, i need the product to move to next stage there we can have a trigger enforcing the user to add a product. If that is  the case then we can have a trigger like this

For example
trigger createcontact on Opportunity (before insert)

{
  for(Opportunity opp : Trigger.new){

        if(opp.Stage== 'Qualification'){
            opp.addError('Please add a product');
        }
    } 

}


The previous link(http://salesforce.stackexchange.com/questions/4225/opportunity-management) which i said follows the second scenario.