Schedule a daily code method

Hey

unfamiliar territory here. I need a piece of code to run every day at 10.00am but am unsure where to create the code.

What needs to happen

  • Get 3rd party API from Company Table
  • Get daily data from BAQ
  • send dataset to 3rd party API

I have a BAQ that collects the data required.
I know i can add code to an updateable BAQ but my BAQ is not updateable.
I thought maybe a BPM but there is no specific method or data event required to send the code. In fact, i do not want the code to fire an any specific method or data event…

I have everything ready in terms of my daily schedule.

Where would i place my code so that i can attach it to a daily schedule?

Thanks

1 Like

You can schedule Epicor Functions. Could do it that way.

3 Likes

I looked at that. I added a Library then a widget but i wasnt able to add a widget with code.

Its been suggested to schedule the BAQ and run a data directive on the post process GetList method.

i’ll report back

Thanks

1 Like

You need to check the "Allow Custom Code " and “Allow Custom Code Widgets” on the library main tab

2 Likes

Also, the code to get the BAQ as a dataset:

1 Like

Thanks so much, very much appreciated :slight_smile:

2 Likes

You also have to click the right option under the New button … :rofl: Don’t ask how long it took me to figure that out…

3 Likes

You’re welcome! If you go to the post I quoted that from, there’s a library you can download and import that has that function along with some others that is helpful for managing BAQs and other datasets in functions. You can call the BAQ function, just passing in the BAQ name, and get the dataset without adding any additional code. Just add a the helper library to in your references > libraries tab.

1 Like

For approximately what duration did you struggle with this particular issue?

1 Like

Ha! Long enough to be considered embarrassing.

2 Likes

Thanks for that. Unfortunately for me, we are still on 3.2.500 and your library is 4.2.500

I also need to add a reference to System.Net.Http so that i can access HttpClient for an API call to a 3rd party payroll system but im struggling to add any external references…

My external Visual Studio class project works perfectly, getting it to work within Epicor is a different thing all together

1 Like

You should just be able to add using System.Net.Http in the usings tab of the code editor:
image

You can also add your VS Class Library if you compile it to a DLL, and add it to your server assemblies folder (there are a few more steps to this, but it’s not difficult).

1 Like

That would be a much better solution for me as i can just pass in my datatable and let the library process it.

Thanks for that

1 Like

How long did it take you?

1 Like

Apparently we think the same. I should have kept reading before responding.

1 Like

Hi Kevin

As i am unable to import the function, would you be so kind as to share the code? No worries if not.

Thanks

What steps are required to add my assembly to the server assemblies folder?

Also

I only see 1 deployment folder where we have 3 environments. do all environments look at the same deployment folder?

Thanks

Right… Kinda getting nowhere fast

My objective is to send data from the Labor table to UKG Rest service. My Custom Library works in visual studio test by passing the ID, Secret, URL and data as a datatable to the library. The library converts the data to json and sends it. I tested in in VS with another project referencing the library.

There is a BAQ with 2 parameters (From / To) that gets the data.

What is the step by step process to do this?

I have tried
Post Process BPM on GetList of the Labor table
Created a function, cant see how to schedule or test that…

I set up remote debugging but get an error about no symbols loaded…

Currently,

my VS code works, i cant get it working in Epicor…

Help greatly appreciated from the experts :slight_smile:

Well, you’re sort of getting off topic…

Scheduling a function can be done from the main menu.

It’s literally “Schedule Epicor Function”.

If you need help with your other stuff, I’d organize it and throw it in another thread.

Regardless, we’ll probably help :slight_smile:

I think Schedule Epicor Function came in Kinetic and was not available back in E10. I can’t seem to find when this was introduced.

Edit: It’s definitely not in 10.2.500 but it might have been added in .600 or .700.