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.

Yazılım uzamanı iş ilanı

Merhaba ,

Dmr’de birlikte çalışmak için yazılım uzmanı arayışımız var. İlana buradan ulaşabilirsiniz. İlgelenenler benimle iletişime geçebilirler.

Selamlar.

Page 19 of 41« First...1017181920213040...Last »