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
ACDSeeACDSee 

4 check boxes for different Tax scenarios

I created 4 custom fields (check boxes) on the Opportunity page for different tax scenarios my company has:

GST

GST & PST
HST
Miami Dade Tax

 

I need to prevent the opportunity from being saved if 2 or more check boxes are selected, while still being allowed to save the opportunity if no check boxes are selected.  Any idea how I would do this?

 

FYI - I had started off with a picklist, but unfortunately you cannot write IF statements for picklists.

Error: Field TaxSelect is a picklist field. Picklist fields are only supported in certain functions.
Best Answer chosen by Admin (Salesforce Developers) 
Steve :-/Steve :-/

Okay, then all you really need is one picklist and a couple of formula fields and you should be all set.

 

Picklist: Tax Type

 

Tax Rate: Formula(Percent(0))

 

IF(ISPICKVAL(TaxType__c, "GST"), 0.05,

IF(ISPICKVAL(TaxType__c, "GST & PST"), 0.12,

IF(ISPICKVAL(TaxType__c, "HST"), 0.12,

IF(ISPICKVAL(TaxType__c, "MDT"), 0.07,

0.00))))

 

 Tax: Formula(Currency)

 

Amount * Tax_Rate__c

 

 Total Amount: Formula(Currency)

 

Amount + Tax__c

 

 

 

 

 

 

Message Edited by Stevemo on 12-16-2009 03:24 PM

All Answers

StefanStefan

You mention that started with a pick list but cannot write IF statements. Have a look at IPICKVAL()  See help

 

IF(ISPICKVAL(StageName, "Closed Won"), 
ROUND(Amount *0.02, 2), 0)

 

ACDSeeACDSee

so I tried this, but I can't get the syntax correct...

 

CASE(Tax, IF(ISPICKVAL (TaxType__c, "GST"), 0.05 * Amount, IF(ISPICKVAL("GST & PST"),​ 0.12 * Amount, IF(ISPICKVAL("HST"), 0.12 * Amount, IF(ISPICKVAL("MDT"), 0.07 * Amount, 0)))))

Steve :-/Steve :-/

Have you thought about changing it from 4 Checkbox fields to 2 Single-Value Picklists with a field dependancy?  That would eliminate the need for a validation routine altogether.

 

Picklist 1(Master):

A

B

C

D

 

Picklist 2 (Dependant):

A

B

C

D

 

Picklist 1 = A: Picklist 2 Choices = B, C, D 

Picklist 1 = B: Picklist 2 Choices = A, C, D 

Picklist 1 = C: Picklist 2 Choices = A, B, D 

Picklist 1 = D: Picklist 2 Choices = A, B, C  

 

 

ACDSeeACDSee

I think if I further clarify what I am trying to accomplish, it should help in finding a solution...

 

My company has offices in Victoria, BC (Canada) and Miami, FL (USA)

  • Purchases in Canada - Customer pays 5% GST Tax
  • Purchases in Eastern Canada - Customer pays 12% HST Tax
  • Purchases in British Columbia - Customer pays 5% GST and 7% PST Tax
  • Purchases in Florida - Customer pays 7% Miami Dade Tax
  • Purchases from anywhere else in the USA they do not pay tax
  • Purchases from anywhere else in the world they do not pay tax

 

In order to create quotes I need:

  • A custom field containing the Tax Amount (if applicable)
  • A custom field to display the Total Amount including Tax

 

The business logic is:

  • A Tax amount must be selected for each Opportunity.
  • A Tax amount is either No Tax, GST, GST & PST, HST, or MDT

 

Make sense?

 

Steve :-/Steve :-/

Okay, then all you really need is one picklist and a couple of formula fields and you should be all set.

 

Picklist: Tax Type

 

Tax Rate: Formula(Percent(0))

 

IF(ISPICKVAL(TaxType__c, "GST"), 0.05,

IF(ISPICKVAL(TaxType__c, "GST & PST"), 0.12,

IF(ISPICKVAL(TaxType__c, "HST"), 0.12,

IF(ISPICKVAL(TaxType__c, "MDT"), 0.07,

0.00))))

 

 Tax: Formula(Currency)

 

Amount * Tax_Rate__c

 

 Total Amount: Formula(Currency)

 

Amount + Tax__c

 

 

 

 

 

 

Message Edited by Stevemo on 12-16-2009 03:24 PM
This was selected as the best answer
ACDSeeACDSee

Stevemo....THANK YOU!!!!

 

Works like a charm. I was trying to do everything in a single statement, didn't think to split it out :P

Steve :-/Steve :-/

No problem, that's why they pay me the BIG Bucks!  :smileyhappy:

 

You could probably get there is a single formula (although I wouldn't wanna wrestle with it).  Breaking it out also gives you the ability to pull things like your Tax Rate, Tax, etc. into reports and also display them right on the opportunity page for reference.  

Message Edited by Stevemo on 12-16-2009 07:07 PM