Issue creating a scheduled task
Moderator: Phil Barton
Issue creating a scheduled task
I've attempted using a code snippet found on the forum to start a scheduled task. I'm getting an thrown exception. Any ideas? In the screenshot, 'trigger' is of type IScheduledTrigger. Is it possible that this is causing the issue on 'tm.ApplyChanges(trigger)'? 'ApplyChanges' per the docs says to pass a trigger of type 'ITrigger'.
-
- Posts: 1382
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Issue creating a scheduled task
Please post the source code and exception call stack.
Bob Richards, Senior Software Developer, SoftPro
Re: Issue creating a scheduled task
I resolved this. I think my issue was that I was performing this operation before the services were available. Question on the topic - in order to get the scheduled task not to be added as a scheduled task every time the package loads, what would be a clear and simple solution? Is there some table that I can set some value on and read as a condition to registering the scheduled task?
-
- Posts: 23
- Joined: Wed Jul 12, 2023 11:29 am
Re: Issue creating a scheduled task
Yes. To check your trigger has already been created, check the [core].[Trigger] table for a row where the Handler column matches the id of your ITriggerHandler. If it exists, then your trigger is already created and you should not create it again.