Updating Task Status

Hi friends,

Does anyone know of a way to update the Task Status from a scheduled Function?
Imagine MRP ala “Next part to process”

I have a long running function that I sure would love to just update the status instead of writing logs every where. Thanks in advance and hope you are all doing FABULOUS.

Can you explain that a bit more Chris?

Hi Kevin, when I run an Epicor Function as task (on a schedule), I would like to populate the Activity status (I wrongfully called it TaskStatus which is different) with my task’s status.

1 Like

Playing with it a bit, we can do it.

I gotta go for now, but I’ll hit ya back in the morning.

I got it working. Don’t have time to clean up my mess so I’ll post up later.

Y’all have a good weekend.

1 Like

🫨 Dang! Much thanks (and props) in advance

1 Like

This may help @Chris_Conn

3 Likes

No problem Mr. Corn

It did, not quite the same, but I integrated your example as well.

https://www.epiusers.help/t/systaskmonitor-library-update-activity-message-write-to-task-log/104145

1 Like

And if y’all want to laugh at me…

In the test function, I made a typo at first.

  while (keepLooping)
  {
      System.Threading.Thread.Sleep(1000);
      
      TimeSpan timeElapsed = DateTime.Now - startTime;    
  
      if( timeElapsed.TotalSeconds >= numSeconds )
      {
          keepLooping = false;
      }
     
      if(bestGuessSysTaskNum > 0)
      {
          string testMessage = $"Elapsed Seconds: {timeElapsed.TotalSeconds.ToString()}";
          
          //Activity Message
          ThisLib.UpdateSysTaskMonitorActivityMessage(bestGuessSysTaskNum, testMessage);
          
          //Task Log
          ThisLib.WriteToTaskLog(bestGuessSysTaskNum, testMessage, (int)Epicor.ServiceModel.Utilities.MsgType.Info);
      }
  }

Instead of if( timeElapsed.TotalSeconds >= numSeconds )
I had if( timeElapsed.Seconds >= numSeconds )

The number of seconds I passed was 120.
Guess what happened… :rofl:

2 Likes

Lol, he made my screwup the solution, nice! :dumpster_fire: