0

Short question: How can I can I update a field only if it is empty? I tried IF(ISBLANK('Enrollment_Date__c'),CloseDate) but it needs 3 parameters, I gave it 2. What can I put in the 3rd parameter that will leave the value alone?

Long question: We have an Enrollment Date field on Accounts. When a linked Opportunity is marked as Closed Won I want to set the Enrollment Date to the the Closed Won date.

This isn't to hard to do. We have a Closed Won workflow that kicks off when an Opportunity is closed. However, the issue is I only want this set on the first Opportunity closed won. When we sell additional opportunities I don't want the Enrollment Date to change.

So I have a Date field, and am using a formula to check if it is empty and set it appropriately. If it is empty, set it to Close Date, if not empty (there is a date, and this is not the first Opportunity closed and won) leave it alone.

How can I can I update a field only if it is empty? I tried IF(ISBLANK('Enrollment_Date__c'),CloseDate) but it needs 3 parameters, I gave it 2. What can I put in the 3rd parameter that will leave the value alone?

3 Answers 3

2

Try:

IF(ISBLANK(Enrollment_Date__c),CloseDate,Enrollment_Date__c)

PS: I took the quotes away, I think you don't need them

5
  • Now I am getting Error: Field Enrollment_Date__c does not exist. Check spelling. Which is weird since it most definitely does exist. Commented Jan 8, 2016 at 20:01
  • 1
    Argh. Is this a formula? Commented Jan 8, 2016 at 20:01
  • yes. sorry I will add that info to the question. It is a Formula on a date field in an Opportunity Workflow. Commented Jan 8, 2016 at 20:02
  • 1
    I'm not near an org where I can test your specific example... but the gist is that the third parameter should be the field itself. So, if it is not blank, you'll leave it alone. :) Commented Jan 8, 2016 at 20:03
  • 1
    Cool. I will try that. I was worried about circular logic. I will report my findings. :) Thanks Commented Jan 8, 2016 at 20:04
1

Sebastian showed me you can reference the field itself and it won't change.

So then I just had to get the syntax right. Showing the Formula and using the 'Insert Field' helped. Since it is a Workflow on the Opportunity, you have to reference the account.

What ended up working is this:

IF(ISBLANK( Account.Enrollment_Date__c ),CloseDate,Account.Enrollment_Date__c)

1

you are better using BLANKVALUE(Enrollment_Date__c,CloseDate)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .