Weird schedule problem

Vote:
 

Hi!

I have created my own class with the Execute() method which should erease some pages under a specific node/page pointed out in a property on the Startpage.

The whole thing works like a charm when I run the job manually... but when I schedule the job it doesn't. It seems like there's a problem when I fetch the property from the Startpage... As I said it works very well when I run it manually but when scheduled there's an exception being thrown and it jumps to the fetch part. By trial and error I've found out that it has to do with the Startpage property I'm using.

I've tried inhereting both from the JobBase (using override Execute) and my own PageBaseData (using static Execute) and both fails when scheduled.

I've tested using DataFactory as well as Repository for getting the Startpage property... and they both fail when scheduled but works when manually triggered.

Any ideas on what the problem with this schedule job could be?

#114329
Dec 10, 2014 11:11
Vote:
 
<p>I think you might need to specify a language selector, as the auto detection of language won't work when running is via the scheduler.&nbsp;</p>
#114335
Dec 10, 2014 11:59
Vote:
 
<p>Ah... good advice Per! Though I still have the same problem after trying this:</p> <p>PageData page = DataFactory.Instance.GetPage(PageReference.StartPage, new LanguageSelector("sv"));</p> <p>The exception says content link doesn't have a value:</p> <pre class="brush:html;auto-links:false;toolbar:false" contenteditable="false">Exception has been thrown by the target of an invocation. [The provided content link does not have a value. Parameter name: contentLink]</pre> <p>Which is really weird since it definately has one...</p> <p></p>
#114342
Dec 10, 2014 14:10
Vote:
 
<p>Ah, now I remember. Check out this <a href="https://blog.mathiaskunto.com/2014/05/30/episervers-contentreference-startpage-is-an-empty-reference-when-lacking-binding/">blog</a>&nbsp;and the comments: "<span>You may run into similar problems in scheduled jobs. One way around it is to add a wildcard binding (&ldquo;*&rdquo;) for your default site."</span></p>
#114346
Dec 10, 2014 14:21
Vote:
 
<p>Ah great! That solved it for me... Not totally satisfied with the "fix" but&nbsp;well... it works :) Thanks Per!</p>
#114352
Dec 10, 2014 15:34
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.