Inquiring the Name of a Job

I have developed a job which updates several fields in a table. This table has a comment field and as part of the update I’d like to insert the name of the job being run. So that I dont have to hard-code the job name in my code, is there a means of querying the job name?

Without including the full job, this is a sample bit of code which should help explain

static void myJob(Args _args)
    str myJobName = ??????
    info(strFmt("The name of this job is: %1", myJobName));

The expected output would be;

The name of this job is: myJob

Any help with this would be greatly appreciated

TIA, Paul

Why would you do that?

You should never put any production code to jobs and the problem is trivial if you use the right thing: a class (classId2name(classIdGet(this)) or just funcName()).

My job is a data fix script used to correct data for an AX Add-on. The affected table has a comment field which I use to highlight that the record has been updated by my job. Currently, I just set the field with the hardcoded job name. I was just intrigued if I could inquire of the job’s name

That doesn’t explain why you don’t use classes for your business logic. By the way, are you aware of the fact that jobs run on client? I would execute data updates on AOS.

But if you insist, you can try what funcName() does in jobs.