Adding a Scheduled Task to NOPCommerce through the database

When working in NOPCommerce, you may want to create a scheduled task without having to go through plugin install and uninstall.

First, you’ll have to have a task set up in ideally a plugin.

You can do so by adding the following to the ScheduleTask table in the NOPCommerce database:

INSERT INTO [dbo].[ScheduleTask]
           ([Name]
           ,[Seconds]
           ,[Type]
           ,[Enabled]
           ,[StopOnError]
           ,[LeasedByMachineName]
           ,[LeasedUntilUtc]
           ,[LastStartUtc]
           ,[LastEndUtc]
           ,[LastSuccessUtc])
     VALUES
           (
           'NAME_OF_TASK'
           SCHEDULE_IN_SECONDS
           'NAMESPACE.ClassName, NAMESPACE'
           IS_ENABLED, -- 1-yes, 0-no
           SHOULD_STOP_ON_ERROR, -- 1-yes, 0-no
           NULL,
           NULL,
           NULL,
           NULL,
           NULL
           )
GO

After that’s done, you should be able to immediately run the task.

Leave a Reply

Your email address will not be published. Required fields are marked *