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
Phillip MoseleyPhillip Moseley 

Need Validation Formula for Incorrect Order Form is Chosen

When picklist field Opportunity Type is not equal to new customer, then you can't choose the Order Form titled New Customer. So when a user had New Customer for opportunity type and they try to choose the New Customer Order Form, they will get an error message.
 

Thanks for any help.

 

Best Answer chosen by Phillip Moseley
Neetu_BansalNeetu_Bansal
Hi Philip,

I created the validation rule on your org: https://na13.salesforce.com/03da00000011fEm?setupid=CustomObjects

Have a look, as I am not able to create Proposal record on your org so please test, if its working fine. As Order form is not picklist field, so I need to update the formula like this:
AND( 
NOT(ISPICKVAL( BMXQ__Quote__r.Opportunity.Opportunity_Type__c, 'New Customer')), 
IF( BMXQ__Proposal_Template__r.Name == '1. Order Form: New Customer', true, false ) 
)
Let me know, if you need any other help.

Thanks,
Neetu

All Answers

Neetu_BansalNeetu_Bansal
Hi Philip,

Use this formula in the validation rule. I am assuming that the API Name for Opportunity type is Opportunity_Type__c and Order Form is Order_Form__c.
AND(
	ISPICKVAL(Opportunity_Type__c, 'New Customer'),
	ISPICKVAL(Order_Form__c, 'New Customer')
)
Let me know, if you need any other help.

Thanks,
Neetu
Phillip MoseleyPhillip Moseley
Neetu, Thanks for getting back to me so quick. For the Opportunity Type field, I need it to be not equal to New Customer. If Opportunity Type not equal to New Customer, then you can’t pick the New Customer Template. Thanks for your help with this validation rule! Phillip
Neetu_BansalNeetu_Bansal
Ok Philip, try this:
AND(
	NOT(ISPICKVAL(Opportunity_Type__c, 'New Customer')),
	ISPICKVAL(Order_Form__c, 'New Customer')
)
Thanks,
Neetu
Phillip MoseleyPhillip Moseley
Neetu, Here is an error message that I’m getting. I changed the field names to what they are in our Salesforce instance. Any ideas how to correct? Thanks again for your help! [cid:image001.jpg@01D0E0AE.AB15AC40]
Neetu_BansalNeetu_Bansal
Hi Philip,

Its working fine in my org. Can you share you login credentials, so I can have a look. You can contact me on skype id: neetu.bansal.5 or gmail id: neetu.bansal.5@gmail.com.

Thanks,
Neetu
Neetu_BansalNeetu_Bansal
Hi Philip,

Its working fine in my org. Can you share you login credentials, so I can have a look. You can contact me on skype id: neetu.bansal.5 or gmail id: neetu.bansal.5@gmail.com.

Thanks,
Neetu
Phillip MoseleyPhillip Moseley
For login info, do you need my actual username and password or just grant you admin access through Salesforce?
Neetu_BansalNeetu_Bansal
It would be nice if you provide your username and password.
Neetu_BansalNeetu_Bansal
Hi Philips,

Can you please let me know the fields name, I am confused about the exact names. And can I create test data to test the validation rules? You can also add me on skype: neetu.bansal.5 or email id: neetu.bansal.5@gmail.com

Thanks,
Neetu
Phillip MoseleyPhillip Moseley
Neetu, The fields that I need the formula based off are the Opportunity Type field from the opportunity object and then the Proposal Template Name field under the proposals object. [cid:image001.jpg@01D0E1A4.6A7BAA80] [cid:image002.jpg@01D0E1A4.6A7BAA80] If you want to get on a GTM or something together just let me know. Thanks, Phillip
Neetu_BansalNeetu_Bansal
Hi Philip,

I created the validation rule on your org: https://na13.salesforce.com/03da00000011fEm?setupid=CustomObjects

Have a look, as I am not able to create Proposal record on your org so please test, if its working fine. As Order form is not picklist field, so I need to update the formula like this:
AND( 
NOT(ISPICKVAL( BMXQ__Quote__r.Opportunity.Opportunity_Type__c, 'New Customer')), 
IF( BMXQ__Proposal_Template__r.Name == '1. Order Form: New Customer', true, false ) 
)
Let me know, if you need any other help.

Thanks,
Neetu
This was selected as the best answer
Phillip MoseleyPhillip Moseley
Neetu, Thanks so much! This one below is working. I have a couple of more validation rules associated with the same information below, so I wanted to see if you could help me with creating a few more rules If BMXQ Opportunity Type equals New Customer and the Term in Months (Opportunity Field) equals 12,24,36,48,60,72,84, then you can’t use Proposal Template Name = 2. Order Form: Existing Customer If BMXQ Opportunity Type equals anything but New Customer like in formula below and Term in Months (Opportunity Field) is If BMXQ Opportunity Type equals anything but New Customer like in formula below and Term in Months (Opportunity Field) is >12 months, then you can’t use Proposal Template Name = 3. Order Form: Pro-Rata Term > 12 Months If you could help me out with creating these new ones I would really appreciate it. They would all be located in the same place as the previous one you created. Thanks, Phillip
Neetu_BansalNeetu_Bansal
Hi Philip,

I will definately help you out but can you please contact me either on skype id: neetu.bansal.5 or gmail id: neetu.bansal.5@gmail.com because its difficult to communicate over here.

Thanks,
Neetu