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
David PoynterDavid Poynter 

Plaguing issues with Due Date field for Tasks in Process Composer

So this issue has been plagging us for a while. Our simple use case is to automatically reassing tasks that are assigned to users who are currently out of office. We have three fields on the user level: 
Out of Office replacement user
Out of office start date
Out of office end date

The process builder simply determines if the "Due Date Only" field (API - ActivityDate) is in between the start and end date of the assigned to user, and if it is, runs a flow to reassign it!

The issue is that for some unknown reason we continue to be plagged by errors like "moduleapi.interaction.DateTime cannot be cast to moduleapi.interaction.DateOnly" that revolve around DateTime and Date conversions and formulas, even though supposedly all fields are just simply date fields.

I was reading somewhere however that the ActivityDate field on the task can sometimes have time included somehow? Is this true?

How can I make a process builder that regardless of technically if it is a DateTime or just a Date, it converts it to just a date, and runs the process accordingly. I can't for the life of me figure out some way to sort of do a "Try/Catch" scenario, where it tries casting a DateTime to a date, and then if it fails it assumes it is just a Date to begin with. Or something along those lines.

This issue has been increadibly agrivating and annoying so any help would be greatly appreciated. here is the full error:

Error element myDecision (FlowDecision).
moduleapi.interaction.DateTime cannot be cast to moduleapi.interaction.DateOnly


Flow Details
Flow Name: Out_of_Office_Automatic_Reassignment
Type: Record Change Process
Version: 15
Status: Active
Org: Bernicke Wealth Management, Ltd. (00DF00000006JX5)
Flow Interview Details
Interview Label: Out_of_Office_Automatic_Reassignment-15_InterviewLabel
Current User: Lindsey Hendrickson (0050G000008KmVU)
Start time: 12/20/2018 12:12 PM
Duration: 0 seconds
How the Interview Started
Lindsey Hendrickson (0050G000008KmVU) started the flow interview.
Some of this flow's variables were set when the interview started.
myVariable_old = null
myVariable_current = Task (00T2I0000567t2JUAQ)
ASSIGNMENT: myVariable_waitStartTimeAssignment
{!myVariable_waitStartTimeVariable} Equals {!$Flow.CurrentDateTime}
Result
{!myVariable_waitStartTimeVariable} = "12/20/2018 12:12 PM"


To me with error makes absolutley no sense, especially since the only fields we are dealing with are Date fields! (supposedly)
Best Answer chosen by David Poynter
David PoynterDavid Poynter
Thank you for the idea. It didn't exactly work but it did get me a step closer. I couldn't just use DateValue on the ActivityDate field because salesforce legitimately only sees it as sometimes a datetime field and sometimes a date, which causes there to be a syntax error. But what I was able to do is create a formula field that converts to activity date to text, trims it to just the date section, and then converts that text to a Date field (which works on either a date field or a datetime field)!

This worked and fixed the error! However now it simply doesn't trigger on some of my processes. It works for most, but not others. But at least now it doesn't throw an error. Any ideas? 

All Answers

Syed Insha Jawaid 2Syed Insha Jawaid 2
Hi David

Try the DATEVALUE function in your process builder and then compare values or you can also create a formula field on Activity of Date format and then use it in process builder.

Cheers!!!!
David PoynterDavid Poynter
Thank you for the idea. It didn't exactly work but it did get me a step closer. I couldn't just use DateValue on the ActivityDate field because salesforce legitimately only sees it as sometimes a datetime field and sometimes a date, which causes there to be a syntax error. But what I was able to do is create a formula field that converts to activity date to text, trims it to just the date section, and then converts that text to a Date field (which works on either a date field or a datetime field)!

This worked and fixed the error! However now it simply doesn't trigger on some of my processes. It works for most, but not others. But at least now it doesn't throw an error. Any ideas? 
This was selected as the best answer
Syed Insha Jawaid 2Syed Insha Jawaid 2
Hi David

In which scenario it doesn’t work?? Could you explain a bit.

Cheers!!!!
David PoynterDavid Poynter
Yeah so I think the issue now lies beyond the scope of this post. It turns out that all tasks created by a thrid party/installed app called Process Composser (designed by Orchestrate) are the ones not properly triggering the process builder. We determined that when we removed any of the logic referencing the user fields, it worked properly. So right now I think the issue lies withing Process Composser, I have designed a work around (transfering the creteria/logic from the process builder to the flow), which allows it to trigger all the time without errors, however I believe the issue is actually one with how Ochestrate designed it's product, seeing as everything else works just fine without the need for a workaround.
Syed Insha Jawaid 2Syed Insha Jawaid 2
Ok David.