How to get public entity name for data entity

like this:

CustCustomerEntity    CustCustomerEntity;

Microsoft.Dynamics.AX.Metadata.MetaModel.AxDataEntityView axDataEntity = Microsoft.Dynamics.Ax.Xpp.MetadataSupport::GetDataEntityView(tableId2Name(CustCustomerEntity.TableId);
info(axDataEntity.PublicEntityName);

Advertisements

Preparation for MB6-894: Development, Extensions and Deployment for Microsoft Dynamics 365 for Finance and Operations. Retail Questions.

Please note this questions were made up, as something that would help learn material for the exam. Answers are colored white and are beneath the question.  If you think there is a mistake , let me know and I ‘ll try to fix it.

  1. Which Retail component controls daily operations and can track sales information in chain of the stores that are treated as one enterprise solution)
    • Retail headquarters
    • Retail POS
    • Retail server
    • Hardware station
    • Retail store scale unit
    • Commerce runtime
    • Channel database
    • E commerce platform SDK
    • Retail SDK
    • Retail Store Scale Unit
    • Answer: retail headquarters
  2. How many POS types are used in Dynamics 365
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • Answer: 2
  3. What types of POS are used in 365
    •  Classic POS,
    • Cloud POS
    • Modern POS
    • Retail POS
    • Classic Retail POS
    • Retail Modern POS
    • Answer: Cloud POS, Retail Modern POS (MPOS)
  4. What provides ODATA web API that let to access information and perform task by using RetailPOS clients and the online store?
    • Retail headquarters
    • Retail POS
    • Retail server
    • Hardware station
    • Retail store scale unit
    • Commerce runtime
    • Channel database
    • E commerce platform SDK
    • Retail SDK
    • Retail Store Scale Unit
    • Answer: Retail server
  5. What provides services that enable Retail PO clients and stuff like printers, cash drawers, payment devices communicate with Retail Server
    • Retail headquarters
    • Retail POS
    • Retail server
    • Hardware station
    • Retail store scale unit
    • Commerce runtime
    • Channel database
    • E commerce platform SDK
    • Retail SDK
    • Retail Store Scale Unit
    • Answer: Hardware station
  6. What is a set of features that supports selling products in store that does not have constant internet connectivity to back office or HQ. And enables cross terminal transactions and shift operations even when you are not connected to the back office.
    • Retail headquarters
    • Retail POS
    • Retail server
    • Hardware station
    • Retail store scale unit
    • Commerce runtime
    • Channel database
    • E commerce platform SDK
    • Retail SDK
    • Retail Store Scale Unit
    • Answer: Retail Store Scale Unit (RSSU)
  7. What serves as the core engine that supports the business logic across the various channels and contains a data access layer service layer workflow layer and an application programming interface ( API ) layer
    • Retail headquarters
    • Retail POS
    • Retail server
    • Hardware station
    • Retail store scale unit
    • Commerce runtime
    • Channel database
    • E commerce platform SDK
    • Retail SDK
    • Retail Store Scale Unit
    • Answer: Commerce run time
  8. What stores data of the retail data for channels
    • Retail headquarters
    • Retail POS
    • Retail server
    • Hardware station
    • Retail store scale unit
    • Commerce runtime
    • Channel database
    • E commerce platform SDK
    • Retail SDK
    • Retail Store Scale Unit
    • Answer: Channel database
  9. What let’s you plug in the front-end online store that can take advantage of the main channel services of the platform
    • Retail headquarters
    • Retail POS
    • Retail server
    • Hardware station
    • Retail store scale unit
    • Commerce runtime
    • Channel database
    • E commerce platform SDK
    • Retail SDK
    • Retail Store Scale Unit
    • Answer: E -commerce platform SDK
  10. What contains a sample source code? And template that can be used to customize retail system
    • Retail headquarters
    • Retail POS
    • Retail server
    • Hardware station
    • Retail store scale unit
    • Commerce runtime
    • Channel database
    • E commerce platform SDK
    • Retail SDK
    • Retail Store Scale Unit

Answer: Retail SDK

Filter odata by enum in the URL

So apparently you cannot use simple string filter to filter odata by enum. You have to reference the enum that you are using in the URL.

For example if you want to filter salesLine data entity by SalesLineStatus field with value invoiced, you have to do the following

https://365DFOP.cloudax.dynamics.com/data/SalesOrderLines?$filter=SalesOrderLineStatus eq Microsoft.Dynamics.DataEntities.SalesStatus'Invoiced'

where

Data entity name –  SalesOrderLines

field name – SalesOrderLineStatus

Enum name – SalesStatus

Referenced enum value – Invoiced

Compare two records in X++ D365FO

To compare tow records in dynamics 365 for operations you can use this code snippet that was created as a runnable class(job)

class job2Compare2Records
{ 
 /// <summary>
 /// Runs the class with the specified arguments.
 /// </summary>
 /// <param name = "_args">The specified arguments.</param>
   public static void main(Args _args)
   { 
     Table          table1,table2;
     RefRecid       recId1 = 68719517265;
     RefRecid       recId2 = 68719517264;

     container compareRecords(Common _record1, Common _record2)
     {
          DictTable dictTable = new SysDictTable(_record1.TableId);
          DictField dictField;
          FieldId fieldId, extFieldId;
          container ret;
          int i, j;
 
          if (_record1.TableId != _record2.TableId)// checking if the same table records
               return conNull();
          int u = dictTable.fieldCnt();
          for (i=1; i<=u; ++i)
          { 
              fieldId  = dictTable.fieldCnt2Id(i);
              dictField = new SysDictField(_record1.tableId, fieldId);
 
              if (!dictField.isSystem())
              {
                  for (j=1; j<= dictField.arraySize(); ++j)
                  {
                       extFieldId = fieldId2Ext(fieldId, j);
 
                       if (_record1.(extFieldId) != _record2.(extFieldId))
                       {
                            ret += [strfmt ("%1, %2, %3",fieldId2Name(_record2.TableId, extFieldId), _record1.(extFieldId), _record2.(extFieldId))];
                       }
                  }
              }
          }
          return ret;
      }
      select table1 where table1.Recid == recid1;
      select table2 where table2.Recid == recid2;
      container a = compareRecords(table1 ,table2);

      for (int i=1; i <= conlen(a); i++)
      {
          info(strFmt("container value %1 - : %2", i, conpeek(a, i)));
      }
 }

}

Lists in Dynamics 365 for Operation

There are 4 different data structures/collection classes/ that can be used when developing in D365.

  • Lists
  • Maps
  • Sets
  • Arrays
  • Structs

Most of these can be familiar from other languages. I will highlight the main points for these data structures, as well as provide examples of their usage. These data structures can be used to store any data types including objects.

List

List sequentially holds elements assigned to it. All values in the list must be of the same type.

Initiate

To initiate the list you have to write following piece of code where instead of Types::Integer, you can use any type including objects.

List             list  = new List(Types::Integer);

Add values

To add values to already initialized list you can use one of the following functions.

list.addEnd(25);
list.addStart(3);

Function addEnd ends a value in the end of the list. Alternatively, function addStart inserts new value in the beginning of the list.

Read values

To output all values from the list you can use following function.

list.toString();

if you want to get a specific value from the list, then you will have to use following code.

ListIterator     iterator;
enumerator = list.getEnumerator();
enumerator.reset();
enumerator.moveNext()
int i = enumerator.current();

ListEnumerator is the class that helps to iterate through list, by accessing each element of the list individually. To get a value of the list we are using function current()

Example

    public static void main(Args _args)
    {    

        List                list  = new List(Types::Integer);
        ListEnumerator      enumerator;

        list.addEnd(1);
        list.addEnd(21);
        list.addEnd(22);
        list.addEnd(23);
        list.addEnd(24);
        list.addEnd(25);
        list.addStart(3);

        info( list.toString());

        enumerator = list.getEnumerator();
        enumerator.reset();
        while(enumerator.moveNext())
        {
            info(int2str(enumerator.current()));
        }     
    }

 

Line by line with visual explanation:

This line of code executes the initialization of the list.

List                list  = new List(Types::Integer);

14

description of the variable fro listEnumerator, that will help to get values from the list

ListEnumerator      enumerator;

15

Adding the first element with value 1 to the list from the end

list.addEnd(1);

3

Adding the second element with value 21 to the list from the end

list.addEnd(21);

4

Adding the third element with value 22 to the list from the end

list.addEnd(22);

5

Adding the fourth element with value 23 to the list from the end

list.addEnd(23);

6

Adding the fifth element with value 24 to the list from the end

list.addEnd(24);

7

Adding the sixth element with value 25 to the list from the end

list.addEnd(25);

8

Adding the seventh element with value 3 to the list from the beginning. If we were to start reading our list, the first element we will get will be the element with value 3

list.addStart(3);

9

Initialization of the enumerator. Now enumerator is attached to the list. On the image below you may notice that enumerator looks like an arrow, and this arrow doesn’t point at any particular element.

enumerator = list.getEnumerator();

10

Because of that we have to reset the enumerators value to make sure that we will be pointing at the beginning of our list. After we use the function reset, the list enumerator “points” at the beginning of the list, not at the first element!

enumerator.reset();

11

To move enumerator to the first element, you have to executed move next method. After that you can work with list elements. You can get the value of the list by using method current();

enumerator.moveNext())

12

to move to the next element you can use the same operation. Notice you cannot move back, only move forward. If you need to start over,  you can use reset();

 

enumerator.moveNext())

13

 

You can notice that there is no description of how to remove the value from the list. To do that you can use class listIterator method delete. As you may suggest , you have to be careful when using it, if you insert/ delete something from the list using iterator, when you have initialized enumerator, you will not be able to use enumerator without invoking error.

Jobs or Hello World in Dynamics 365 for Operations

There are no more jobs in D365 for Operations. Instead now you can use a runnable class.

Create project. Right click on the project/ add item/ dynamics 365 Items/code/ Runnable class (Job)

1

Enter the name,

Add some code to the method main.2

Right click on the new class select “Set as a startup object”

And press run