+ Start a Discussion
Christophe LucchiniChristophe Lucchini 

multiple IF statement

Hi Guys,

I have this code part:

IF( ISBLANK(Credit_Score_by_Exception__c),

IF(Pellenc_credit_score_FA__c =="1"  ,"50% downpayment for order confirmation payable at 5 days net, 50% for production completion payable at 5 days net",
IF(Pellenc_credit_score_FA__c =="2", "40% downpayment for order confirmation payable at 5 days net, 30 % for production completion payable at 5 days net, 20% for shipping payable at 30 days net, 10% for start-up payable at 30 days net",
IF(Pellenc_credit_score_FA__c =="3", "30% downpayment for order confirmation payable at 5 days net, 30% for production completion payable at 5 days net, 20 % for shipping payable at 30 days net, 10%, for start-up payable at 30 days net, 10% for final reception payable at 30 days net",
IF(Pellenc_credit_score_FA__c =="4", "30% downpayment for order confirmation payable at 5 days net, 10% for shipping payable at 30 days net, 30% for delivery payable at 30 days net, 20% for commissioning payable at 30 days net, 10% for final reception payable at 30 days net ", IF(Pellenc_credit_score_FA__c =="5", "20% Downpayment for order confirmation payable at 5 days net, 30 % for delivery payable at 30 days net, 40% for commissioning payable at 30 days net, 10 % for final reception payable at 30 days net", "NULL" ))))))

And its keep telling me "Error: Incorrect number of parameters for function 'IF()'. Expected 3, received 2"

Can you please help me ?

Thanks !
Brian Barrett 5Brian Barrett 5
you're missing the false clause for the first if. the else NULL is really the false clause for if FA = 5
Christophe LucchiniChristophe Lucchini
Hi Thanks,

Where do i have to put this false clause for the first IF ?

Thanks for the help !
Christophe LucchiniChristophe Lucchini
Ok i have changed the code , now its just :

IF(Pellenc_credit_score_FA__c =="1"  ,"50% downpayment for order confirmation payable at 5 days net, 50% for production completion payable at 5 days net",
IF(Pellenc_credit_score_FA__c =="2", "40% downpayment for order confirmation payable at 5 days net, 30 % for production completion payable at 5 days net, 20% for shipping payable at 30 days net, 10% for start-up payable at 30 days net",
IF(Pellenc_credit_score_FA__c =="3", "30% downpayment for order confirmation payable at 5 days net, 30% for production completion payable at 5 days net, 20 % for shipping payable at 30 days net, 10%, for start-up payable at 30 days net, 10% for final reception payable at 30 days net",
IF(Pellenc_credit_score_FA__c =="4", "30% downpayment for order confirmation payable at 5 days net, 10% for shipping payable at 30 days net, 30% for delivery payable at 30 days net, 20% for commissioning payable at 30 days net, 10% for final reception payable at 30 days net ", IF(Pellenc_credit_score_FA__c =="5", "20% Downpayment for order confirmation payable at 5 days net, 30 % for delivery payable at 30 days net, 40% for commissioning payable at 30 days net, 10 % for final reception payable at 30 days net", "Mauvais"  )))))

Image to show your the result:
User-added image

User-added image

So its doing the thing, but today my manager want me to add a tricky thing , when the field "Credit score by exception" is blank its ok for doing the job , but when the field "Credit score by exception" (its a number field) is not blank we want the "Terms of payement auto" field to go blank , so basically not doing the code below if the field "Credit score by exception"  is not blank.

I search since yesterday and i cannot come to the right code for this, please can someone help me ?

Thanks !
Christophe LucchiniChristophe Lucchini
Anyone can help me with this please ?
Alain CabonAlain Cabon
Hello,

You want conditional values for fields on the client side so it is a javascript code (with or without jquery).

As soon as "Credit score by exception" is not blank (field not empty, (events: onchange, onkeyup)), the "Terms of payement auto" field must be emptied?

Without jQuery:
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_access.htm

Use the $Component global variable to simplify referencing the DOM ID that is generated for a Visualforce component, and reduce some of the dependency on the overall page structure. 
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_best_practices_accessing_id.htm

No developer helped you excepted Brian at the beginning because we don't see your VFP source code and your question is not clear (just a formula or emptied fields with JS? or both probably)

Alain
Christophe LucchiniChristophe Lucchini
Sorry for this, no its just a simple formula returning TEXT as you can see:

User-added image

Cannot do the thing without visualforce ?