+ Start a Discussion
sfdc-admin-smsfdc-admin-sm 

Trying to populate a date field by a workflow field update

Hello,

 

I need some help.

 

I am trying to automatically populate a date fieId (Expiration_Date__c) by a workflow field update based on multiple values of the Term field (Term__c)

 

So for example,

 

If Term__c  = 1 then the Expiration_Date__c = Start_Date__c + 1 month

If Term__c  = 6 then the Expiration_Date__c = Start_Date__c + 6 months

If Term__c  = 12 then the Expiration_Date__c = Start_Date__c + 12 months

If Term__c  = 24 then the Expiration_Date__c = Start_Date__c + 24 months

 

Please help me create this formula for the workflow field update.

 

Thanks,

Best Answer chosen by Admin (Salesforce Developers) 
Venkat PolisettiVenkat Polisetti

@sfdc-admin-sm,

 

@saravanan is right. You will need to use one of those functions. Looks like you need to learn to write SF formulas.

 

CASE( term__c,
1, Start_Date__c + (1 * 30),
6, Start_Date__c + (6 * 30),
12, Start_Date__c + (12 * 30),
Start_Date__c + (24 * 30))

 

Salesforce does not have a formula function to add months to a date. You can only add days. You can find a custom formula to add months in these boards, but that would definitely exceed your compile size of your formula.

 

Read formula manual pages here: http://login.salesforce.com/help/doc/en/customize_formulas.htm

 

Hope this helps,

 

Thanks,

All Answers

Saravanan @CreationSaravanan @Creation

Hi

 

Please refer the CASE() function on the formula.

sfdc-admin-smsfdc-admin-sm

Venkat PolisettiVenkat Polisetti

@sfdc-admin-sm,

 

@saravanan is right. You will need to use one of those functions. Looks like you need to learn to write SF formulas.

 

CASE( term__c,
1, Start_Date__c + (1 * 30),
6, Start_Date__c + (6 * 30),
12, Start_Date__c + (12 * 30),
Start_Date__c + (24 * 30))

 

Salesforce does not have a formula function to add months to a date. You can only add days. You can find a custom formula to add months in these boards, but that would definitely exceed your compile size of your formula.

 

Read formula manual pages here: http://login.salesforce.com/help/doc/en/customize_formulas.htm

 

Hope this helps,

 

Thanks,

This was selected as the best answer