How to write to task log from scheduled Functions

I am searching for a way to write to task log from scheduled Function. What is preventing me from doing this is taskNum which is missing and I can’t find it.

I have to imagine that is simply database sequenced from the SysSequence table. They have built in methods for managing those.

new Ice.Lib.NextValue(Db).GetNextSequence("SomeSequenceMakeItCustomIfYouWant").ToString("00000"); // Throw a tostring if you need something front padded with zero
//Company Specific
using (var libCompanySequence = new Erp.Internal.Lib.CompanySequence(Db))
    var nextCustID= libCompanySequence.GetNextCompanySequence(Session.CompanyID, "SomeSequenceMakeItCustomIfYouWant").ToString();

Something to that effect where the quoted string is your key. You would have to go to the sys sequence table to see what that key is.

TaskNumber is assigned when task is executed and passed to RunProcess method. Therefore in custom dll it was possible to get it by i.e. overriding RunProcess method. It is not so simple as sequence which is stored for other things.