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
RizzyOneRizzyOne 

Can't seem to do equal comparison on number field in workflow rule

Hello,

 

I've got a field "Days_Since_Creation" that is of datatype "Formula (Number)" for the number of days since an order was created, basically it gets the value by subtracting the current date from the order created date. The value stored is a number that increases every day, "1", then "2", then "3", etc.  

 

In my workflow rule criteria, I'm trying to have a formula evaluate to true when the "Days_Since_Creation" is 50. I'm trying "Days_Since_Creation = 50" but it doesn't work. When I try something like "5 = 5" then it returns true. 

 

Does anyone know what could be wrong?

 

 

Thank you.

SabrentSabrent

Are  you getting an error or is the workflow rule not firing?

What is your Evaluation Criteria?

RizzyOneRizzyOne

I'm sending an email with this workflow and it's not sending an email. How would I check if any errors are being generated?

 

My criteria is: Days_Since_Creation = 50

 

Also of note, if I do "Days_Since_Creation > 49" then it will send the email when Days_Since_Creation is 50.

 


 

 

SabrentSabrent

Is your workflow rule active?

 

You can check the Debug logs to see what's happening.

 

RizzyOneRizzyOne

Yeah, the workflow is active. If I do a "5 = 5" or even "Days_Since_Creation > 49" then the email is sent. 

 

I checked the debug log, and the value of "Days_Since_Creation" is 50. If I use the VALUE() function around "Days_Since_Creation" then it gives me an error that the paramater is incorrent "Expected Text, received Number" so it is indeed a number.

SabrentSabrent

I mimicked your requirement without any issues, try this.

So, in the Object Order__c you have a field Days_Since_Creation__c which is a formula field with a return type number.

i.e.

Days_Since_Creation__c = TODAY() - DATEVALUE(CreatedDate)

(Note: Data Type = Formula, Decimal Places = 0)


In the workflow rule,


Object = Order__c

Evaluation Criteria: When a record is created, or when a record is edited and did not previously meet the rule criteria


Rule Criteria:    Days_Since_Creation__c = 50

Workflow Actions:

Type: Email Alert


In the Debug log, check the part where the workflow begins, something like this-


13:41:12.207 (207377000)|WF_SPOOL_ACTION_BEGIN|Workflow
13:41:12.209 (209273000)|WF_FIELD_UPDATE|[Position: P-0005 a00E0000002Smvw]|Field:Position: Owner|Value:Unclaimed Positions Queue|Id=04YE0000000GobM|CurrentRule:Assign Position to Recruiter (Id=01QE0000000IDQm)
13:41:12.209 (209302000)|WF_RULE_INVOCATION|[Position: P-0005 a00E0000002Smvw]
13:41:12.209 (209313000)|WF_EMAIL_ALERT|Id=01WE0000000Go3K|CurrentRule:Total job Posting (Id=01QE0000000Ibct)
13:41:12.269 (269504000)|WF_EMAIL_SENT|Template:00XE0000000Wluj|Recipients:xxxxyyyzzz@mail.com |CcEmails:abc295@companyservices.com
13:41:12.269 (269541000)|WF_ACTION| Field Update: 1; Email Alert: 1;

 

Note: see the last line where I get to know that this workflow fired an Email Alert

 

Let me know how you go.

RizzyOneRizzyOne

Ok, so I figured out why I couldn't use the equal comparison. I had to use this in the formula: ROUND(TODAY() - Creation_Date__c, 0)