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
akshithakshith 

Workflow to update a field when end date is met.

Hi All,

I am currently working on a requirement using workflow.

Requirement: Update 'Active' checkbox when a Campaign's "End Date" is met.

I have created a workflow on Campaign object with below mentioned formula:

a. EndDate = Today()
b. EndDate = DATE( YEAR(TODAY()), MONTH(TODAY()), DAY(TODAY()))

workflow action:
Field to UpdateCampaign: Active
Field Data TypeCheckbox
New Field ValueFalse

The problem is:
a. If i create a new campaign with End Date = Today's date. Workflow works fine (Active checkbox is unchecked).
b. If i create a new campaign with End Date = Tomorrow's date. Workflow doesnot set the Active checkbox to unchecked (when i check the record tomorrow).
c. If i manually try to edit any other fields and save the record it works.

I have also tried below mentioned method, without having a field update workflow action. Its also behaving same way.

IF((EndDate =  TODAY()),  IsActive = FALSE, IsActive = TRUE)

Can anybody suggest me as to how to fix this.

Thanks in Advance,
Pam
hisrinuhisrinu
Hi,

For this you need to write a time-dependent workflow, then only it will work otherwise you need to edit that record.
The condition for that you can write like 0 minutes and update that field.

Hope this helps you.
akshithakshith
Hi Srini,

Thanks for your suggestions.

I have now created a time dependent workflow action (as well as Immediate workflow action) with same field update conditions.

For time based trigger, the options were

xx - Hours or Days - After or Before - Rule Trigger Date or Created Date or End Date or Last Modified Date or Start Date

I have entered: 0 Hours After Rule Trigger Date

Please let me know if this is correct or i need to change anything.

Thanks Again,
Pam

hisrinuhisrinu
It is correct, no need to change anything.
akshithakshith
Hi Srini,

I had created 3 campaigns yesterday with end date today. I guess workflow is not getting triggered since field is not updated. However if i create a new campaign with end date today, i do see that field gets updated after 5 mins.

Any other suggestions from you.

Many Thanks,
Pam

hisrinuhisrinu
Hi Pam,

For the existing records it won't update, for the new records only it will update.
It will update with in a minute I guess, I don't have any other idea why it is taking 5 mins.
akshithakshith
Hi Srini,

Thanks for taking your time in replying to my messages.

My requirement is : whenever campaign end date (today, tomorrow, next week, next year... ) is met. I want Active flag to be unchecked. Hence, the workflow needs to update the records which is already created few days back.

current workflow is working fine for campaign's end date today and if its tomorrow.. Active flag is not set to False.

Thanks Again,
Pam