How to programmatically call the "Create Jobs" button on Order Entry program in Epicor 10?


(Arash Farmagham) #1

Hi everyone,

I have been trying to figure out the functionality behind the “Create Jobs” button on the summary page of Order Entry program. Basically when you click on it, it creates jobs for line releases that are set as ‘Make Direct’.

I have been trying to automate this so when user creates lines and saves, I would call the methods required to create jobs. I have done tracing and debugging on adapter methods but I have not been able to catch anything.

Have you guys ever tried to automate this button’s functionality?

I would appreciate your help and feedback! Thank you!


(Chris Conn) #2

I’ve never dealt with it, but if the intention is just to call that on save, it should be straight forward (assuming there are no repercussions for calling it when unneeded - for example, user clicks save multiple times)

//on save (get this even either from the toolclick or by after adapter method Update
Find the guid of the button.
var myButton = (EpiButton)csm.GetNativeControlReference(“The guid here”);
myButton.PerformClick();


(Arash Farmagham) #3

Thanks Chris,

Great solution, however I have been looking for a solution that is independent of the UI where I can call elsewhere.

Thanks and I appreciate your time :slight_smile:


(Ken Nash) #4

We created a BPM to create jobs. Is that what you are trying to do? or in C#?

We started the C# route, but then went with using the BPM widgets.

We invoke the BPM by creating a row in a UD Table. We fill the UD fields of the UD table with the information needed for the job. This then lets us use the UD update pre processing BPM widgets to create job, fill job with information, then save all using widgets. The UD table also lets us track who is creating jobs, but you might not need that.


(Chris Conn) #5

I dont have time at the moment, but i was in your shoes and wanted to know what that button does, I’d use a decompiler like ILSpy, DotPeek, etc to look at the code of that form dll


(Arash Farmagham) #6

I am hoping for a simple and straightforward solution like whateverObject.CreateJobs(orderNum);

I did trace the Job Entry program while creating a job for a sales order and added material and then checked all the method calls. I was able to mimic the process and create jobs using C# code but it is not a very clear process and sometimes it just fails to create jobs. It involves creating rows in the following tables:

JobHead
JobAsmbl
JobPart
JobProd

It is like a few hundred lines of code where you have to enter lots of information into those tables for the job you are creating.

But when you click on the ‘Create Jobs’ button on the Order Entry program, it literally takes 2 seconds for the system to generate jobs, so I am still not sure how they do it. And am surprised that the code is not available for us. (Tracing does not register the method calls when you click on that button).


(Chris Conn) #7

You can get the actual source code if you buy the SDK.


(Ken Nash) #8

That would be awesome.

The BO do a ton of the heavy lifting (as when you create a job and add a part, the other tables you mentioned get filled out epimagicly)

Try a few tests.


(Arash Farmagham) #9

So there is no easy way I assume!

I was hoping to get rid of the large code I have as it sometimes fails to do the job! The failure is usually when I call this method:

jobBO.GetNewJobProd(…)

If any of you find a super short way to generate jobs (blank jobs linked to order line releases without anything in them) please let me know. I appreciate your help :slight_smile:


(Tim Shoemaker) #10

I was able to create a “Quickjob” using a BPM and widgets… the nice thing about quickjob is that by setting parameters, you can specify all the facts up front, and then tell the quickjob Business Object to do the work. It reports back the job number that was created.
If you run a trace while using QuickJob to create a sample job, you can find the business object called, and the parameters used.


(Daryl Hewison) #11

We also do this via BPM rather than the client. You do need to be quite exact passing the table values between the components of the OrderJobWiz BO, from memory, but otherwise it works quite seamlessly. I wouldn’t call it super-quick, mind you. It usually takes 3-5 seconds per job.

I have no reason to suppose the same wouldn’t work from within a customization, but our users prefer the process not to delay them between lines, rather have it kick off once they’ve completed the order, so I have never tried. I think I’d still be inclined to use a BPM even so, though.