Try our conversational search powered by Generative AI!

CMS 12 - scheduled jobs with parameters

Vote:
 

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

In CMS 11 we used Mathias Kunto's solution.

#316181
Jan 25, 2024 20:44
Vote:
 

You should be able to do constructor injection, something like

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

#316222
Jan 26, 2024 11:44
Vote:
 

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

#316352
Jan 29, 2024 20:26
Vote:
 

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. 

#316397
Jan 30, 2024 12:27
Vote:
 

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.

#316440
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.