Scheduled Process - Run When Logged Out

Oh, sorry, you may need to add

using Ice.Tablesets;

as well.

Look through the assemblies for one that’s just called Task, then.

I got past the syntax errors by adding the following:

using System.IO;
using Erp.Tablesets;
using Ice.Tablesets;

and adding

Erp.Contracts.BO.Task under References >> Assemblies

However, now I get the following error on the 3rd step in System Monitor when I tried running the UPS:

Program Ice.Services.Lib.RunTask raised an unexpected exception with the following message: RunTask: BPM runtime caught an unexpected exception of 'ArgumentException' type.
See more info in the Inner Exception section of Exception Details.
Stack Trace:
   at Epicor.Customization.Bpm.DirectiveBase`3.Execute(TParam parameters) in C:\_Releases\ICE\ICE3.2.200.34\Source\Server\Internal\Lib\Epicor.Customization.BPM\DirectiveBase.Generic.cs:line 163
   at Epicor.Customization.Bpm.MethodCustomizationBase2`3.<>c__DisplayClass20_0.<RunDirectives>b__3(MethodDirectiveBase`3 dir) in C:\_Releases\ICE\ICE3.2.200.34\Source\Server\Internal\Lib\Epicor.Customization.BPM\MethodCustomizationBase2.cs:line 139
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at Epicor.Customization.Bpm.MethodCustomizationBase2`3.RunDirectives(TParam parameters) in C:\_Releases\ICE\ICE3.2.200.34\Source\Server\Internal\Lib\Epicor.Customization.BPM\MethodCustomizationBase2.cs:line 141
   at Epicor.Customization.Bpm.CustomizationBase2`3.Execute(TParam parameters) in C:\_Releases\ICE\ICE3.2.200.34\Source\Server\Internal\Lib\Epicor.Customization.BPM\CustomizationBase2.cs:line 73
   at Erp.Services.BO.UserProcessWrapperSvcFacade.RunProcess(Int64 taskNum, String action)
   at Erp.Internal.UserProcess.UserProcessRunner.RunProcess(Int64 instanceTaskNum, String outputFileName)
   at Ice.Hosting.TaskCaller.InnerExecuteTask(IceDataContext newContext) in C:\_Releases\ICE\ICE3.2.200.34\Source\Framework\Epicor.Ice\Hosting\TaskCaller\TaskCaller.cs:line 98
   at Ice.Hosting.TaskCaller.ExecuteTask() in C:\_Releases\ICE\ICE3.2.200.34\Source\Framework\Epicor.Ice\Hosting\TaskCaller\TaskCaller.cs:line 57
   at Ice.Lib.RunTask.BpmFriendlyTaskLauncher.Run(String sessionIdPrefix, IceContext db, Action taskRunner) in C:\_Releases\ICE\ICE3.2.200.34\Source\Server\Services\Lib\RunTask\BpmFriendlyTaskLauncher.cs:line 63
   at Ice.Services.Lib.RunTaskSvc.InnerRunTask(Int64 ipTaskNum, Boolean suppressTransaction) in C:\_Releases\ICE\ICE3.2.200.34\Source\Server\Services\Lib\RunTask\RunTask.cs:line 549
Inner Exception:
Illegal characters in path.
Stack Trace:
   at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
   at System.IO.Path.Combine(String path1, String path2)
   at Epicor.Customization.Bpm.BO3AB4E2F9F0094F0E9280FBC6175921E6.RunProcessPreProcessingDirective_AutoCloseExpiredQuotes_938AD3B88C99414287E4346C17772D46.A001_CustomCodeAction()
   at Epicor.Customization.Bpm.BO3AB4E2F9F0094F0E9280FBC6175921E6.RunProcessPreProcessingDirective_AutoCloseExpiredQuotes_938AD3B88C99414287E4346C17772D46.ExecuteCore()
   at Epicor.Customization.Bpm.DirectiveBase`3.Execute(TParam parameters) in C:\_Releases\ICE\ICE3.2.200.34\Source\Server\Internal\Lib\Epicor.Customization.BPM\DirectiveBase.Generic.cs:line 147

I am wondering if anyone can help me determine if there is a way to find the current open task rather than specifying a specific one that may have already been completed? We have Milestone tasks that need to be completed before the quote can be closed. When using this method and specifying a task number (e.g. 10), it does not close the milestone task that is currently open.

You could try a combination of BOs.

image

First, call GetCurrentTaskSeqNum and pass (Company, “QuoteHed”, quoteNum).
That should return an int which should be your current, open task sequence.
Then, call the GetByID and pass the int you got back into the final param of the method.

Something like this (I did not test this for syntax or viability):

int curTaskSeq = taskBO.GetCurrentTaskSeqNum(Session.CompanyID, "QuoteHed",quote.qh.QuoteNum.ToString());

tTS = taskBO.GetByID("QuoteHed", quote.qh.QuoteNum.ToString(), "","",curTaskSeq);