Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Is there a way we could add fields to the scheduled job?

Vote:
 

Hello,

I have developed some code that would find and replace all references to a given page (whether that'd be in a rich text field, url field, page ref field, or link item collection field).

However, the page references (i.e. the one being searched for and the replacement) are currently hard-coded. 

It'd be great to provide fields in the scheduled job so that we can select the page that we want to find and the page that would replace it.

thanks

jackyjoy

#256705
Jun 16, 2021 14:06
Vote:
 

Yes, you pass the parameters in the scheduled job but it is tricky. Refer to the blog post below-

https://blog.mathiaskunto.com/2012/02/13/supplying-episerver-scheduled-jobs-with-parameters-through-admin-mode/

I suggest you should create a setting item in the site or define a new property on the StartPage and then read the property value in the scheduled job.

#256706
Jun 16, 2021 14:40
Vote:
 
#256707
Jun 16, 2021 19:30
Vote:
 

I haven't tried the Get.ScheduledParameterJob, but I had a lot of difficulty getting the scheduled job parameters to work from Mathias Kunto's blog. Not sure if that was due to changes in the scheduled jobs since the blog post was written.

#256782
Jun 18, 2021 19:25
Vote:
 

Do you need to schedule the execution of this reference replacement?

If not, why do you need it to be a scheduled job?

I would create an admin tool for this. Then you can have all the input you want. I enjoy the occational nostalgia, fiddling around with webforms - or you could be all fancy with this new MVC-stuff if you want to...

#256818
Jun 19, 2021 20:25
* 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.