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
Newbie3333Newbie3333 

Formula ISPICKVAL

I am trying to get current date, when any body select status picklist from deferred,declined or closed. I wrote the formula for it but the problem is when resolved date is set to current date but if I open that request after it is closed after two or three days , it is changing my date to current date ( New). The formula is below.

Resolved Date=

IF( OR(ISPICKVAL(Status__c ,'Declined - Business Lead (Closed)'),ISPICKVAL(Status__c ,'Declined - Change Control (Closed)'),ISPICKVAL(Status__c ,'Deferred - Business Lead (Closed)'),ISPICKVAL(Status__c ,'Resolved - CRM (Closed)')),TODAY(), null)

 

I closed one req on 14th April , resolved date field shows thevalue 14th April but if I open that req after two days the resolved date field change its value from 14th to 16th without doing anything. Please help me.

 

Best Answer chosen by Admin (Salesforce Developers) 
Rise AnalyticsRise Analytics

What you really want here is a Workflow Rule.  Do this:

 

1. Create -> Workflow Rules

2. New Rule

3. Select Object, Name Rule

4. Evaluation Criteria: "created, and any time it’s edited to subsequently meet criteria"

5. Rule Criteria should be Status__c equals any of the 3 you named

6. Add Workflow Action -> Field Update

7. Name and Select the field that will contain the date

8. Use the today() formula for new field value

 

That should solve it.

All Answers

Rise AnalyticsRise Analytics

What you really want here is a Workflow Rule.  Do this:

 

1. Create -> Workflow Rules

2. New Rule

3. Select Object, Name Rule

4. Evaluation Criteria: "created, and any time it’s edited to subsequently meet criteria"

5. Rule Criteria should be Status__c equals any of the 3 you named

6. Add Workflow Action -> Field Update

7. Name and Select the field that will contain the date

8. Use the today() formula for new field value

 

That should solve it.

This was selected as the best answer
Tejpal KumawatTejpal Kumawat

Hi,

 

In formula field date is changing due to TODAY() and formula runs at the real time. So Everyday it will show Date of that day( TODAY).

Workflow is the approiate way to resolve it. You Can also write a short trigger at the time status change Update the Date field.

deepabalisfdcdeepabalisfdc

Trigger:

 I have not tested trigger, concept is what I am posting. you can also write after trigger taking proper measure.


trigger updateResolvedDate on YourObject(before insert, before update){


if(Trigger.new[0].Status__c == 'Deferred - Business Lead (Closed)'  ||
   Trigger.new[0].Status__c == 'Declined - Business Lead (Closed)'' )|| your conditions ){

  Trigger.new[0].ResolvedDate__c = Date.today();

}

 

}

Newbie3333Newbie3333

Thank You very much.....

Mark Deguisne 7Mark Deguisne 7
Have a picklist field that displays text options '1 Night', '2 Nights', '3 Nights', etc. to designate how many nights a reservation is for. Without changing or replacing those picklist values, I need to convert them to Numbers so I can properly report off that information. This is the formula I have tried, however, am not having any luck. Any thoughts?:

IF (ISPICKVAL(  Number_of_Nights__c ,'1 Night'), '1',
IF (ISPICKVAL(  Number_of_Nights__c ,'2 Nights'), '2',
IF (ISPICKVAL(  Number_of_Nights__c ,'3 Nights'), '3',
IF (ISPICKVAL(  Number_of_Nights__c ,'4 Nights'), '4',
IF (ISPICKVAL(  Number_of_Nights__c ,'5 Nights'), '5',
IF (ISPICKVAL(  Number_of_Nights__c ,'6 Nights'), '6',
IF (ISPICKVAL(  Number_of_Nights__c ,'7 Nights'), '7',"")))