Dates should not be strings but a proper Date objects. Also, I see two dteStartDate initialization calls but not dteEndDate. And it is not clear what was the time when you ran and received this error (eg. was it before the start date, and what it the timezone where your client is running?)
Could you post the exact scripting code? Also, which vRO version is this?
I have so much business logic in it before scheduling the workflow, that why I have given a rough example.
This problem has occurred when we scheduling the workflow with the past date, I have tried through vRO(vRO7) by selecting past date look like its working fine but when I do it by a script(programmatically) it is throwing an exception saying Task "test-workflow" already planned in the past!!.
Q1. is vRO allows past date while scheduling
Q2. what is the parameter to set value for "Don't run if task planned in the past"[ this will appear in the vRO dropdown]
Q3. how to update(like start-date,end-date, schedule suspend and resume) a task by script?
Thank you in advance.
The problem is that the flag restartInPast has to be set on the task object returned by the call to scheduleRecurrently(), where the error is thrown, and there is no parameter to pass it earlier.
You can cancel/suspend/resume task by calling the corresponding methods on the task object returned by call to schedule()/scheduleRecurrently(). Check API Explorer documentation for Task scripting class.