Fire off job schedulling from rest API?

Is there a way to fire off job scheduling from the API or do I need to make a custom function to access from the API?

You can probably kick it off from the BO, but I wouldn’t recommend it. I strongly believe that all external calls, aside from BAQs, should be wrapped in a function.

2 Likes

From what I can tell, this call ( Erp.BO.JobSchedSvc) looks like the BO method. What little I’ve looked into it, I’m unsure how it would even work.

Looking more like a function is the way to go anyways. Been a while since I did one of those so I gotta freshen up the mind on that again.

You’d want a function anyway since you probably have to chain a couple calls to JobScheSvc. Maybe you’re following it up with a query to confirm the system did what you expected. You probably want to pass only a couple variables via the API (Job, DueDate, Backwards/Forwards) and then you want to return as little as possible (start, due, etc). It is 100% best practice to keep all the logic required by Epicor internal to Epicor. Only send out what needs to be sent out. No more no less.

The internal BO’s are chatty too. Nobody needs the MSSQL SysRowID returned from a Part lookup.

There’s a JobScheduling() method in the JobEntrySvc:

// From the assembly Erp.Contracts.BO.JobEntry.DLL

namespace Erp.Contracts
{
    public interface JobEntrySvcContract : IDisposable
    {
        /*
            ...
        */

        /// <summary>
        /// Calls jc/jcshded.p and performs the job scheduling without an interface like in Sales Order
        /// </summary>
        /// <param name="ipJobNum">The  Job to schedule</param>
        /// <param name="ipReturn">Logical used to determine if you would like the dataset refreshed and brought back.</param>
        /// <param name="ipStartAssemblySeq">The Assembly Sequence to return data for. </param>
        /// <param name="ipCurrentAssemblySeq">The Assembly Sequence to return data for. </param>
        /// <param name="ipCompleteTree">Would you like to retun a complete dataset for this job number? </param>
        /// <returns>Job Entry data set</returns>
        [OperationContract(Name = "JobScheduling")]
        [FaultContract(typeof (EpicorFaultDetail))]
        JobEntryTableset JobScheduling(
          string ipJobNum,
          bool ipReturn,
          int ipStartAssemblySeq,
          int ipCurrentAssemblySeq,
          bool ipCompleteTree);

        /*
            ...
        */
    }
}

It’d be pretty easy to call this function to get the JobEntryTableset return, but I don’t know how that would work passing in parameters like forward/backward scheduling, or start/end dates. To call this with a function you could start with:

string ipJobNum = "755055-1-1"; // Job to scheudle.
bool ipReturn = false;          // True if you would like the dataset refreshed and brought back.
int ipStartAssemblySeq = 0;     // Assembly Sequence to return data for.
int ipCurrentAssemblySeq = 0;   // Assembly Sequence to return data for. (I don't know how these are different. --KV)
bool ipCompleteTree = true;     // True if you Would you like to retun a complete dataset for this job number. (This seems the same as ipReturn? --KV)



CallService<JobEntrySvcContract>( svc => { 

    svc.JobScheduling( ipJobNum, ipReturn, ipStartAssemblySeq, ipCurrentAssemblySeq, ipCompleteTree );

});

10 out of 10 agree to the above.