Saturday 9 February 2019

Object reference not set to an instance of an object

Object reference not set to an instance of an object D365

Every developer gets this error atleast once in his lifetime.
this is a very generic error .
If you want to check the details of the error then check in the event viewer for Microsoft Dynamics.

For example.
If you are opening a form and the form instance is missing then you will get this error.

Thanks.

x++ code to post product recipt

x++ code to post product receipt
static void  postProdReceipt(Args _args)
{
    PurchTable  purchTable = PurchTable::find("000032");
    PurchFormLetter     purchFormLetter;
 
    purchFormLetter = purchFormLetter::construct(DocumentStatus::PackingSlip);
    purchFormLetter.update( purchTable,
                            "PO002",
                            systemDateGet(),
                            PurchUpdate::RegisteredAndServices,
                            AccountOrder::None,
                            false,
                            false);
 
    info("Done");
 
}

Friday 8 February 2019

GET OR FIND ACTIVE DIMENSION IN AX /D365

static void getactivedimension(Args _args)
{
    InventTable inventTable;
    InventDimParm inventDimParm;;
    inventTable = InventTable::find('item001');

    inventDimParm = InventDimParm::activeDimFlag(InventDimGroupSetup::newInventTable(inventTable));

    if (inventDimParm.ConfigIdFlag)
        {
        info("Config Enabled is enabled for item");
    }
}

HOW TO GET THE WORKER ASSIGNED TO CURRENT USER CURUSERID IN AX 2012 /D365

Below is the code to refer.

HcmWorker::find(DirPersonuser::findUserWorkerReference(curUserId())).name();

Thanks,

SOAP AND REST IN D365 EXPLANATION WEB SERVICES

SOAP AND REST  IN D365 EXPLANATION WEB SERVICES
A Web service, is a method of communication between two applications or electronic devices over the World Wide Web (WWW). Web services are of two kinds: Simple Object Access Protocol (SOAP) and Representational State Transfer (REST).
SOAP AND REST  IN D365 EXPLANATION WEB SERVICES, GET, PUT, DELETE, POST and HEAD, D365 INTEGRATION,

SOAP defines a standard communication protocol (set of rules) specification for XML-based message exchange. SOAP uses different transport protocols, such as HTTP and SMTP.
REST describes a set of architectural principles by which data can be transmitted over a standardized interface (such as HTTP). REST does not contain an additional messaging layer and focuses on design rules for creating stateless services. While accessing RESTful resources with HTTP protocol, the URL of the resource serves as the resource identifier and GET, PUT, DELETE, POST are the standard HTTP operations to be performed on that resource.
SOAP is a protocol and REST is an architectural style
SOAP defines standards to be strictly followed, REST does not define too many standards like SOAP
SOAP permits the XML data format only; REST permits different data formats, such as plain text, HTML, XML, and JSON
In D365FnO Integration can be performed via the custom web services (Services node in AOT) or Data Entities using the Odata protocol. Whenever a custom service or a Data Entity is deployed it creates two service endpoints one for SOAP and other REST.
In dynamics AX2012 only SOAP web services were supported for CRUD operations.

HOW TO DO IISRESET IN D365 VISUAL STUDIO

HOW TO DO IISRESET IN D365

GOTO >START>TYPE CMD >RIGHT CLICK AND RUN AS ADMIN
TYPE IISRESET.


tHANKS.

CREATE MOVEMENT JOURNAL CODE IN D365 X++ : CREATE AND POST JOURNAL

CREATE MOVEMENT JOURNAL CODE IN D365 X++

static void createMovementJournalAx(Args _args)
{
   InventJournalTable inventJournalTable; InventJournalTrans inventJournalTrans; InventJournalNameId inventJournalName; InventDim inventDim; JournalCheckPost journalCheckPost; //Below code creates journal header inventJournalTable.clear(); inventJournalName = InventJournalName::standardJournalName(InventJournalType::Movement); inventJournalTable.initFromInventJournalName(InventJournalName::find(inventJournalName )); inventJournalTable.insert(); //Below code creates journal lines inventJournalTrans.clear(); inventJournalTrans.initFromInventJournalTable(inventJournalTable); inventJournalTrans.TransDate = systemDateGet(); inventJournalTrans.ItemId = “Item0001”; inventJournalTrans.initFromInventTable(InventTable::find(“Item0001”)); inventJournalTrans.Qty = 25; inventDim.InventSiteId = 's1'; inventDim.InventLocationId = '123'; inventDim.wMSLocationId = ‘L-001’; inventJournalTrans.InventDimId = inventDim::findOrCreate(inventDim).inventDimId; inventJournalTrans.insert(); //The below code posts the journal journalCheckPost = InventJournalCheckPost::newPostJournal(inventJournalTable); journalCheckPost.run();
}

SEND EMAIL IN D365 CODE X++ LOGIC

SEND EMAIL IN D365 CODE X++ LOGIC

public static void SendEmail()
{
System.IO.Stream workbookStream = new System.IO.MemoryStream();
SysMailerSMTP   mailer = new SysMailerSMTP();
SysMailerMessageBuilder builder = new SysMailerMessageBuilder();
SysEmailParameters parameters = SysEmailParameters::find();
;
 //you will have to setup the below parameters in sysadmin module
if (parameters.SMTPRelayServerName)
{
mailer.SMTPRelayServer(parameters.SMTPRelayServerName,
parameters.SMTPPortNumber,
parameters.SMTPUserName,
SysEmailParameters::password(),
parameters.SMTPUseNTLM);
}
else
{
warning(“SERVER NOT FOUND”);
}


builder.setFrom(SysEmailParameters::find().SMTPUserName);
builder.addTo(“To address”);
builder.addCc(“CC address”);
builder.addAttachmentFromFile(“Fetch the file from the path”);
builder.setSubject(“Email subjectl”);
SysMailerFactory::getNonInteractiveMailer().sendNonInteractive(builder.getMessage());

}

Get current record in form control IN D365

Get current record in form control IN D365  

Get current record in form control event
[FormControlEventHandler(formControlStr(FormName, SomeButton), FormControlEventType::Clicked)]
public static void SomeButton_OnClicked(FormControl sender, FormControlEventArgs e)
{
       SomeTable callerRec = sender.formRun().dataSource(1).cursor();
}

GET FORMRUN FROM FORMDATASOURCE IN D365

GET FORMRUN FROM FORMDATASOURCE   IN D365 

Get FormRun from form datasource
[FormDataSourceEventHandler(formDataSourceStr(MyForm, MyRandomTableDS), FormDataSourceEventType::Written)]
public static void MyRandomTableDS_OnWritten(FormDataSource sender, FormDataSourceEventArgs e)
{
    FormRun formRun = sender.formRun() as FormRun;
    // you can even call custom methods (I think IntelliSense won't work though)
    formRun.myCustomMethod();
}

GET FORM FROM xFormRun sender IN D365

GET FORM FROM xFormRun sender IN D365  

GET FORM  form control from xFormRun
[FormEventHandler(formStr(FormName), FormEventType::Initialized)]
public static void SomeForm_OnInitialized(xFormRun sender, FormEventArgs e)
{
    // set the control to invisible as an example
    sender.design().controlName(formControlStr(FormName, MyControl)).visible(false);
}

tHANKS

GET FORM DATASOURCE FROM xFormRun sender IN D365

GET FORM DATASOURCE FROM xFormRun sender IN D365  

Form datasource from xFormRun
[FormEventHandler(formStr(SomeForm), FormEventType::Initialized)]
public static void SomeForm_OnInitialized(xFormRun sender, FormEventArgs e)
{
    FormDataSource MyRandomTable_ds = sender.dataSource(formDataSourceStr(SomeForm, MyRandomTableDS));
    ...
}

tHANKS

How to get formrn from formcontrol in d365 code

Get FormRun from form control

[FormControlEventHandler(formControlStr(MyForm, MyButton), FormControlEventType::Clicked)]
public static void MyButton_OnClicked(FormControl sender, FormControlEventArgs e)
{
   FormRun formRun = sender.formRun() as FormRun;
   formRun.myMethod();
}

Thanks,
Vikas Mehta

TABLE INIT VALUE IN D365 EVENT HANDLER DATASOURCE tABLE_Post/PRE_initValue

HOW TO CREATE INIT VALUE EVENT HANDLER IN D365 AT TABLE LEVEL


In Table Datasource Events > right click on Init Value > Copy Post/Pre Event Handlers
There are a few rules for augmentation classes:
  • They must be final.
  • They must be suffixed by _Extension.
  • They must be decorated with the [ExtensionOf()] attribute.
Create new Class and below code

Table Method Event Handler
EXAMPLE
class test SalesTableEventHanlders
//you can give any name ....or else you can decorate the class with extensionof(tablestr(salestable));
//in that case you would be able to get the fields directly using this keyword.
//shown at bottom
{
    /// <summary>
    ///
    /// </summary>
    /// <param name="args"></param>
    [PostHandlerFor(tableStr(SalesTable), tableMethodStr(SalesTable, initValue))]
    public static void SalesTable_Post_initValue(XppPrePostArgs args)
    {
        SalesTable SalesTable = args.getThis() as SalesTable;
        SalesTable.isclosed =NoYes::Yes;
    }
}


[ExtensionOf(tableStr(InventTable))] final class InventTable_Extension { public void myDefaultInventLocationId() { // This would have partner specific logic to initialize the new field. this.MyInventLocationId = this.inventLocationId(); } }


Thanks,
Vikas Mehta

MODIFIED METHODS IN D365 FORM FIELD MODIFIED EVENT HANDLER FormDataFieldEventType::Modified

MODIFIED METHOD IN D365 ENVENT HANDLER CODE

WRITE THE BELOW CODE IN NEW CLASS OR ANY OTHER CLASS.
MAKE SURE THAT YOU USE THE METHOD SIGNATURE PROPERLY.

EXAMPLE
 [FormDataFieldEventHandler(formDataFieldStr(InventJournalName, InventJournalName, JournalType), FormDataFieldEventType::Modified)]
    public static void JournalType_OnModified(FormDataObject sender, FormDataFieldEventArgs e)
    {
        FormDataSource          inventJournalName_ds    = sender.datasource();
        FormRun                 formRun                 = sender.datasource().formRun();
//FORMRUN
        InventJournalName       inventJournalName       = inventJournalName_ds.cursor();

        FormTabPageControl      TabFinancialDimensions = formRun.design(0).controlName("TabFinancialDimensions");
 
        inventJournalName_ds.object(fieldNum(InventJournalName, LocationDimensionLink)).visible(true);
           
        }
    }




Thanks,
Vikas Mehta

CLICKED METHOD EVENT HANDLER IN D365 CODE FormControlEventType::Clicked

CLICKED METHOD IN D365 ENVENT HANDLER CODE

WRITE THE BELOW CODE IN NEW CLASS OR ANY OTHER CLASS.
MAKE SURE THAT YOU USE THE METHOD SIGNATURE PROPERLY.

     // <summary>
    ///
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    [FormControlEventHandler(formControlStr(SalesEditLines, OK), FormControlEventType::Clicked)]
    public static void OK_OnClicked(FormControl sender, FormControlEventArgs e)
    {
   
        FormCommandButtonControl  callerButton = sender as FormCommandButtonControl;  //Retrieves the button
        FormRun form = sender.formRun(); //Gets the running form
// you might get error if you use callerButton.formRun
        //Get the salesId that was selected in  form
        FormDataSource salesParmTable_ds = form.dataSource(formDataSourceStr(SalesEditLines, SalesParmTable)) as FormDataSource;
        SalesParmTable salesParmTable = salesParmTable_ds.cursor();

        SalesTable salesTable=salesParmTable.salesTable();

        if(salesTable.SalesStatus==SalesStatus::Invoiced)
        {
         //code

        }

    }

Thanks,
Vikas Mehta

ACTIVE METHODS IN D365 FORM EVENT HANDLER FormDataSourceEventType::Activated

ACTIVE METHOD IN D365 ENVENT HANDLER CODE

WRITE THE BELOW CODE IN NEW CLASS OR ANY OTHER CLASS.
MAKE SURE THAT YOU USE THE METHOD SIGNATURE PROPERLY.

EXAMPLE
class CustTableFormEventHandler
{
    [FormDataSourceEventHandler(formDataSourceStr(CustTable, CustTable), FormDataSourceEventType::Activated)]
    public static void CustTable_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
    {
        CustTable           custTable     = sender.cursor(); //selected record
        FormDataSource      custTable_ds  = sender.formRun().dataSource("CustTable"); //DataSource 
        FormRun             element       = sender.formRun(); //form element
        FormControl         myNewButton   = element.design(0).controlName("MyNewButton"); 
//button on the form
        myNewButton.enabled(false); // enabled or disabled the button
    }
}


Thanks,
Vikas Mehta

Sunday 3 February 2019

D365 INTERVIEW QUESTIONS [UPDATED 2021],AX7,AX2012,DYNAMICS 365 INTERVIEW QUESTIONS

D365  INTERVIEW QUESTIONS

Technical 
For Functional click here

1. What are the new features of D365 ?

WHATS NEW IN D365 
difference betweeen ax 2012 and d365
Microsoft Dynamics 365 Finance and Operation has been completely revamped from its previous version of AX 2012.from technical perspective as well as functional perspective.

Below are some of the changes :
  1. Coding is being done in Visual Studio
  2. VSTS is being used for versioning .
  3. Lots of enhancements have been done to allow integration with REST protocol and java script .
  4. LCS is the tool now used to import and export or deploy/move projects from one environment to another
  5. POWER BI can now easily embedded in D365 with simple setups and configurations.
  6. D365 can now only be viewed from the browser and there is no client required to install separately.
  7. D365 is now hosted on IIS.
  8. DATA Entities are used in D365 for import and export functionality which can be easily created by an end user. They are used for integration perspective also.
  9. Override has been stopped and in case of any changes you will have to use extensions.
  10. A model needs to be mandatorily created/referred for development perspective.
  11. New workspace
  12. New set of form patterns which needs to be applied mandatorily.
  13. Enhanced integrations with Excel and Odata technology.
  14. Hotfixes and updates will be applied 
for more information visit the below site :
https://docs.microsoft.com/en-us/dynamics365/unified-operations/fin-and-ops/get-started/whats-new-changed

2.Can you explain the concept of extensions?

An extension is a way to add functionality to an object in D365FO without modifying the base code of that object.  

Your extensions are compiled into their own DLLs, which are separate from the D365 base system libraries. It also makes it easier for Microsoft to patch their sys layer code.

Microsoft has added to allow customizations without allowing the base code to be changed, because they plan to not allow any overlayering of SYS layer code. 

https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/extensibility/customization-overlayering-extensions


3. What are models and how are the created ? Why are models created ?
A Dynamics AX model is a group of elements that constitutes a distributable software solution (including customizations of an existing solution). A model is a design-time concept. An example of models: warehouse management model, application suite ,etc.
Model can have one or more projects.
Model may only belong to one package.
https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/dev-tools/models

3.1 Have you worked with DIXF Framework?
3.2 How to write a validate write method in D365 at form level or table level?Difference ?
Ans -> https://d365solution.blogspot.com/2019/11/validatedwrite-eventhandler-d365-at.html

4. What are entities and how to you create ?

The entities are used to model and manage business data in Dynamics 365 for Customer Engagement apps. For example, entities such as account, campaign, and incident (case) can be used to track and support sales, marketing, and service activities. An entity has a set of attributes and each attribute represents a data item of a particular type. For example, the account entity has NameAddress, and OwnerId attributes. Conceptually, an entity is like a database table, and the entity attributes correspond to the table columns. Creating an entity record (or, simply a record) in Dynamics 365 for Customer Engagement apps is like adding a row in a database table. The entities are divided into three categories: system, business, and custom. As a developer working with business data, you will use business and custom entities. System entities are used by Dynamics 365 for Customer Engagement apps to handle all internal processes, such as workflows and asynchronous jobs. You cannot delete or customize system entities
AX7,D365  INTERVIEW QUESTIONS [UPDATED 2019],AX2012,D365 QNA,365 INTERVIEW QUESTIONS AND ANSWERS,DYNAMICS 365 INTERVIEW QUESTIONS latest updated,


https://d365solution.blogspot.com/2019/01/what-are-entities-in-d365-how-to-you.html

4.1 What is Sysoperation framework ?how it is different from runbase framework.
https://stoneridgesoftware.com/batch-processing-in-dynamics-ax-2012-using-sysoperation-framework/

4.2 What are the different ways to Synchronize database in D365.
Ans : There are multiple ways .
Click HEREto know more.

5. How to import and export data in D365. ?

You can use data entities or DMF to import and export data in d365 .
Excel addins can also be used .
In fact excel can be used via entities to import in d365 with O365 login.

6. Below are process related questions. They might also ask the functional process.

  1. 2. What are the classes, Tables, Forms and Methods used to post the Sales /purchase orders.
  2. 3. What are the classes, Tables, Forms and Methods used to post the Ledgers.
  3. 4. What are the classes, Tables, Forms and Methods used to post the Inventory.
  4. 6. What are the storage Dimensions?
  5. 7. What are the Item Dimensions?
  6. 9. How do you create a NumberSequence for existing Module and also fro new Module.

7. Delete actions & its types


    7.   How many types of relations are available in Axapta, Explain each of them.
Normal Relation: enforce referential integrity such as foreign keys. 
                            For displaying lookup on the child table.
Field fixed:                works as a trigger to verify that a relation is active, if an enum field in the table has a specific value then the relation is active. It works on conditional relations and works on enum type of data.
Ex- Dimension table


Related field fixed: works as a filter on the related table.it only shows records that match the specified value for an enum field on the related table.

8 .Delete Actions in AX ?
A.            None
              Cascade
              Restricted
              Cascade+Restricted.

To maintain data integrity we will use delete actions 
Delete actions will come in to picture when user is trying to delete a record [Alt + f9]

Cascade: Setting the DeleteAction property to Cascade extends the functionality of the table's delete method. As a result, super(), in delete, initiates a cascaded deletion, propagating the delete from table to table.

A cascaded delete is implicitly protected by tts. Database changes aren't committed until the entire transaction is complete.

This cascading will take place whether the deletion is performed in code or directly by a user through the user interface.

Ex: On the CustTable table, a cascading delete action has been defined for the CustBankAccount table. When a customer is deleted from the CustTable table, the delete method also ensures that the corresponding bank account information is automatically deleted.
Restricted: While deleting a record, If the record having any transcations then a warning message will appear. If the record is not having any transactions in another table then only deleted.

Restricted
Setting the DeleteAction property to Restricted extends the functionality of the table's validateDelete method.

As a result, super(), in validateDelete, checks whether records exist on related tables. If records do exist, validateDelete returns false. The forms system ensures that the deletion is not performed. In your own X++ code, check the return value of validateDelete. Don't delete the primary or related records if the method returns false.

Ex:On the CustTable table, a restricted delete action has been defined for the CustTrans table. When a customer is deleted in the CustTable table, the validateDelete method ascertains whether transactions exist for the customer in the CustTrans table. If so, validateDelete returns false.

Cascade + Restricted: Setting the DeleteAction property to Cascade+Restricted extends the functionality of the table's validateDelete and delete methods.

As a result, super(), in validateDelete, ascertains whether records exist on related tables. Whether deleting records from forms or X++, if validateDelete returns false, the primary record isn't deleted and the cascading delete isn't performed. You should first delete the records in the related table before deleting the primary record.

If the primary record is being deleted as part of a cascading delete, the primary record and the records in the related table will be deleted.
Reference

Ex.The Cascade+Restricted delete action is used in the standard application for LedgerJournalTrans on LedgerJournalTable. This type of delete action is useful when you prefer a total clean-up—when you delete a customer, you also delete all the transactions associated with that customer.
 e.g.: tableA (Customer) (a cascade deleteaction to tableB) tableB (SalesOrder) (a cascade+restricted deleteaction to tableC) tableC (SalesLine)

When a record of tableB will be deleted, the restricted part of the deleteaction will be performed. The record of tableB can only be deleted, if no record in tableC exist for the record in tableB. (The SalesOrder can only be deleted, if no SalesLine exist for the SalesOrder).


A record in tableA will be deleted, so the cascade deleteaction to tableB will be performed. In this case, the cascade part of the deleteaction to tableC will be performed. (When a Customer will be deleted, the SalesOrders and SalesLines will also be deleted)

None - nothing
Cascade - both tables are deleted via code and front end.
Restricted - via form -> error , if you try to delete via code only second table will get deleted.In case you use validatedelete() then you will get errror.
C+R : in both cases both deleted. No error is raised (diff) 

9) Difference between Containers and Temp tables
·         Data in containers are stored and retrieved sequentially, but a temporary table enables you to define indexes to speed up data retrieval.
·         Containers provide slower data access if you are working with many records. However, if you are working with only a few records, use a container.
·         Another important difference between temporary tables and containers is how they are used in method calls. When you pass a temporary table into a method call, it is passed by reference. Containers are passed by value.
·         When a variable is passed by reference, only a pointer to the object is passed into the method. When a variable is passed by value, a new copy of the variable is passed into the method. If the computer has a limited amount of memory, it might start swapping memory to disk, slowing down application execution. When you pass a variable into a method, a temporary table may provide better performance than a container.
  
Temp Tables

From a developer's perspective, temporary tables store data in the same way as normal physical tables, except that the data is automatically dropped when no longer required.
They are useful in two common situations
1.    As the datasource for a form or report, where the original data is too complex to be easily queried.
2.    As temporary storage during complicated processing, to hold the results midway through the process.
10 ) What are the types of temporary tables
Prior to Dynamics Ax version Ax 2012, only one type of temporary table was available. In Ax 2012, however, the Temporary property on tables was replaced with a new property: TableType, which has three possible values:
§  Regular - a standard physical table
§  InMemory - the type of temporary table which existed in the previous versions of Dynamics Ax. Such tables are held in memory and written to a local disk file once they grow beyond a certain point
§  TempDB - a new option in Ax 2012. They are "physical" temporary tables held in the SQL Server database.
The new TempDB tables operate in a similar manner to InMemory tables but support more features from standard physical tables:
§  More powerful joins with physical tables are possible, and are properly supported by the database
§  Can be per-company or global
Support for normal tts transactions

12) Difference between update and doupdate
The doUpdate table method updates the current record with the contents of the buffer. This method also updates the appropriate system fields.

13) Different Sales Order and Purchase Order status?
Sales Order
Open order - on order/delivered/invoiced
Picking           - Reserved physical
Picking list registration - picked
Packing slip - deducted
Invoice         - sold

Purchase order - open order/received/invoiced
Create/confirm - ordered
Receipt list - ordered
Register - registered
Received - received

Invoice - purchased.

The doUpdate method should be used when the update method on the table is to be bypassed. Suppose you have overridden the update method of the table but sometime there is a situation when you don't want the code written in the overridden update method to be executed and at the same time want any selected record of that table to be updated. In such situation you should call the table.doupdate() method instead of table.update() method.

.         What is the difference between form init() & DS init()
Form init(): init is activated immediately after new and creates the run-time image of the form.
DS init(): Creates a data source query based on the data source properties.
The form data source init method creates the query to fetch data from the database and sets up links if the form is linked to another form.

      What is difference between new & construct method
new(): used to create a memory to the object.
Construct():  You should create a static construct method for each class. The method should return an instance of the class.

      What  are the different types of Table groups defined on table properties?
Miscellaneous
Parameter
Group
Main
Transaction
WorkSheetHeader
WorkSheetLine

     How to create lookups in AX ?
 By using table relations
 Using EDT relations.
 Using X++ code(Syslookup class).

Difference between Primary & Cluster index.
Primary index: It works on unique indexes. The data should be unique and not null. Retrieve data from the database.
Clustered Index: Clustered Index. A clustered index defines the order in which data is physically stored in a table. Table data can be sorted in only way, therefore, there can be only one clustered index per table. In SQL Server, the primary key constraint automatically creates a clustered index on that particular column It works on unique and non-unique indexes. Retrieve data from the AOS.

The advantages of having a cluster index are as follows:
Search results are quicker when records are retrieved by the cluster index, especially if records are retrieved sequentially along the index.

Other indexes that use fields that are a part of the cluster index might use less data space.
Fewer files in the database; data is clustered in the same file as the clustering index. This reduces the space used on the disk and in the cache.
The disadvantages of having a cluster index are as follows:
• It takes longer to update records (but only when the fields in the clustering index are changed).
• More data space might be used for other indexes that use fields that are not part of the cluster index if the clustering index is wider than approximately 20 characters).


Difference between Index and Index hint ?
Adding the "index" statement to an Axapta select, it does NOT mean that this index will be used by
the database. What it DOES mean is that Axapta will send an "order by" to the database. Adding the "index hint" statement to an Axapta select, it DOES mean that this index will be used by the database (and no other one).

What is an EDT and Base Enum ?
EDT - To reuse its properties. The properties of many fields can change at one time by changing the properties on the EDT. Relations can be assigned to an edt are known as Dynamic relations.
EDT relations are Normal and Related field fixed.
field fixed works on only between two tables 1- 1 relation and Related field fixed works on 1- many tables so edt uses related field fixed.
          
BaseEnum - which is a list of literals. Enum values are represented internally as integers. you can declare up to 251 (0 to 250) literals in a single enum type. To reference an enum in X++, use the name of the enum, followed by the name of the literal, separated by two colons . ex - NoYes::No.
        
       Define AOS  
The Microsoft Dynamics AX Object Server (AOS) is the second-tier application server in the Microsoft Dynamics AX three-tier architecture.
The 3-tier environment is divided as follows:
• First Tier – Intelligent Client • Second Tier – AOS • Third Tier – Database Server
In a 3-tier solution the database runs on a server as the third tier; the AOS handles the business logic in the second tier. The thin client is the first tier and handles the user interface and necessary program logic.

        Types of data validation methods are written on table level?
validateField(),validateWrite(),validateDelete(),aosvalidateDelete(),aosvalidateInsert(),

aosvalidateRead(),aosvalidateUpdate().'

      What are the different types of menu items available, explain each of them
Display – for Form
Output  - for Report
Action   - for classes.

     Difference between pass by reference and pass by value?
Pass By Reference:
In Pass by reference address of the variable is passed to a function. Whatever changes made to the formal parameter will affect to the actual parameters
- Same memory location is used for both variables.(Formal and Actual)-
- it is useful when you required to return more than 1 values

Pass By Value:
- In this method value of the variable is passed. Changes made to formal will not affect the actual parameters.
- Different memory locations will be created for both variables.
- Here there will be temporary variable created in the function stack which does not affect the original variable.
In case of pass by value, the change in the sub-function will not cause any change in the main function whereas in pass by reference the change in the sub-function will change the value in the main function.
Pass by value sends a COPY of the data stored in the variable you specify, pass by reference sends a direct link to the variable itself. So if you pass a variable by reference and then change the variable inside the block you passed it into, the original variable will be changed. If you simply pass by value, the original variable will not be able to be changed by the block you passed it into but you will get a copy of whatever it contained at the time of the call.

How can we sort the DS, what facility we can get in by placing fields in Ranges
  this.query().datasource(1).addsortfield(fieldnum(tablename,fieldname),sorting:ascending);

 What are Queries, how do we use them
You can create a query to retrieve data by using the query classes.


What is Composite query?
A composite query uses another query as its data source. A composite query is similar to class inheritance in X++ or C#. A composite query is a good design choice when one of the following is true:
An existing query lacks only a range that you want to add. An existing query lacks only a method override that you want to add.

Why do we provide Configuration key & Security Key?
Configuration key: Configuration keys allow administrators to enable or disable features in the application for all users. Disabling features helps to minimize the attack surface against potential attacks.
Configuration keys are applied to:
·                     Tables
·                     Fields
·                     Indexes
·                     Views
·                     Menus
·                     Menu items
·                     Form controls,
·                     Report controls
·                     Extended data types
·                     Enumerations

Security key: Security keys allow administrators to set security on a user group level. Minimizing access on a user group level helps to reduce the attack surface against potential attacks.
The main reasons to apply user-level security are to:
Allow users to do only their designated tasks.
Protect sensitive data in the database.
Prevent users from inadvertently breaking an application by changing code or objects on which the application depends.
You need to apply a security key to:
·                     Tables
·                     Views
·                     Menus
·                     Menu items
·                     Form controls
·                     Report controls

What is difference between select & select firstonly statements
The statement fetches or manipulates data from the database or both fetches and manipulates data from the database. Results of a select statement are returned in a table buffer variable.
If you are going to use only the first record or if only one record can be found, use the firstOnly qualifier. This optimizes the select statement for only one record. It is a best practice to use the firstOnly qualifier in find methods on tables.

What is an Intermediate Language?

(IL) Intermediate Language Or (CIL) Common Intermediate Language Or (MSIL) Microsoft Intermediate Language, is one of the Core component of the .NET Framework. Any .NET source codes written in any .net supportive language (C#,VB.net etc), when compiled are converted to MSIL. This MSIL, when installed or at the Runtime, gets converted to machine code. The Runtime conversion of MSIL code to the machine code is handled by a component called as the Just In Time (JIT) Compiler.

Is multiple inherticance possible in AX?

No
It can be achived through interfaces.


Interfaces : It doesnt have method definition.

void calculatew()
{
}

class classz implements interface

void calculatew()
{
a +b;
}
Id method overloading possible, or function overloading possible in AX ?

no - it doesnt allow to create another method with same name

Abstract and final key words

abstarct - no need to create object, y?? when we know that we have to create object of child classes only, I will make the class as abstarct and i use the concept of constructor controlled inheritance

DataDictinary ->AOT

Table - collection of rows and columns
EDT ?? - Inheritance, code easy readability, lookups, and filter

- 2 RELAtions [Normal and RFF [where clause] in 2009 in 2012 table reference

example : select * from custtable - is normal relation

select * from custtable where gender == female is RFF


How to add columns to the Lookups 

1) Index, 
2) Titlefield1 and Titlefield1 
3) autolookups


How to get lookups?

In 3 ways

- EDT
- AutoLookup
- Relations

what is base enum ?

Set of literals or constants which will never change

- example [week - s,s,m,t,....] enums are stored as integers and max - 250

can be accessed by using :: [scope resolution]

why do we use index 
- faster performace in select queries
Not to allow duplicates
FieldName Followed by Idx = AccountNoIdx

Field groups in tables ?

Autoreport - ctrl + p
Autolookup 
almost all the fields should fall under a fieldgroup - on the forms - field groups form as Group control

Relations on table :
How one table is related or linked to another

Normal - CustTable.accno == custTrans.accno
RFF - paid == custTrans.paid [secondary table on enums]
FF - custTable.gender == male [primary table on enums]

What are the methods on Table ?
initvalue()
validatefield()
validatewrite()
modifiedfield()
validatedelete()
delete()
update()
insert()

forcible inserts/delete/updates
dodelete()
doinsert()
doupdate()

Macros?
macros are resuable components
macros will reduce lines of code
pre-processor
no debugging
faster as they are already compiled

3 ways
- local macro
- aot
- macro library

can we pass values to macro ? yes via strfmt %1 

Forms : ALL below questions are answered on below link.

https://d365solution.blogspot.com/2019/02/forms-interview-question-in-d365.html

When u close the form?

canclose()- boolean, close()

Ok command buton - closeok(), canclose(), close()

Save a record from the form?

when u create a new record?

how do u do filteraions on the forms????

executequery and use queryBuildRange

How t\do you link teh datasources on the form??

How many link types are available on the datasource??

How to u pass values from one form to another form

what is args class??


How do u implement progress bars::

sysoperationprogress class - set total, inccount()
HourglassIndicators - startlenoperation(*), elo()


Runbase framework?

dialogs, progress bars, to run a particular business logic

RunbaseBatch()

dialogs, progress bars, to run a particular business logic. but we can schedule this class to run periodically [recurrance button]

cd, main, run, pack, unpack, description, getfromdialog, dialog, cangobatchjournal

Collection classes? Continer, array, List, Set, Map

What is temporary table?

Table table will not hold the data permanently

- Temporary property on table "Yes" makes the table sas temporary table

- Where is the data stored ? wehreevr the first record is created.[ client, server]

when the record is getting created from form, report

If the date is inserted from table - always the file is created on server

class - runon property - calledfrom, client, server

If the class is getting called from Form - the business logic will run on client

If the class is getting called from table and the calss runon property is seto to called from - then he business logic will run on server

File handling?

1) txt file [txtbuffer- settext,gettext,fromfile,tofile]
comma seperated file>>> csv , commaio class

infielddl,outfieldl,read(),wriote(), recorddelimters, status ok....

xml >> xmldocument - getelementsbytagname, length
xmltextwriter - writestartdocument, endocument, writelement, elementstring, close

what is winapi class?

winapi class will help to do all the things which u can do in the operating systems

1) moving file
2)deleting, renaming, copying, getting the disk space, shutdown....

queries?

why do we use queries?

queries are user interactive, faster, compiles, reusable components

query, queryrun,querybuilddatasource,querybuildrange

if(qr.prompt())

what is difference between temporary table and container?

when there are more than 50 columns then we go for temp tables

and also there are some advantages using temp tables - we can create index, methods , fieldgroups

How do u share tables across the companies?

Table collections and virtual companies

when is configuration key used?

To enable and disable the features for all users [tables, fields, indexes, form controls, edt.enum...etc]


Security key for set of users or usergroups

- tables, forms, report, menuitems etc

RLS [Record level security]

What are display methods?

display methods will help you to show the data from some other table or hardcoded strings..these are not bound controls an we cannot use filter or sorting options

Surrogate Key
A surrogate key is a system generated value that acts as the primary key of a table. This value is typically used instead of a set of fields called the natural key which would typically act as the primary key of a table. Microsoft Dynamics AX 2012 uses RecId as the surrogate key.

With Microsoft Dynamics AX 2012 supporting table inheritance
The Organization table is also a base table because it is extended by two derived tables: NonProfitOrganization and GovernmentOrganization.

Date effectiveness is an ability of the application to associate valid from and to dates with the application artifacts. For example, an agreement can be valid between a range of dates; similarly interest rates are assigned based on start date and end date association

----------------------------------------------------------------------------------------
An Application Object Server (AOS) is a service that runs most of
the business logic. This runs continuously on a central server

The Application Object Server (AOS) is the Microsoft Dynamics AX
application server. The AOS is where most of the business logic is executed.
The AOS performs many tasks. Some of the most important tasks include:
• X++ runtime: It runs the X++ code which provides most of the
business logic in Microsoft Dynamics AX.
• Security: It enforces security to manage access to data and
functionality.
• Session management: It manages client sessions.
• Web services: It is a web service endpoint.

Enterprise Portal pages are displayed through a web browser. A subset of
functionality and reports are available on the portal

The .NET Business Connector is a client that has no user interface. It is
designed for other applications to access the Microsoft Dynamics AX business
logic.

The Application Object Tree (AOT) is a tree view of all application elements in
Microsoft Dynamics AX.

Natural key
You use the values in one or more columns to uniquely identify a record. The column or columns contain meaningful data values. For example, you could use CompanyName as a natural key for the records in a table.

What are Maps ?
Maps are used to link tables. By creating a map, fields can be
accessed in different tables if the fields are of similar types but have
different names. For example, a class that implements functionality
to process data in the tables. If these tables use identical names for
the columns, you can reuse data processing classes.

What are views in d365?
Views are read only data representations that combine multiple table
objects. Views present a selected set of rows and columns by joining
different tables through data sources and relations between them.
Frequently views represent a subset of fields from a single table to
simplify reporting.

When a view is created, the view definition is generated and stored in the
database. When that view is accessed, the view dynamically retrieves the data
that satisfies the view definition.

Views are synchronized like tables. When a view is synchronized, the view
definition is saved to the database. Synchronization of an existing view causes
the definition of that view to be dropped and re-created in the database


What are Extended Data Types ?
Extended Data Types are customized data types based on the
primitive MorphX data types including strings, integers, reals, dates,
times, enums, or containers.

What is Base Enums  ?
Base Enums are a list of literals that can be used throughout the
development environment in MorphX. Enums (enumerable type) are
an extended data type that inherits from a base enum.

What is IntelliMorph ?
IntelliMorph is the term given to the technology that adjusts the layout of forms
and reports which use the modified field group. Adding new fields to a field
group can be a powerful technique for updating forms that use field groups with
a new field.

A Privilege is a group of related permissions that are required to perform a duty.

it is recommended to
group privileges into duties and assign duties to roles.

Duties are a group of related privileges required to perform a task.

Duties are grouped into the following six Process Cycles.
• Conversion cycle
• Cost accounting cycle

Roles are a group of duties that are required by an end-user to do his or her job
based on the end-user's role in the organization.

only two options (yes or no) as to whether a customer account is
on hold.

Optimistic Concurrency Control (OCC) helps increase database performance. Pessimistic Concurrency Control locks records as soon as they are fetched from the database for an update. However, Optimistic Concurrency only locks records from the time when the actual update is performed.
Pessimistic concurrency was the only option available in Microsoft Axapta 3.0 (now a part of Microsoft Dynamics). You can now choose which concurrency model to use—optimistic or pessimistic.


System Index
Microsoft Dynamics AX requires a unique index on each table so if there are no indexes on a table or all the indexes are disabled, a system index is automatically created. The system index is created on the RecId and DataAreaId fields if the DataAreaId field exists. Otherwise the system index is created on the RecId field. You can see system indexes in the database but they aren't visible in the AOT.

These tools include the following:
• X++ Editor
• X++ Compiler
• X++ Debugger
• Visual Studio
• Visual Studio Debugger

New(): This method instantiates a new object.]]]


Main
The main() method is the entry point when the class is executed from a menu
item. The method is static. It defines and initializes the object. Notice that new()
should never accept any parameters. The main method receives one formal
parameter that is an args() object. This object is described further.
The main() method is also responsible for calling prompt(), which executes the
dialog, and then calling run() to perform the manipulation.
static void main(Args _args)
{
DemoRunBase demoRunBase;
demoRunBase = new DemoRunBase();
if (demoRunBase.prompt())
{
demoRunBase.run();
}
}


Property Description
LinkType The LinkType property determines how two data sources
are joined. The following list describes each option:

• Passive: The query on the joined data source is only
executed when the form is opened. A later change in the
controlling data source does not change the view.

• Delayed: The query on the joined data source is
executed every time that the controlling data source is
changed. The query execution is delayed to avoid the
fetch of data, if the controlling data source is changed
multiple times in a short time. This is the case when the
user is scrolling through data on a grid.

• Active: This option is similar to Delayed, except there is
no delay before the query is executed.

• InnerJoin: Selects records from the main table that have
matching records in the joined table and vice versa. If
the joined table does not have any records related to the
main table record, the main table record is not
displayed. Each match returns a result set of the main
table record and joined table record joined together as
one record. This is useful when wanting to display
records from both tables in a grid.

• OuterJoin: Selects records from the main table whether
they have matching records in the joined table. Each
match returns a result set of the main table record and
joined table record joined together as one record. If
there is no match, the fields from the joined table will be
empty.

• ExistsJoin: Selects a record from the main table only if
there is a matching record in the joined table. As soon as
a matching record is found, the main table record is
returned. The record in the joined table is never
retrieved.

• NotExistsJoin: Select records from the main table that
do not have a match in the joined table.

IntelliMorph

IntelliMorph is a technology that simplifies the modification of forms. For
example, IntelliMorph lets users hide and show fields. Individual users can safely
and swiftly rearrange fields to best suit their work preferences without modifying
the form through the AOT (Application Object Tree). IntelliMorph also makes it
possible to quickly redesign forms. Field labels can be modified without
disturbing field data or underlying business logic.
When the form is displayed the width of the labels are adjusted to the actual
language. Fields that are not active because of configuration or security are
removed. The formatting of date, time and numbers is performed according to the
settings in the operating system.

FormRun.Run
The run method is called immediately after the init method. The super() call
makes the form window appear on the screen and performs a database search for
the data to be displayed in the form.
Typical reasons for overriding the formRun.run() method include, activating or
de-activating some fields, setting default values for controls or modifying the
query.
You must call super() if you override formRun.run() method, and you should
place your code before the super() call.

Thanks,
Vikas Mehta.

AZURE INTERVIEW QUESTIONS AND ANSWERS

AZURE INTERVIEW QUESTIONS AND ANSWERES 2021 2. What is cloud computing? Explanation:  It is the use of servers on the internet to “store...