Getting the RecurringJobId from a JobId in FilterAttribute


Is there a way to get the RecurringJobId from a JobId within a FilterAttribute


RecurringJob.AddOrUpdate<DoThat>("MyJob", x => x.DoThis(), Cron.Minutely);

Within the FilterAttribute

public void OnPerforming(PerformingContext filterContext)
    var jobId = filterContext.JobId;
    // i would like here to get "MyJob" string value based on the jobId
    var recurringJobId = ??

What do you want to do with recurring job id here?

I would like to get the recurring job id at this level so I can check if is paused.
Using the technique explained here Pause/disable recurring job

Hi @Massanu
This thread is long dead, but did you managed to get the recurringJobId? I’ve got similar problem: How to check if BackgroundJob was created by RecurringJob, not launched from eg. Dashboard?

I used the following code in a FilterAttribute to get the recurringJobId.

filterContext.Connection.GetJobParameter(filterContext.BackgroundJob.Id, "RecurringJobId")

I needed to make a id-specific disableconcurrentexecution attribute