Delete Cancelled PO – Ax2012/D365 FO

We had a scenario where we were asked to delete cancelled POs from the system. Though it seemed to be a simple task but when the POs had many confirmation versions, we ended up with the error “If previous versions exist, the current document cannot be deleted. “
In order to overcome this error, PO related records are to be deleted from the table PurchTableVersion.
Also note,deleting the corresponding Purchline would end up in a SOFT delete (records are not deleted from the database instead the field “IsDeleted” is set to yes ) . To handle this, delete the records from the table PurchLineHistory.
Deleting a cancelled PO has references in many tables, so the above post is as-is and the above suggestion can be tried in Test or other environments before doing in Prod.

 

 

Advertisements
Posted in Ax 2012, D365 Operations, Uncategorized | Tagged , | Leave a comment

DateTime functions

Latest version of Ax refers to the fields which are of type UtcDateTime . There are situations where we need to find the records for a particular created Date or between from/To datetime fields. In such cases, Global class helps us with the functions:
  • datetobeginUtcDateTime
  • datetoendUtcDateTime
Below code snippet finds the records from the purch table for the given date.
public static void main(Args _args)
{
          date dateToConvert = mkDate(29,8,2017);
date dateToConvertEnd = mkDate(29,8,2017);
        select purchTable where
(purchTable.CreatedDateTime >= Global::datetobeginUtcDateTime(dateToConvert,          DateTimeUtil::getUserPreferredTimeZone()) &&
purchTable.CreatedDateTime < Global::datetoendUtcDateTime(dateToConvertEnd, DateTimeUtil::getUserPreferredTimeZone())) ;
}
Posted in Ax 2012, D365 Operations, Uncategorized | Tagged , | Leave a comment

Move the objects from one model to another – D365 FO

In order to move the objects from one model to another model, we opt to copy -paste from original model`s physical folder to destination model`s folder. This is feasible when we have limited objects. but if the object count is more, this approach is tedious.
So here is another way to move the objects from one model to another.
  1. Open the project which has all the objects.
  2. In the same solution, create another project and set its model to the new one .
  3. Drag and drop the objects from the above project to the new one .
  4. Sync and Rebuild.
  5. Now the objects are ready in new model .
This way our job becomes easy and we can be sure the obejcts are not missed because there are chances of missing the objects when they are moved across physical locations.
Posted in D365 Operations, Uncategorized | Leave a comment

Automatic Settlements with Credit Notes – Ax2012 /D365 FO

In Ax, Automatic settlements can enabled while posting Invoice . This set up can be done from :
  1. AR Parameters -> Settlements Tab -> Options group
  2. AR -> Posting Profiles -> Table restriction group
When Automatic settlement is enabled,parameters can also be set to decide against which transactions the Credit note can be settled. For instance, it can be settled against Open transaction against the customer or with the original SO or with the payment created. This set up can be done from
When the parameter “Default Settlement type for Credit notes” is set to None,the credit note will be settled against the original SO. If it is Designated Transactions, the settlement will be against GL Transactions which have open balance.
Note: There might be various other factors involved for the users business requirement. This is just a cent of my thought where Automatic settlement is involved with the above set up.
Posted in Automatic settlement, Ax 2012, D365 Operations | Leave a comment

Create Settlement on payment journal creation- D365 FO / Ax2012

There are scenarios where we might need to create  settlement dynamically when a payment journal is created. As we are aware, SpecTrans is the table which is used for this requirement. This post gives an overview of the fields that are needed when this table is used for marking settlement.
As a first step, for our requirement a new payment journal is created with corresponding values. So how do we populate the values in SpecTrans which marks the settlement?This is where the fields SpecTransRecid/SpecTransTableId plays a role. These fields are mapped with the values of Tableid and RecId of the LedgerJournalTrans where the settlement is marked.
What is the use of the field RefRecid/RefTableId? In our scenario, the invoice and the actual settle amount are referred from the table CustTransOpen (from the relation CustTrans). So these fields have the values of TableId and RecId of CustTransOpen.
The field Balance01 denotes the amount that is being settled. If there is partial settlement , then this field has the value of settled amount.
Given below the code snippet which is used for Customer settlement.
SettlementCreation
Posted in Uncategorized | Leave a comment

Data Management Export – D365 FO

We had a requirement where the DMF export has to be triggered when a posting happens.
Given below the code snippet which works independently when few of the input parameters are given.

DoExportDMF

 

Posted in Data Management - DMf, Dynamics 365 Operations - Ax 7.0 | Tagged , | Leave a comment

Hide “Export to Excel” – D365 Operations

The option of “Export to Excel” always appears by default on all the forms . Is there is a way to suppress this option. Yes. Here it is :
Export To Excel.JPG
The property ” Export Allowed” in the form grid can be set to No. Thus the user will not be able to see the option of “Export to Excel”.
Another tip : Is it possible to change the text “Export to Excel” to other text value?? Yes. In the picture above, look at the other option “Export label”. By default, this label takes the value as “Export to Excel”. User can enter the label as per the requirement and the effect can be see on the form after a build.

 

Posted in D365 Operations, Dynamics 365 Operations - Ax 7.0 | Tagged , | Leave a comment