Posts Tagged ‘ Batch Jobs

SysOperation Framework İle Toplu İş Nasıl Oluşturulur?

Bu yazıda SysOperation kullanarak Dynamics 365 Finance and Operations için yeni bir toplu iş (Batch Job) nasıl oluşturulur anlatmaya çalışacağım.  SysOperation RunBaseBatch’in daha gelişmiş hali diyebiliriz. Birçok farklı kullanımı var. Bu örnekte normal toplu iş olarak kullanımını anlatacağım. Yapısına gelecek olursak SysOperation MVC (Model–View–Controller) design pattern’ı kullanır. Bu yapının temel sınıfları şunlardır:

Service: Servis sınıfı SysOperationServiceBase sınıfından türetilir. İşlemin yapıldığı sınıftır. Kodlarımız bu sınıfta olmalı.

Data Contract: Özellikleri (attributes) tanımladığımız model sınıfıdır. Diyalogdan veri almak için DataContractAttribute attribute kullanılır.

Controller: Kontrol sınıfı SysOperationServiceController sınıfından türetilir. Toplu işle ilgili bilgileri tutar. Diyalog ve progress bar gibi.

UI Builder: UI Builder sınıfı SysOperationAutomaticUIBuilder sınıfından türetilir ve diyaloglara daha gelişmiş ara yüzler sağlamak için kullanılır.

Bu örnekte ilk 3 sınıfı kullanarak RunBaseBatch ile yaptığımız örneğin aynısı yapacağım. Öncelikle yeni bir proje oluşturuyorum.

Resim-1

Read more

RunBaseBatch Framework İle Toplu İş Nasıl Oluşturulur?

Bu yazıda Dynamics 365 Finance and Operations için yeni bir toplu iş (Batch Job) nasıl oluşturulur anlatmaya çalışacağım. RunBaseBatch kullanarak bir örnek oluşturacağım. İleriki yazılarımda SysOperation ile de örnekler vereceğim. Toplu iş nedir ona bakalım. Bir işi farklı sunucuda ve belli zamanda istersek tekrarlayan şekilde çalıştırmaya yarayan bir alt yapı diyebiliriz. En basit örneği vereyim. Merkez bankası her gün kurları belli saatte açıklıyor. Sizin bu değerleri alıp sisteme kaydetmeniz gerekiyor. Bunun için bir sınıf yazdınız ve bu sınıf servise bağlanıyor ve değerleri alıyor. Ancak bunun her gün aynı saatte tetiklenmesi lazım. İşte burada toplu iş devreye giriyor ve size bu ayarları yapma imkânı veriyor.

Bu örnekte çok basit bir sınıf oluşturup çalıştıracağız. Öncelikle yeni bir proje oluşturuyorum.

Resim-1

Read more

How to Create a Batch Job with SysOperation Framework?

In this article, I will try to explain how to create a new Batch Job for Dynamics 365 Finance and Operations using SysOperation.  We can say that SysOperation is a more advanced version of RunBaseBatch. It has many different uses. In this example I will explain its usage as a normal batch job. As for its structure, SysOperation uses the MVC (Model – View – Controller) design pattern. The basic classes of this structure are:

Service: The service class is derived from the SysOperationServiceBase class. It is the class in which the process is done. Our codes should be in this class.

Data Contract: It is the model class for which we define attributes. The DataContractAttribute attribute is used to get data from the dialog.

Controller: The control class is derived from the SysOperationServiceController class. Stores information about the batch job. Such as dialog and progress bar.

UI Builder: The UI Builder class is derived from the SysOperationAutomaticUIBuilder class and is used to provide more advanced interfaces to dialogs.

In this example I will do the same as we did with RunBaseBatch using the first 3 classes. First I create a new project.

Image-1

I add a new class.

Image-2

The first class is the control class. We haven’t created the service class yet, but I identified and typed its name.

Image-3

Let’s create the service class now.

Image-4

I write the code below. Actually I need the Contract class here. Let’s create it.

Image-5

I create the Contract class. Usually this class should be created first. But if your design is clear, it doesn’t matter which one you start with. You won’t be typing these codes over and over every time, you will use them from a template.

Image-6

I want to get two variables here and edit my class accordingly.

Image-7

I create a MenuItem.

Image-8

I link my control class to the MenuItem.

Image-9

After this stage, compilation is required. It’s not enought to just compile the project. Therefore I click Build models.

Image-10

Click Select all on the screen that opens and start a Build operation.

Image-11

After the Build operation is completed, mark your MenuItem as the starting object and run the project. Our class worked. You can run it directly just like you did with RunBaseBatch.

Image-12

You can add it to a batch job if you want. I added it to a batch and set it to run one time.

Image-13

Now let’s open the Batch Jobs form. Let’s find our own batch job and take a look at the progress. It is Ended, which means it worked and finished. If it was a recurring job, it would be in Waiting state. I click on Batch job History to check what our batch job has done and whether it worked correctly.

Image-14

I click Log from the details of the job and it shows the output of the batch. It worked without any problems.

Image-15

In this article, I tried to explain how to create a new batch job using SysOperation. SysOperation is a very extensive topic. I will continue to explain it with different viewpoints. Especially Parallel processing works very well in terms of performance. I’ll explain how to use it in an example.

Regards.

www.fatihdemirci.net

TAGs: Microsoft Life Cycle Services, LCS, Azure, Azure DevOps, Batch Jobs, SysOperation, Microsoft Dynamics 365, MsDyn365FO, MsDyn365CE, MsDyn365, Dynamics 365 Insights Power BI, Power Automate, Power Apps, Power Virtual Agents, what is Dynamics 365, Dynamics 365 ERP, Dynamics 365 CRM

RunBaseBatch Framework İle Toplu İş Nasıl Oluşturulur?

Bu yazıda Dynamics 365 Finance and Operations için yeni bir toplu iş (Batch Job) nasıl oluşturulur anlatmaya çalışacağım. RunBaseBatch kullanarak bir örnek oluşturacağım. İleriki yazılarımda SysOperation ile de örnekler vereceğim. Toplu iş nedir ona bakalım. Bir işi farklı sunucuda ve belli zamanda istersek tekrarlayan şekilde çalıştırmaya yarayan bir alt yapı diyebiliriz. En basit örneği vereyim. Merkez bankası her gün kurları belli saatte açıklıyor. Sizin bu değerleri alıp sisteme kaydetmeniz gerekiyor. Bunun için bir sınıf yazdınız ve bu sınıf servise bağlanıyor ve değerleri alıyor. Ancak bunun her gün aynı saatte tetiklenmesi lazım. İşte burada toplu iş devreye giriyor ve size bu ayarları yapma imkânı veriyor.

Bu örnekte çok basit bir sınıf oluşturup çalıştıracağız. Öncelikle yeni bir proje oluşturuyorum.

Resim-1

Read more

How to Create a Batch Job with RunBaseBatch Framework?

In this article, I will try to explain how to create a new Batch Job for Dynamics 365 Finance and Operations. I will create an example using RunBaseBatch. I will give examples with SysOperation in my future articles. Let’s look at what batch job is. It is an infrastructure that is used to run a job on a different server and at a certain time, repeatedly. Let me give you the simplest example. The central bank announces the exchange rates at a certain time every day. You need to take these values and save them in the system. You have written a class for this and that class connects to the service and gets the values. However, this has to be triggered at the same time every day. This is where batch jobs come in and allow you to make these settings.

In this example we will create and run a very simple class. First I create a new project.

Image-1

After the project the class is required, but we will not create it from scratch. We will duplicate the Tutorial_RunBaseBatch class from the samples.

Image-2

Let’s give a name to the class we duplicated. There are a few things to consider. First of all, don’t change the structure of the class. It works smoothly as is. If you don’t need dialogs, you can clear them. It is essential to derive from RunBaseBatch. You must use Pack Unpack. Pack Unpack ensures that your parameters are stored in the system. It is such an extensive topic that needs a dedicated article.

Image-3

When a class is duplicated, the name of the old class remains in a few places. These need to be fixed. I changed the Main method to this.

Image-4

Similarly, I changed the construct method in this way.

Image-5

Run method is where the main work is done. In this sample class a dialog opens and asks for the date and client code. I print the values coming from this dialog in the run method.

Image-6

I create a new MenuItem to run the class.  I select the Object and ObjectType.

Image-7

I mark the MenuItem as the starting point.

Image-8

When I run my project, the dialog screen opens. I enter a date and select a client. I select No for Batch processing. When I click OK, the class will directly work.

Image-9

The class worked and displayed the output on the screen.

Image-10

Now let’s see what happens when I click Yes. Of course, this appears because we derived our class from the RunBaseBatch class. After I defining a few important areas, I click Recurrence.

Image-11

Here I can determine how often and when this job will run. I can get it running every 10 minutes if I want, but it’s enough for me to run it once, so I leave it like that.

Image-12

The class did not work when I closed the screens by clicking OK. Instead, it showed the message saying that it added to queue.

Image-13

Now let’s open the Batch Jobs form.

Image-14

Let’s find our own batch job and take a look at the progress. It is Ended, which means it worked and finished. If it was a recurring job, it would be in Waiting state.  I open the advanced form by using the Switch to enhanced form option.

Image-15

This form includes more details. I will not mention all of them. I click on Batch job History to check what our batch job has done and whether it worked correctly.

Image-16

When I click Log from the screen that opens, I see that the date and customer information I selected appear on the screen. So my class worked. If there was an error I could check it here.

Image-17

In this article, I tried to explain how to create a new batch job using RunBaseBatch. Batch job is a very extensive topic. I will continue to explain it with different viewpoints.

Regards.

www.fatihdemirci.net

TAGs: Microsoft Life Cycle Services, LCS, Azure, Azure DevOps, Batch Jobs, RunBaseBatch, Microsoft Dynamics 365, MsDyn365FO, MsDyn365CE, MsDyn365, Dynamics 365 Insights Power BI, Power Automate, Power Apps, Power Virtual Agents, what is Dynamics 365, Dynamics 365 ERP, Dynamics 365 CRM