Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

CMS 12 - scheduled jobs with parameters


Did anyone find a solution to adding parameters with scheduled jobs in cms12?

In CMS 11 we used Mathias Kunto's solution.

Jan 25, 2024 20:44

You should be able to do constructor injection, something like

public FullSearchIndexJob(IServiceProvider serviceProvider, LocalizationService localizationService, IndexBuilder indexBuilder)

Jan 26, 2024 11:44

Quan, I'm not following. How does your example relate to Mathias solution?

Jan 29, 2024 20:26

By parameters I suppose you meant settings. You can add an Options object which can be set via appsettings.json as a constructor dependency to your scheduled job. 

Jan 30, 2024 12:27

In this case I'd have created a new block type with relevant settings and assign it to a content reference on start page. The job can easily locate the block and use the settings there. It is not as convenient as the plugin you shared but would do the job.

Jan 31, 2024 9:03
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.