Linking Dynamics 365 Finance and Operations Branch Logic and Local Folders to a Azure DevOps project.

In this article, using version control for Dynamics 365 Finance and Operations is now a must. It was also possible to use it in older versions, but it did not work very well, so we used version control in only a few of the projects I have worked on until now. Of course, our development environment is Visual Studio, which makes it very easy.  Now let’s look at how to adjust some basic settings that are required at the beginning of the project and the Branch logic. Branch allows you to manage your code and developers to work independently. There are many Branch strategies available. I am not an expert on this subject, so I try to use the simpler versions. The 3 most used approaches are as follows. Main, Main and Dev, Main, Dev and Release. You can use these 3 different methods. For more information, you can review the Branching strategies article. I usually use the Dev and Main structure. If the project is small and there are no other developers other than you, you can just continue with Main. When there is a single Branch, merging is not required, you can bring to live faster, but when you do not want to bring certain things, you need to work with Dev at the very least because one Branch does not cut it. Let’s look at how the first definitions are made.

I explained how to connect Azure DevOps over LCS in my previous articles. When you establish this connection, the following Trunk folder will be created in your Azure DevOps project. You have to keep this structure. Initial creation process creates Main as a folder. You have to change this to Branch from Visual Studio. I couldn’t get the screenshot because I didn’t have a brand new environment, so the image shows Main Branch.

Image-1

To turn a folder into Branch, you have to open the Source Control Explorer screen from Visual Studio, right-click the folder and select Branching and Merging -> Convert to Branch.

Image-2

Now, using the model I created in my previous article, let’s associate the Metadata and Projects folders with our Azure DevOps project. Don’t let the images mislead you. Since I don’t have a brand new environment, I took the screenshots from a previously processed environment, but the logic is the same. First of all, this project only includes Main. If you are going to work with Dev, all development environments must be connected to Dev. The process is the same.  Open the Source Control Explorer screen.

Image-3

In brand new environment, there is no folder under Metadata and Project. Just ignore them. Now we can associate the Azure DevOps folders on the left with the folders in our virtual machine. Click on the Not Mapped link.

Image-4

Map to K:\AosService\PackagesLocalDirectory. Selecting the folder automatically adds Metadata. Don’t forget to delete it. Complete the process by clicking Map.

Image-5

I create the K:\VSProject folder. This is not a must, but it is useful to keep the path short.

Image-6

Similarly, when you are on the Projects folder, click the Not mapped link. I associate it with K:\VSProjects. Here it directly adds Projects as well, be careful. I delete it. Complete the process by clicking Map.

Image-7

At this point, you have linked your folders. However, you have not specified which files will be included in the version control. Let’s create these connections using the Model and project I created in my previous article. I had a package called DmrWMS. Right click on the Metadata and click Add Item to Folder. Find your package in the window that opens.

Image-8

Go to the Descriptor folder and select the xml file that has the same name as the package. This file contains our package and model information.

Image-9

After you continue and see it in the Item to add section, click Finish.

Image-10

Actually, our codes are stored under the model, but since we are linking this through the project, no further additions are required. If it is not added by default, you can add your project by clicking Add Item to Folder. You only need to add metadata and code to the version control.  When you check, you can see all your codes in the DmrWMS model folder. Do not be confused by the same model and package name.

Image-11

Now let’s add a job to our project and see how it looks in version control.

Image-12

While creating my project, I marked it as add to version control. I can also add it later. So when I create a new object it is automatically created in my model folder.

Image-13

I can see my pending Check Ins in the Pending Changes section. There are 3 files. These are the must have ones. My project file, My package file, and Job. Let’s Check In and see our development on Azure DevOps.

Image-14

If you have reached this stage, you are ready to develop. We saw the same structure on Azure DevOps. Now we can test and go live after Build operation.

Image-15

In this article, I tried to explain the required Azure DevOps and Devbox machine’s first folder association for a new project and how to connect the model, package and project we just created. This is a much more comprehensive topic, but I wanted to at least make an introduction. I will cover it in more detail later. For example, in Branch logic, there is no single truth, everyone has different experiences. It is also necessary to make changes when it is required to decide according to the team and the project. There are many people who do not have any experience in Dynamics 365 but are Azure DevOps experts, you can get assistance from them. But it is always useful to explain the unique features of Dynamics 365. You will produce a better solution.

Regards.

www.fatihdemirci.net

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

What is the Model and Package for Dynamics 365 Finance and Operations and How to Create It?

In this article, I will talk about the 2nd step required to start development when you start a new project for Dynamics 365 Finance and Operations. I mentioned the first step in my previous article. I explained how we can connect a new DevBox Deploy to our Azure DevOps project. In this article, I will try to explain how to create a new Model and Package and what they do.

A model is usually a distributable software solution and can contain customizations of an existing solution or it can be a new solution. It is a structure that contains Metadata and source code files. A model always belongs to a package. Package includes one or more models. The package includes model Metadata, Binary files and other associated resources. One or more packages can be made into a Deployable package. The deployable package is used to move code to test and live environments.

To create a model, go to Dynamics 365->Model Management->Create Model.

Image-1

Fill in the required information for the model. Model name is important. You need to name it knowing that you will use it constantly and see it everywhere.

Image-2

You will see two options when you continue with Next. If this is your first model, you will want to create it in the package with the model. Therefore, choose the one above. If you already have a package and want to create a new model in it, you should choose the second one.

Image-3

This is one of the most important parts. Here you should select the reference of the standard packages you will need in the model you will create. For basic development needs, those shown in the image plus Dimension and Directory will suffice. You should not select all of them here, since it will affect your package size and compilation speed.

Image-4

When you continue, you will see the last screen. If the information is correct, you can click Finish.  If you want to set this model as the default model, don’t forget to check it. The default model can be changed later from the Config file. If you want to create it in a new project, you can use the relevant checkbox.

Image-5

The automatic project creation screen is opened. We create a Dynamics 365 Finance Operations project. Pay attention to naming the project, you can use the previous approach. My logic includes Company Code + Person + Project name. For example. Such as DmrFDTrvLedgerJournalCreate. Be careful not to write too long. Also in the Location field I use K: or I create a folder named VSProjects and place it there. The path should not be long either. Do not skip the Add to Source Control part, you can add it later.

Image-6

This is the edited version. I didn’t use my name as the project name because it was an experiment.

Image-7

The project is automatically created in the new DmrWMS model we created. Let’s add a ne new Job and see how it looks in the package and project.  I added a new Job named DmrWmsJob1.

Image-8

When you enter K:\AosService\PackagesLocalDirectory, you will see your own package and when you enter it, the folders in the picture will be there. There is a file under Descriptor with definitions for the package. You must add this to version control.

Image-9

When you enter the package, you will see that the code for the DmrWmsJob1 you created is here. Actually, all X++ objects will be under the DmrWMS folder.

Image-10

When you look at your K:\VSProjects\DmrWms1 project, you will see that there are only project definitions here. Codes and objects are not stored here. This logic is specific to X++.

Image-11

In this article, I tried to explain what models, packages and projects are and how they are created. These are the three most important tools in the new version. Layer still exists, but it’s not so important anymore. In particular, it is necessary to understand the package logic and file structure well. We also have a project logic that is different from normal Visual Studio projects. Do not be confused by it. In my next article, I will explain how to connect these folders to version control.

Regards.

www.fatihdemirci.net

TAGs: Microsoft Life Cycle Services, LCS, Azure, Azure DevOps, Model, Packages, 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++ Set Based Operations : Update_recordset

Merhaba,

X++ Set Based Operations : Update_recordset

İyi seyirler.

X++ Set Based Operations : RecordSortedList & RecordInsertList

Merhaba,

X++ Set Based Operations : RecordSortedList & RecordInsertList

İyi seyirler.

Dynamics AX 2012 Caching Video 1

Merhaba,

Sonunda YouTube kanalımı açtım videolarımı çekmeye başladım.
Yazdığın ön bellek makalelerini açıklamaya çalıştığım video aşağıda. Umarım daha güzel videolarla devam edebilirim.

İyi seyirler.

History Of AX

Merhaba

Çok beğendiğim bende nostanji yaşatan iki makaleyi sizinle paylaşmak istiyorum.

History of AX

Technical History of Dynamics AX – From Axapta 3.0 to AX2012

Axapta’yı ilk olarak 2006 yılında Turkmedya firmasında tanıdım. Axapta 3.0 kullanılıyordu. Ben başladığımda proje canlıya geçmişti. Destek ve yeni geliştirmeler ile giriş yaptığım AX dünyasında 12 yılı devirdim. Hayatım üzerinden bu kadar etkisi olacağını tahmin edemezdim.

Selamlar.

XML’de metin değiştirmek

Merhaba

Ax ta E-Fatura süreçleriyle uğraşmayan yoktur. Biz SimpleUBL adında bir eklentiyle hem XML hemde UBL oluşturuyoruz. Şöyle bir ihtiyaç  oldu bazı durumlarda bir alanın verisinin değiştirilmesi gerekiyor. Örneğin matbu irsaliye numarası. Bunun  için gerekli tablolarda veriyi güncelleyip sonra E-Fatura UBL ini oluşturan kodu tekrar çağırınca direk güncelliyor. Ancak bu işlem biraz yavaş çok fazla kontrol ve  işlem yapıyor. Bense çok basit sadece bir alanı değiştirmek istiyorum ve çok hızlı  olması gerekiyor.  Bunu  için str fonksiyonlarından faydalanarak bir metot yazdım. Umarım  işinize yarar.

Örnek UBL in bir parçası  şöyle:


<?xml version="1.0" encoding="utf-8"?>
  <cbc:UBLVersionID>2.1</cbc:UBLVersionID>
  <cbc:CustomizationID>TR1.2</cbc:CustomizationID>
  <cbc:ProfileID>TEMELFATURA</cbc:ProfileID>
  <cbc:ID>YTD20182222225</cbc:ID>
  <cbc:CopyIndicator>false</cbc:CopyIndicator>
  <cbc:UUID>E01C17F9-B13B-4Df5E-BB5A-92F52E17ff3AB0</cbc:UUID>
  <cbc:IssueDate>2018-09-01</cbc:IssueDate>
  <cbc:IssueTime>06:43:11.0000000+03:00</cbc:IssueTime>
  <cbc:InvoiceTypeCode>ISTISNA</cbc:InvoiceTypeCode>
  <cbc:Note>Yazıyla :  TRY TRY</cbc:Note>
  <cbc:Note>TOPLAMADET: 1 / 22,00 </cbc:Note>
  <cbc:LineCountNumeric>1</cbc:LineCountNumeric>
  <cac:OrderReference>
    <cbc:ID>YKS022222222</cbc:ID>
    <cbc:IssueDate>2018-08-08</cbc:IssueDate>
    <cbc:IssueTime>07:25:31.0000000+03:00</cbc:IssueTime>
  </cac:OrderReference>
  <cac:DespatchDocumentReference>
  <cbc:ID>SVK000343433</cbc:ID>
    <cbc:IssueDate>2018-09-01</cbc:IssueDate>
  </cac:DespatchDocumentReference>
  <cac:Signature>
    <cbc:ID schemeID="VKN_TCKN">11111111</cbc:ID>
    <cac:SignatoryParty>

Ben ‘cbc:id SVK000343433 cbc:id’ buradaki SVK000343433 bu numarayı değiştirmek istiyorum.

Bir kaç zorluk var. Birincisi bu numaranın uzunluğu sabit değil.

İkincisi Her bir satır yeni satir karakteriyle ayrılmış durumda.


static void FD_UpdateXml(Args _args)
{
    EInvoiceTable  eInvoiceTable;
    str     str1;
    str     str2;
    str     str3;
    int     i ,j;
    num     packingSlipId = "FD000002";
    ;

    ttsBegin;

    select forUpdate eInvoiceTable
        where eInvoiceTable.RecId  == 5637292931;

    str3 = strFmt("<cbc:ID>%1</cbc:ID>" , DmrPackipackingSlipIdngSlipId ); // Değiştireceğim metin

    i = strScan( eInvoiceTable.InvoiceXml , // İrsaliye numrasının başladığı yeri tespit ediyorum.
        "<cac:DespatchDocumentReference>" , 0,
        strLen(eInvoiceTable.InvoiceXml));

    str1 = subStr( eInvoiceTable.InvoiceXml ,  i +31  , 50);
    // Karakteri sayip  ilerletiyorum ve 50 karakterlik bir parçayı alıyorum
    //str1  böyle bir string oluyor <cbc:ID>YKS000017102</cbc:ID>   <cbc:IssueDa

    j = strScan( str1 ,"</cbc:ID>" , 0, strLen(str1)); // Numaranın bitişini tespit ediyorum.
    str2 = subStr( eInvoiceTable.InvoiceXml ,  i +31  ,j+8);  // Değiştirmek istediğim metne ulaşıyorun
    // str2 <cbc:ID>YKS000017102</cbc:ID> bu oldu

    eInvoiceTable.InvoiceXml = strReplace(eInvoiceTable.InvoiceXml ,str2 ,str3);
    // str2 yi str3 ile değiştiriyorum.

    eInvoiceTable.update();

    ttsCommit;
}

Selamlar.

Dynamics Ax UserConnection kullanımı

Merhaba

Ax’ta  ilk versiyonlardan beri transaction (ttsBegin ttsCommit) blokları dediğimiz bir yapı vardır. Veri tutarlılığı için çok önemli olan roleback dediğimiz bir hata durumunda o blokta yapılan işlemlerin tümünü geri almayı sağlayan bir yapıdır. Ax ta çok sıklıkla kullanılır. Veri tabanında yapılacak işlemlerde mutlaka kullanmak gerekir. Benim bu yazıda bahsedeceğim konu bu bloklar arasında bir hata oluştuğunda roleback in dışında tutmak istediğim bir işlemi nasıl sağlayabileceğim. Genelde bu log atma bildirim gönderme gibi işlemler olur.  Bir örnekle açıklamaya çalışayım.  Eski sistemden satış verilerinin geldiği ve axta sipariş oluşturulup deftere nakledinlen bir yapı olsun.  Herhangi bir sebepten sipariş  oluşturulamadığında bir log tablosuna kayıt atmak istiyorum.   Örnek kodlar şöyle  olsun:

server static void FD_UserConnection1(Args _args)
{
    DmrSalesOrderHeader DmrSalesOrderHeader = DmrSalesOrderHeader::findByRecid(325355554);
    DmrSalesOrderLine   DmrSalesOrderLine;
    ;
    ttsBegin;
    try
    {
        // Sipariş başlığı oluşturma kodu
        while select DmrSalesOrderLine
            where DmrSalesOrderLine.OrderId == DmrSalesOrderHeader.OrderId
        {
            // Sipariş satırı oluşturma kodu
            throw error("hata");
        }
    }
    catch
    {
        DmrExceptionTable::findOrCreate("Satır oluşturulurken bir hata oluştu.", "DmrCreateSalesOrder",
                DmrSalesOrderHeader.recid,DmrSalesOrderHeader.tableId,DmrSalesOrderHeader.recversion);
    }

    ttsCommit;

}

Bu metod sipariş oluşturmaya çalışırken herhangi bir satırda hata veriyor. Bizde hata verdiğini yakalayıp hangi kayıttan sipariş oluştururken hata verdiğini bir tabloya yazmaya çalışıyoruz. Normalde hata verdiği ve tts blokları olduğu için bizim yazmaya çalıştığımız veriyi de geri alacaktı ancak UserConnection ve UnitOfWork kullanarak bunu engelliyoruz. Metot aşağıda.

static server void findOrCreate(    str1260          _exceptionDetail,
                                    str 100          _className,
                                    RefRecId         _RefRecId,
                                    RefTableId       _RefTableId,
                                    RefRecId         _RefRecVersionId)
{
    DmrExceptionTable   DmrExceptionTable;
    UserConnection      UserConnection;
    UnitOfWork          UnitOfWork;
    ;

    UserConnection = new UserConnection();
    UserConnection.ttsbegin();
    UnitOfWork = new UnitOfWork();

    DmrExceptionTable.ExceptionDetail       = _exceptionDetail;
    DmrExceptionTable.ClassName             = _className;
    DmrExceptionTable.RefRecId              = _RefRecId;
    DmrExceptionTable.RefTableId            = _RefTableId;
    DmrExceptionTable.RefRecVersionId       = _RefRecVersionId;

    UnitOfWork.insertonSaveChanges(DmrExceptionTable);
    UnitOfWork.saveChanges(UserConnection);

    UserConnection.ttscommit();

}

Selamlar.

Ax’ta yeni bir iş akışı ataması oluştuğunda aynı kullanıcının bu iş akışı için daha önce onayı var mı tespit etmek

Merhaba

İş akışında yeni bir atama oluştuğunda atanan kişinin aynı iş akışında daha önce onayı var mı diye kontrol etmek için aşağıdaki metodu kullanabilirsiniz. Bu metodu WorkflowTrackingTable’ a yazdım ama farklı bir yere de yazılabilir. İş akışı altyapısı biraz karışık standart yapıyı değiştirirken dikkatli olmakta fayda var.


Boolean dmrExistApprove()
{
    boolean ret = false;

    WorkflowTrackingStatusTable     workflowTrackingStatus;
    WorkflowTrackingStatusTable     workflowTrackingStatusExist;
    WorkflowTrackingTable           workflowTrackingTable;
    ;

    workflowTrackingStatusExist = WorkflowTrackingStatusTable::findRecId(this.WorkflowTrackingStatusTable);

    select firstOnly RecId, User from workflowTrackingTable
    exists join workflowTrackingStatus
    where  workflowTrackingTable.WorkflowTrackingStatusTable == workflowTrackingStatus.RecId
        && workflowTrackingTable.TrackingType       == WorkflowTrackingType::Approval
        && workflowTrackingTable.User               == this.User
        && workflowTrackingTable.RecId              != this.RecId
        && workflowTrackingStatus.ContextRecId      == workflowTrackingStatusExist.ContextRecId
        && workflowTrackingStatus.InstanceNumber    == workflowTrackingStatusExist.InstanceNumber
        && workflowTrackingStatus.ContextTableId    == workflowTrackingStatusExist.ContextTableId
        && workflowTrackingStatus.TrackingStatus    != WorkflowTrackingStatus::Cancelled ;

    if(workflowTrackingTable.recid)
    {
        ret = true;
    }

    return ret;
}

Selamlar.

İş akışı onayını koddan yapmak

Merhaba

Ax2012′de iş akışını onaylamak için aşağıdaki örnek kodu kullanabilirsiniz.


static void FD_WorkflowWorkItemTable(Args _args)
{

    WorkflowWorkItemTable WorkflowWorkItemTable;
    ;

    WorkflowWorkItemTable = WorkflowWorkItemTable::findRecId(123434343);

    if(WorkflowWorkItemTable)
    {
        ttsBegin;
        WorkflowWorkItemActionManager::dispatchWorkItemAction(
           WorkflowWorkItemTable, // Work item record for which the action is being taken
           strFmt("Auto Approve by %1 ", curUserId() ), // Comment associated with this action
           curUserId(), //The target user of the action
           WorkflowWorkItemActionType::Complete,//The work item action type to take
           "PurchTableApprovalApprove", // The name of the menu item from which the action originated
           false // Flag denoting if this request originated from web or rich client
           );

        ttsCommit;
    }
}

Selamlar.

Page 18 of 41« First...1016171819203040...Last »