Author Archive

How to Update the Version in Dynamics 365 Finance and Operations Environments?

In this article, I will try to explain how you can update the versions of your Dynamics 365 Finance and Operations environments. First of all, we should give credit where it is due. Microsoft made the ERP system update almost like the Windows 10 update with a very good solution. I think the One Version approach is a revolution in business software. All customers using ERP in the cloud have to receive updates published periodically. The good thing here is that Microsoft updates the system at will, thanks to the Extension approach. Your developments are rarely affected by this. In the old system, it was a process that took months to even upgrade to a higher update. Now you can get it done in days or even hours.

In this article, I will explain how to upgrade a demo environment from CU34 to CU35.  First, select your project.

Image-1

Select the environment you want to update.

Image-2

Your environment information appears. Go down and look at the update information.

Image-3

It says that there is an update. Click View Update.

Image-4

It shows all of the update packages. Click Save package.

Image-5

Here I have selected all the packages. You must do this for the version update. If you need different updates, you can choose the package directly from here. Then click Save package.

Image-6

Name the package and click Save package.

Image-7

This takes some time depending on the size of the package.

Image-8

If it completes without error, the following explanation will appear. Complete the process by clicking Done.

Image-9

Go to the Asset library and open the Software deployable package tab. Package has arrived but has not been approved yet. We have to wait for a while.

Image-10

After approval, open your environment again and click Apply updates.

Image-11

Select your package from the page that opens and click Apply.

Image-12

The confirmation screen will appear. Click Yes and continue.

Image-13

It says our version will be updated. Click Yes.

Image-14

After that, the update process starts. You can track the status of the environment here. If there is no problem within 1 hour, the process will be completed. If there is a problem, you can refer to the log to see the origination.

Image-15

When the update is complete, if there was a problem, there are options such as undo and retry.

Image-16

In this article, I explained how an environment is updated to the new version. It’s a very simple process. If you need to update multiple environments, you don’t need to create packages for all of them. You can use the same package for all your environments. Make sure your environment is open before starting the update. If you turn off the machine from Azure side, LCS doesn’t see it. After the update is complete, it is useful to start a synchronization via VS for demo environments like this.

Regards.

www.fatihdemirci.net

TAGs: Microsoft Life Cycle Services, LCS, Azure, Azure DevOps, Update, 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

How to Authorize Dynamics 365 Finance and Operations Lower Level Form Objects?

In this article, I will try to explain how to define an authorization for any object in Dynamics 365 Finance and Operation application. I do not recommend using this. The more details you go into, the more difficult it will be to manage security. However, in some cases, this will be needed. One mistake I see in these cases is to solve this with code, not with the security infrastructure. Never write code for security related work. It seems like a quick solution at first, but there will be a lot of trouble in the future. The support and subsequent requests become very difficult to meet. In this article, I will continue with the project I used in my previous articles. We had authorized a test user for the Customers form. Now they can open the form and see its data. Assume that the Customer group field was asked to appear on this user. Let’s see how we can do this.

Image-1

I add a new Privilege.

Image-2

Under Privilege, right click the Form Control Permissions section and click New Form.

Image-3

In the Name field, select CustTable form.

Image-4

Right click on CustTable to create a new object and type the name of the object you want to authorize. Grant is the key part. With No Access, we ensure that those who own this Privilege do not see this object. It may not appear in the lookup here. It doesn’t matter, you can directly write the name. These definitions will not be sufficient. We need to change a property of the object for which we will define the authorization.

Image-5

In order to make this change, we need to create an extension for our form at this stage.

Image-6

Open the Extension you created. Find the object you want to authorize and from its properties, change NeedPermission to Manual. It means that you will manage the authorization of this object. It’s better to use the Extension as the first step.

Image-7

Then add the Privilege to Duty we used in our previous articles.

Image-8

Save and compile our project and run DB synchronization for our project only. After that, when you log in with the test user and open the Customers form, you will see that the Customer Group field does not appear.

Image-9

In this article, I tried to explain how a low-level object is authorized. It can be done very simply, but if you define too many low-level authorizations, it is very difficult to work it out. Try to authorize from the entry point as much as possible.

Regards.

www.fatihdemirci.net

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

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

What is Dynamics 365 Finance and Operations Optimization Advisor?

In this article, I will explain what Dynamics 365 Finance and Operations Optimization Advisor is and what it does. Optimization Advisor is a tool that allows business analysts and consultants to identify problems in module configuration and business data. Optimization Advisor recommends best practices for module configuration, and identifies outdated or incorrect setup and business data, and provides information to take action.

Open the workspace by using Modules > System administration > Workspaces > Optimization Advisor.

Image-1

My application is a dev environment with demo data, so many suggestions are listed. As I am a software developer, the suggestion that immediately caught my eye was the performance-related one. It is for using batch to improve posting performance. I click More Information.

Image-2

Here, there are details of the finding. If you decide to do it, click Take action.

Image-3

It opens the general ledger parameters form for you. From the Batch transfer rules tab, I select Scheduled batch for Transfer mode. Thus, I took action on an item of Optimization Advisor.

Image-4

In this article, I tried to explain what Optimization Advisor is and how to use it. It’s a nice feature, but the recommendations here should be tested first in test environment. Each parameter has different effects on the system. Some settings may be deliberately different in the project design. You shouldn’t change it just because you saw it here and considered it correct.

Regards.

www.fatihdemirci.net

TAGs: Microsoft Life Cycle Services, LCS, Azure, Azure DevOps, Optimization Advisor, Microsoft Dynamics 365, MsDyn365FO, MsDyn365CE, MsDyn365

X++ :14- ValidateWrite Metodu Ne İşe Yarar?

Bu yazıda Dynamics 365 Finance and Operations tablo metotlarından validateWrite() metodunu anlatacağım. validateWrite () bir kaydın DB’ye Insert veya Update işlemelerinden önce çalışan doğrulamaların yapıldığı metottur. Bir örnek yapalım.

FDBookTable tablosunda metotlara sağ tıklayıp validateWrite () metodunu Override ettim.

Resim-1

Şöyle bir kontrol yazalım. Eğer BookCount == 0 ise hata versin. Bunun için checkFailed() kullanılır. Otomatik olarak info verip hata döndüren bir koddur.

Resim-2

Kaydedip tablo tarayıcısını açalım. Sıfır girip kaydetmeye çalıştığımızda hata mesajını alırız.

Resim-3

boolean validateWrite()

{

#isoCountryRegionCodes

boolean                     ret;

DirPartyType                type;

ret = super();

// Warn user if this customer lacks a tax exempt number, but do not fail to save the revision.

if (!this.OneTimeCustomer && TaxVATNumTable::isVATNumMandatory(CustParameters::find().MandatoryVATNum, this))

{

warning(“@SYS54494″);

}

if (ret)

{

if (PaymTerm::isCashAccount(this.PaymTermId) && this.PaymSched)

{

ret = checkFailed(“@SYS25074″);

}

}

// Add check MandatoryTaxGroup is set on CustParameters.

if (ret && CustParameters::find().MandatoryTaxGroup && !this.TaxGroup)

{

ret = checkFailed(“@SYS113299″);

}

if (SysCountryRegionCode::isLegalEntityInCountryRegion([#isoMX]))

{

taxRegistrationValidator = TaxRegistrationValidator_MX::construct(this);

ret = taxRegistrationValidator.validateCustomerTaxRegistration() && ret;

}

if (this.MainContactWorker)

{

ret = ret && smmUtility::isValidWorkerInCurrentCompany(this.MainContactWorker);

}

if (ret && !CustVendTable::validateContactForParty(true, this.ContactPersonId, this.Party))

{

ret = checkFailed(“@SCM:InvalidPrimaryContactErrorMessage”);

}

return ret;

}

CustTable ValidateWrite() metodunu inceleyelim. checkFailed kullanımını görebilirsiniz. Eğer birkaç satırdan uzun bir kod gerekiyorsa ayrı metot yazıp buradan onu çağırmak genel yaklaşımdır.

Selamlar.

www.fatihdemirci.net

TAGs: X++,validateWrite, Azure, Azure DevOps, Microsoft Dynamics 365, MsDyn365FO, MsDyn365CE, MsDyn365

Dynamics 365 Finance and Operations Data Management 1. How to Import Data?

In this article, I will introduce Dynamics 365 Finance and Operations data management infrastructure (Data Management Framework). The scope of data management is very large. I will try to talk about the basic principles in this series. Data is very important for every application, but the reason for the existence of ERP is to collect the data correctly and to create meaningful reports from the collected data. For this reason, the product has always had powerful tools for data management. With the cloud, these are now very advanced. Many different technologies such as CDS and Azure DataLake were involved. Of course, SQL and table structure remains, but with the added Data entities structure, we have a much more flexible and easily managed structure. In this section, I will try to explain how to manage Data Entity and Entity Packeges using the data management infrastructure.

The data management infrastructure consists of the following objects.

  • Data entities – They are meaningful data sets. It is a structure that consists of one or more data sources to view and process a certain data. Data Entity allows us to bring these data sources together and perform transactions over a meaningful data set. It is suitable for reuse. It is used for integration, data transfer and many other purposes.
  • Data project – A project record that holds edited Data Entity and relationships. It can be reused.
  • Data job – Includes run Data Projects, uploaded files and recurring processes.
  • Job history – Keeps the history of transactions.
  • Data package – It is a compressed structure with Data project manifest and Data files. It is created over the data job. It allows importing and exporting multiple files in one operation.

You can use this structure for three different scenarios:

  • Data migration
  • Set up and copy configurations
  • Integration

Let’s get to the topic of this article. We’ll start with a very simple data transfer. We will transfer the vendor group. (VendGroup). Log in to Dynamics 365 Finance and Operations and open Workspaces > Data management worksheet.

Image-1

Click Framework parameters Tile. Tile’ı nasıl çevirmek lazım emin olamadım. En iyi uygunu tuğla veya fayans gibi duruyor ama ben karo diyeceğim. J  You can make many settings from the screen that opens. Now just select the View defaults section as Enhanced view.

Image-2

This is now the advanced view. You can return to the old view by selecting Standard view.

Image-3

Click on the Import tile.

Image-4

Enter the basic information and click Add File.

Image-5

By the way, the data I will transfer is a csv as shown below.

Image-6

From the window that opens, I first select the Entity I want to transfer from. I determine the format. I select my file by clicking Upload and add.

Image-7

I click Yes.

Image-8

Here it says some relationships are missing between my file and the Entity. I can do it here if I want. I lick No for now.

Image-9

Transfer failed due to lack of relationships. However, the project was created. I click the icon under view map.

Image-10

It shows the links between my file and the Entity. Since the headings in my file are tags, it could not auto-match. I can do it manually from here.

Image-11

I have completed my mappings and I save.

Image-12

I go to my project and click Import.

Image-13

It adds the transfer to the working list.

Image-14

It quickly completed the transfer because my data was too little.

Image-15

Now I can open the VendGroup form and see the records I imported.

Image-16

In this article, I made an introduction to data management and performed a very simple data transfer. I will talk about very different uses of this structure in my following articles. Both consultants and software developers need to know the capabilities of this very well. There are many different uses. It is a structure that will save you a lot of time with proper use.

Regards.

www.fatihdemirci.net

TAGs: Microsoft Life Cycle Services, LCS, Azure, Azure DevOps, Data Management Framework, 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

How to Move Developments to Dynamics 365 Finance and Operations Test and Live Environments? 2- Merging Code Between Dev and Main Branch.

In this article, I will talk about Merge, which is the second step required to move the developments we made from Visual Studio for Dynamics 365 Finance and Operations to Test and Live environments.  Merge is basically to transfer code between different folders and branches. Our example has two Branches: Dev and Main. The general approach is to transfer the code to Test environment with Dev Build. Then for the approved developments, it is necessary to perform Code Merge from Dev Branch to Main Branch and then create a Build on Main and transfer to live environment. Of course, these are just approaches that you may choose from. You should decide on one of these methodologies according to your own team and the requirements of the project.

So, how do we Merge from Dev to Main? First, open Visual Studio with admin rights.  Open the Team Explorer-> Source Control Explorer screen. In my previous articles, I explained how to connect DevBox to Azure DevOps. So, I directly see my Azure DevOps project. We used a different folder structure in this project.

Image-1

Right click on the Branch you want to start Merge and select Branching and Merging-> Merge.

Image-2

Source Control Merge Wizard opens. Source Branch and Target Branch appears automatically. You can change them if you want. Here I need to talk about Changeset. Changeset is a structure that contains all the objects in a check-in. An automatic ID is created and the transfer operations are usually done with this ID. Select Selected changesets here and continue. I will talk about the other option below.

Image-3

All Changesets that have not been merged will be listed. You are free to choose.

Image-4

When choosing, be careful not to leave any spaces between Changesets. Spaces can cause a lot of Conflicts and they are annoying to deal with. You should track this regularly and properly. Click Next to proceed.

Image-5

A summary screen appears and if you click Finish, the process is completed. In this environment, I do not continue as Merge is not ready yet.

Image-6

Let’s see what happens if we continue with the other option. If proceed by selecting All changes up to a specific version, we can Merge according to certain types.

  • Changeset: When you select this option you can enter any Changeset number. In addition, you can search for Changeset by clicking (…) here and select the Changeset you want from the search window.
  • Date: This option allows you to choose changes for a certain date.
  • Label: It is a mechanism that allows you to take snapshots of your development. If you use it, you can make choices for it here.
  • Label Version: It allows you to choose versions if you are using the Label mechanism.
  • Workspace Version: With this option, Devbox allows you to choose the workspace you are working on.

Image-7

If you choose Changeset, you can search for a specific Changeset number and proceed with the results.

Image-8

In this article, I talked about the Merge logic used for transferring code between branches. It is not essential to transfer the code for the test and the live, but it is necessary to determine the right strategy and automate them. The DevOps engineer has become a very important role for our applications. Now that we have transferred the codes, we can move on to the 3rd stage, Build creation.

Regards.

www.fatihdemirci.net

TAGs: Microsoft Life Cycle Services, LCS, Azure, Azure DevOps, Merge, 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

X++ :19- Insert, Update, Delete Nasıl Kullanılır?

Bu yazıda X++ DataManupulation nasıl yapılır anlatmaya çalışacağım. Veri oluşturma güncelleme ve silme işlemleri ERP için en temel fonksiyonalardır. X++ ile nasıl yapılır bir örnek yapalım. Önceki yazılarımda kullandığım FDBookTable’ı kullanacağım.

class FDDataManupulation

{

public static void main(Args _args)

{

FDBookTable bookTable;

FDBookTable bookTableUp;

;

bookTable.clear(); // TableBuffer’ı temizliyoruz.

bookTable.BookId    = “B005″;

bookTable.BookName  = “Book 1″;

bookTable.insert(); // Yeni kayıt oluşturma

bookTable.clear();

bookTable.BookId    = “B006″;

bookTable.BookName  = “Book 2″;

if(bookTable.validateWrite()) // Kodla insert yaptığınızda validasyon çalışmaz bu yüzden koda eklemek gerekiyor.

{

bookTable.insert();

}

// Güncelleme yapalım. Öncelikle güncellemek istediğimiz kaydı seçmeliyiz ve Transaction bloğu oluşturmalıyız. Bunun sebebi eğer güncelleme sırasında bir hata olursa geri alma yapabilmektir.

ttsbegin;

select forupdate bookTableUp

where bookTableUp.BookId == “B006″;

bookTableUp.BookName = “Book 3″;

bookTableUp.update(); // Tek bir satır günceller

ttscommit;

ttsbegin;

while select forupdate bookTableUp

where bookTableUp.BookId == “B006″

{

bookTableUp.updare(); // Yine tek bir satır günceller ama eğer sorgudan daha çok kayıt gelseydi mesela kapak tipine göre filtre verseydim gelen tüm kayıtları güncellerdi.

}

ttscommit;

// Kayıt silme

delete_from

where bookTableUp.BookId == “B006″; En temel kullanımı budur ama Delete metoduyla da silebilirsiniz.

while select forupdate bookTableUp

where bookTableUp.BookId == “B006″

{

bookTableUp.delete(); // Kaydı siler

}

}

}

Bu yazıda temel Insert Update Delete nasıl yapılır anlatmaya çalıştım. Performans açısından bunları doğru yapmak çok önemli. Birde bunları Bulk halinde yapabilmeniz mümkün onları da ayrıca anlatacağım.

Selamlar.

www.fatihdemirci.net

TAGs: X++,Insert,Update,Delete, Azure, Azure DevOps, Microsoft Dynamics 365, MsDyn365FO, MsDyn365CE, MsDyn365

X++ :13- Update Metodu Ne İşe Yarar?

Bu yazıda Dynamics 365 Finance and Operations tablo metotlarından Update() metodunu anlatacağım. Önceki yazılarımda tabloların temel yapılarından bahsetmiştim. Şimdi ayrıntılı olarak alt seviye nesne ve metotları inceleyeceğim. Tablolar XRecord sınıfından türetilen aslında SQL tabloların sınıf karşılıklarıdır. Sınıflardan temel bir iki farkı vardır. Sınıf olmasına rağmen New ile nesne oluşturmak gerekmez. Alanlar metot gibi davranın ama paranteze ihtiyaç duymaz. Update() metodu tabloda bir kayıt güncellenirken çalışan metottur.

FDBookTable tablosunda Metotlara sağ tıklayıp Update() metodunu Override ettim.

Resim-1

Super()’i daha önce anlatmıştım. Aslı işi yapan yanı DB’deki veriyi güncelleyen ana sınıftaki kodu çağırır. Basit bir kod yazdım her seferinde sayıyı bir arttıracak şekilde.

Resim-2

Tablo tarayıcısını açıp herhangi bir güncelleme yaptığımda sayının arttığını gördüm.

Resim-3

void update(boolean _updateSmmBusRelTable = true, boolean _updateParty = true)

{

CustTable   this_Orig = this.orig();

RecVersion  rv = this_Orig.RecVersion;

ttsbegin;

super();

// Update the full text search table

MCRFullTextSearch::update(this);

this.SysExtensionSerializerMap::postUpdate();

if (_updateSmmBusRelTable)

{

smmBusRelTable::updateFromCustTableSFA2(this, ”, false);

}

if (this_Orig.CustGroup != this.CustGroup)

{

ForecastSales::setCustGroupId(this.AccountNum,

this_Orig.CustGroup,

this.CustGroup);

}

smmTransLog::initTrans(this, smmLogAction::update);

// If the customer group has changed

if (this.CustGroup != this_Orig.CustGroup)

{

// clear the ledger cache

LedgerCache::clearScope(LedgerCacheScope::PartyMainAccountDimensionListProvCust);

}

if (SysCountryRegionCode::isLegalEntityInCountryRegion([#isoMX]) && _updateParty)

{

this.copyInfoToParty();

}

ttscommit;

}

CustTable Update() metodunu inceleyelim. Güncelleme olduktan sonra eğer belli bir alanın güncellenip güncellenmediğini kontrol etmek istiyorsanız this.Orig() ile kaydın orijinal halini alıp kıyaslayabilirsiniz.

CustTable   this_Orig = this.orig();

if (this.CustGroup != this_Orig.CustGroup)

Bu iki satır kullanıma güzel bir örnek.

Selamlar.

www.fatihdemirci.net

TAGs: X++,Update, Azure, Azure DevOps, Microsoft Dynamics 365, MsDyn365FO, MsDyn365CE, MsDyn365

X++ :12- Insert Metodu Ne İşe Yarar?

Bu yazıda Dynamics 365 Finance and Operations tablo metotlarından Insert() metodunu anlatacağım. Önceki yazılarımda tabloların temel yapılarından bahsetmiştim. Şimdi ayrıntılı olarak alt seviye nesne ve metotları inceleyeceğim. Tablolar XRecord sınıfından türetilen aslında SQL tabloların sınıf karşılıklarıdır. Sınıflardan temel bir iki farkı vardır. Sınıf olmasına rağmen New ile nesne oluşturmak gerekmez. Alanlar metot gibi davranın ama paranteze ihtiyaç duymaz. Insert() metodu tabloda bir kayıt oluşturan metottur.

FDBookTable tablosunda Metotlara sağ tıklayıp Insert() metodunu Override ettim.

Resim-1

Insert işlemini yani kaydın DB’ye yazılmasını aslında Super() yapar. Super() ezilen metodu çağıran koddur. Dolayısıyla Super()’den önce kayıt henüz DB ye yazılmamıştır. Kaydetmeden önce bir işlem yapmak istiyorsanız Super()’den önce sonra yapmak istiyorsanız Super()’den sonra yazmalısınız. Ben Basit bir satır ekledim. Çok doğru bir yer olmamakla birlikte çalışır. Insert() metodu validasyon için kullanılmamalıdır.

Resim-2

Tablo tarayıcısını açıp yeni bir kayıt oluşturduğumda otomatik BookCount 1 olarak oluşuyor.

Resim-3

Şimdi standart bir tablonun Insert() metoduna bakalım. Kodları görebilmek için View code demeniz gerekiyor.

Resim-4

void insert(DirPartyType _partyType = DirPartyType::None, Name _name = ”,boolean _updateCRM=true)

{

DirPartyType   type;

ttsbegin;

// Check if not associated to Party

if (!this.Party)

{

// Create a Party entry for customer

this.Party = DirPartyTable::createNew(_partyType, _name).RecId;

}

else

{

if (!this.VATNum)

{

this.VATNum = TaxRegistration::getPrimaryRegistrationNumber(DirPartyTable::findRec(this.Party), TaxRegistrationTypesList::TAXID);

}

this.initFromsmmLeadTable();

}

smmBusRelTable smmBusRelTable = smmBusRelTable::findByParty(this.Party, true);

if (smmBusRelTable.RecId)

{

smmBusRelTable.BusRelTypeId = smmBusRelTypeGroup::getCustomerType();

smmBusRelTable.update(false);

}

super();

// Insert new customer in full text search table

MCRFullTextSearch::insert(this);

this.SysExtensionSerializerMap::postInsert();

if (SysCountryRegionCode::isLegalEntityInCountryRegion([#isoMX]))

{

this.copyInfoToParty();

}

smmTransLog::initTrans(this, smmLogAction::insert);

DirPartyRelationship::createLegalEntityRelationship(this.Party, this.DataAreaId, DirSystemRelationshipType::Customer);

// Add links to contact person

ContactPerson::addCustVendLink(this.TableId, this.Party, this.AccountNum);

// Create default location if using existing party

LogisticsLocationDefaultAppUtil::createDefaultForExistingParty(this);

DimensionDefaultFacade::copyDimensionValueToDefaultDimensionField(this, fieldNum(CustTable, AccountNum), this, fieldNum(CustTable, DefaultDimension));

ttscommit;

}

Bu kodda iki yere dikkat çekeceğim. Birincisi if (!this.Party) ile başlayan kod burada eğer parti kodu yoksa oluşturmak üzerine bir kod var. Superden önce çünkü kayıt oluşmadan önce oluşmalı ve CustTable’daki ilişkili alana yazılmalı. İkincisi ContactPerson::addCustVendLink(this.TableId, this.Party, this.AccountNum); ilgili kişi oluşturma. Burada da müşteri kaydı oluşmalı ki müşteri kodu kullanılarak ilişkili kişi kaydı oluşturulsun.

Selamlar.

www.fatihdemirci.net

TAGs: X++,Insert, Azure, Azure DevOps, Microsoft Dynamics 365, MsDyn365FO, MsDyn365CE, MsDyn365