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
rmranjith8881.3927046400771116E12rmranjith8881.3927046400771116E12 

Based on Two Picklist Fields One Number Filed Should gets Updated?

Hi All,

I have 2 picklist fields:
1.) Tenure of Support:Values are 3 Years, 4 Years, 5 Years
2.) Installment Period: Monthly, Quarterly, Half-Yearly, Yearly.

Installments: It is another Field(Number)

1.)If i select Tenure of SUpport as 3 Years and Installment Period as Monthly, then update the Installments as 36.
2.)If i select Tenure of SUpport as 4 Years and Installment Period as Monthly, then update the Installments as 48.
3.)If i select Tenure of SUpport as 5 Years and Installment Period as Monthly, then update the Installments as 60.
4.)If i select Tenure of SUpport as 3 Years and Installment Period as Quarterly, then update the Installments as 12.
5.)If i select Tenure of SUpport as 4 Years and Installment Period as Quarterly, then update the Installments as 16.
6.)If i select Tenure of SUpport as 5 Years and Installment Period as Quarterly, then update the Installments as 20.
7.)If i select Tenure of SUpport as 3 Years and Installment Period as Half-Yearly, then update the Installments as 6.
8.)If i select Tenure of SUpport as 4 Years and Installment Period as Half-Yearly, then update the Installments as 8.
9.)If i select Tenure of SUpport as 5 Years and Installment Period as Half-Yearly, then update the Installments as 10.
10)If i select Tenure of SUpport as 3 Years and Installment Period as Yearly, then update the Installments as 3.
11)If i select Tenure of SUpport as 4 Years and Installment Period as Yearly, then update the Installments as 4.
12)If i select Tenure of SUpport as 5 Years and Installment Period as Yearly, then update the Installments as 5.

For that, We are going to use the Field Update evaluates formula.

Is it achieve by Filed update?

If you Say Yes, Can you try out and let me know?

Thanks In Advance..........
Best Answer chosen by rmranjith8881.3927046400771116E12
SethuSethu
Hi, I have sent you the code previously. In my org,I have used result field as formula data type with return type as number.For me It is working good,I double checked each and every conditions that you have mentioned.Copy and paste my code Try again using formula field

IF((ISPICKVAL(Tenure_of_support__c,"3")&& ISPICKVAL(Instalment_period__c ,"Monthly")),36,
 
If((ISPICKVAL(Tenure_of_support__c, "4")&& ISPICKVAL(Instalment_period__c ,"Monthly")),48,

IF((ISPICKVAL(Tenure_of_support__c, "5")&& ISPICKVAL(Instalment_period__c ,"Monthly")), 60,

IF((ISPICKVAL(Tenure_of_support__c,"3")&& ISPICKVAL(Instalment_period__c ,"Quarterly")),12,
 
If((ISPICKVAL(Tenure_of_support__c, "4")&& ISPICKVAL(Instalment_period__c ,"Quarterly")),16,

IF((ISPICKVAL(Tenure_of_support__c, "5")&& ISPICKVAL(Instalment_period__c ,"Quarterly")), 20,

IF((ISPICKVAL(Tenure_of_support__c, "3")&& ISPICKVAL(Instalment_period__c ,"Half-Yearly")), 6,

IF((ISPICKVAL(Tenure_of_support__c, "4")&& ISPICKVAL(Instalment_period__c ,"Half-Yearly")), 8,

IF((ISPICKVAL(Tenure_of_support__c, "5")&& ISPICKVAL(Instalment_period__c ,"Half-Yearly")), 10,

IF((ISPICKVAL(Tenure_of_support__c, "3")&& ISPICKVAL(Instalment_period__c ,"Yearly")),3,

IF((ISPICKVAL(Tenure_of_support__c, "4")&& ISPICKVAL(Instalment_period__c ,"Yearly")),4,

IF((ISPICKVAL(Tenure_of_support__c, "5")&& ISPICKVAL(Instalment_period__c ,"Yearly")),5,0))))))))))))
 

All Answers

@anilbathula@@anilbathula@

Hi rmranjith8881.3927046400771116E12,

Use if condition in the field update use this formula:

If(TEXT(Tenure of Support__c)=" 4 Years"&&TEXT(Installment Period__c)="Monthly",'36',if(TEXT(Tenure of Support__c)="5 Years"&&TEXT(Installment Period__c)="Quarterly",'48','000'))

I have just done for two conditions you need to put remaining conditions in the place of '000' .

Hope this will help you.

Thanks
Anil.B
RamuRamu (Salesforce Developers) 
The below one is the most optimized formula, try this out and let me know if it worked.

if(ISPICKVAL( Installment_Period__c ,"Monthly"),12,if(ISPICKVAL(Installment_Period__c ,"Quarterly"),4,if(ISPICKVAL(Installment_Period__c ,"Half-Yearly"),2,if(ISPICKVAL(Installment_Period__c ,"Yearly"),1,0)))) * IF(ISPICKVAL( Tenure_of_Support__c ,"3 Years"),3,IF(ISPICKVAL(Tenure_of_Support__c,"4 Years"),4,IF(ISPICKVAL(Tenure_of_Support__c,"5 Years"),5,0)))
SethuSethu
Hi [rmranjith8881.3927046400771116E12] rmranjith8881.3927046400771116E12,

I have done the entire thing for you.

IF((ISPICKVAL(Tenure_of_support__c,"3")&& ISPICKVAL(Instalment_period__c ,"Monthly")),36,
 
If((ISPICKVAL(Tenure_of_support__c, "4")&& ISPICKVAL(Instalment_period__c ,"Monthly")),48,

IF((ISPICKVAL(Tenure_of_support__c, "5")&& ISPICKVAL(Instalment_period__c ,"Monthly")), 60,

IF((ISPICKVAL(Tenure_of_support__c,"3")&& ISPICKVAL(Instalment_period__c ,"Quarterly")),12,
 
If((ISPICKVAL(Tenure_of_support__c, "4")&& ISPICKVAL(Instalment_period__c ,"Quarterly")),16,

IF((ISPICKVAL(Tenure_of_support__c, "5")&& ISPICKVAL(Instalment_period__c ,"Quarterly")), 20,

IF((ISPICKVAL(Tenure_of_support__c, "3")&& ISPICKVAL(Instalment_period__c ,"Half-Yearly")), 6,

IF((ISPICKVAL(Tenure_of_support__c, "4")&& ISPICKVAL(Instalment_period__c ,"Half-Yearly")), 8,

IF((ISPICKVAL(Tenure_of_support__c, "5")&& ISPICKVAL(Instalment_period__c ,"Half-Yearly")), 10,

IF((ISPICKVAL(Tenure_of_support__c, "3")&& ISPICKVAL(Instalment_period__c ,"Yearly")),3,

IF((ISPICKVAL(Tenure_of_support__c, "4")&& ISPICKVAL(Instalment_period__c ,"Yearly")),4,

IF((ISPICKVAL(Tenure_of_support__c, "5")&& ISPICKVAL(Instalment_period__c ,"Yearly")),5,0))))))))))))
 
rmranjith8881.3927046400771116E12rmranjith8881.3927046400771116E12
Hi @anilbathula@

Thanks for your reply,

Here is my formula,

If(
TEXT( Tenure_of_Support__c )=" 3 Years"&&TEXT( npe03__Installment_Period__c )="Monthly",'36',
if(TEXT( Tenure_of_Support__c )="3 Years"&&TEXT( npe03__Installment_Period__c )="Quarterly",'12',
if(TEXT( Tenure_of_Support__c )="3 Years"&&TEXT( npe03__Installment_Period__c )="Half-Yearly",'6',
if(TEXT( Tenure_of_Support__c )="3 Years"&&TEXT( npe03__Installment_Period__c )="Yearly",'3',
if(TEXT( Tenure_of_Support__c )="4 Years"&&TEXT( npe03__Installment_Period__c )="Monthly",'48',
if(TEXT( Tenure_of_Support__c )="4 Years"&&TEXT( npe03__Installment_Period__c )="Quarterly",'16',
if(TEXT( Tenure_of_Support__c )="4 Years"&&TEXT( npe03__Installment_Period__c )="Half-Yearly",'8',
if(TEXT( Tenure_of_Support__c )="4 Years"&&TEXT( npe03__Installment_Period__c )="Yearly",'4',
if(TEXT( Tenure_of_Support__c )="5 Years"&&TEXT( npe03__Installment_Period__c )="Monthly",'60',
if(TEXT( Tenure_of_Support__c )="5 Years"&&TEXT( npe03__Installment_Period__c )="Quarterly",'20',
if(TEXT( Tenure_of_Support__c )="5 Years"&&TEXT( npe03__Installment_Period__c )="Half-Yearly",'10',
if(TEXT( Tenure_of_Support__c )="5 Years"&&TEXT( npe03__Installment_Period__c )="Yearly",'5')
)
)
)
)
)
)
)
)
)
)
)


I am getting this error:

Error: Incorrect number of parameters for function 'if()'. Expected 3, received 2

Thanks In advance.............
 
SethuSethu
Hi ,
At last line if(TEXT( Tenure_of_Support__c )="5 Years"&&TEXT( npe03__Installment_Period__c )="Yearly",'5',0 then close all brackets.
rmranjith8881.3927046400771116E12rmranjith8881.3927046400771116E12
Hi SethuRaman E,

Thanks for your Reply,

When i change this to 
if(TEXT( Tenure_of_Support__c )="5 Years"&&TEXT( npe03__Installment_Period__c )="Yearly",'5','0' and i closed all brackets.

Again i am getting this error:

Error: Incorrect parameter type for function 'If()'. Expected Number, received Text.

Thanks in Advance........
 
SethuSethu
Hi, I have sent you the code previously. In my org,I have used result field as formula data type with return type as number.For me It is working good,I double checked each and every conditions that you have mentioned.Copy and paste my code Try again using formula field

IF((ISPICKVAL(Tenure_of_support__c,"3")&& ISPICKVAL(Instalment_period__c ,"Monthly")),36,
 
If((ISPICKVAL(Tenure_of_support__c, "4")&& ISPICKVAL(Instalment_period__c ,"Monthly")),48,

IF((ISPICKVAL(Tenure_of_support__c, "5")&& ISPICKVAL(Instalment_period__c ,"Monthly")), 60,

IF((ISPICKVAL(Tenure_of_support__c,"3")&& ISPICKVAL(Instalment_period__c ,"Quarterly")),12,
 
If((ISPICKVAL(Tenure_of_support__c, "4")&& ISPICKVAL(Instalment_period__c ,"Quarterly")),16,

IF((ISPICKVAL(Tenure_of_support__c, "5")&& ISPICKVAL(Instalment_period__c ,"Quarterly")), 20,

IF((ISPICKVAL(Tenure_of_support__c, "3")&& ISPICKVAL(Instalment_period__c ,"Half-Yearly")), 6,

IF((ISPICKVAL(Tenure_of_support__c, "4")&& ISPICKVAL(Instalment_period__c ,"Half-Yearly")), 8,

IF((ISPICKVAL(Tenure_of_support__c, "5")&& ISPICKVAL(Instalment_period__c ,"Half-Yearly")), 10,

IF((ISPICKVAL(Tenure_of_support__c, "3")&& ISPICKVAL(Instalment_period__c ,"Yearly")),3,

IF((ISPICKVAL(Tenure_of_support__c, "4")&& ISPICKVAL(Instalment_period__c ,"Yearly")),4,

IF((ISPICKVAL(Tenure_of_support__c, "5")&& ISPICKVAL(Instalment_period__c ,"Yearly")),5,0))))))))))))
 
This was selected as the best answer
rmranjith8881.3927046400771116E12rmranjith8881.3927046400771116E12
Hi SethuRaman E,

Thanks for your Solution, Its Perfect Answer.