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
jenny jadejenny jade 

Active Filed

I have a custom Object called Orders
My Project is to  update the Active Field (which is a picklist) has two values 'yes' and 'no'
Start date is less than today and end date is greater than today then Active field should be 'yes' otherwise 'no'.

I made this project with help of process builder and it worked fine,Let say that start date is something in the futuer for Ex:if today is 24th .I set the date as 26th in start date filed thn on 26th it should automatically become yes .

Please help me



 
Best Answer chosen by jenny jade
anto nirmalanto nirmal

Hey Jenny,
My earlier suggestion of using a formula field was to use it just as an identifier for the status.
If can reflect the status when you open the record, but it does not update on its own.

I understand that your problem statement is Trigger a record update as and when the date changes to suit the business scenario.
This is not possible with a trigger/workflow/process builder.
Because they are get triggered on a record update/insert event.
You might need to use an Schedule Apex that would run every day to update all the records that fall into the scenario. 
Refer the following link on how to write an apex scheduler.
https://help.salesforce.com/apex/HTViewHelpDoc?id=code_schedule_batch_apex.htm

Let us the know if the problem statement is different.

As a common practice, if your question is answered, please choose 1 best answer.
Additionaly you can give every answer a thumb up if that answer is helpful to you.

Regards,
Anto Nirmal

All Answers

anto nirmalanto nirmal
Hi Jenny,

Process Builder only works similar to a trigger, which triggers on a insert/update event.
For your scenario, you should be using a formula field for the Active Field.

Creating a formula field would be a solution for this.

Create a formula field in your custom object, with the following formula:
Close_Date__c > TODAY()  &&  Start_Date__c <= TODAY()

Regards,
Anto Nirmal
anto nirmalanto nirmal
Hey Jenny,

Was that helpful?

Regards,
Anto Nirmal
jenny jadejenny jade
Nopes it was not Its not auto checking the field
Surinder Singh 5Surinder Singh 5
You can create two workflows for the two conditions
one for the start date <today() & end date > today()-----action-----field update =yes
simmilar for rest 
anto nirmalanto nirmal

Hey Jenny,
My earlier suggestion of using a formula field was to use it just as an identifier for the status.
If can reflect the status when you open the record, but it does not update on its own.

I understand that your problem statement is Trigger a record update as and when the date changes to suit the business scenario.
This is not possible with a trigger/workflow/process builder.
Because they are get triggered on a record update/insert event.
You might need to use an Schedule Apex that would run every day to update all the records that fall into the scenario. 
Refer the following link on how to write an apex scheduler.
https://help.salesforce.com/apex/HTViewHelpDoc?id=code_schedule_batch_apex.htm

Let us the know if the problem statement is different.

As a common practice, if your question is answered, please choose 1 best answer.
Additionaly you can give every answer a thumb up if that answer is helpful to you.

Regards,
Anto Nirmal
This was selected as the best answer
jenny jadejenny jade
@Nirmal

Yes you are correct ,the fix for this solution is writing a schedule apex.
Thanks so much.
jenny jadejenny jade
@Surinder

I cannot make use of workflow because I need the action to happen even when there is no update or edit happening on the record.

Thanks much for your help.