пятница, 22 сентября 2017 г.

Check if ItemId is serialized

Hi folks!

Recently I've had a task in which I need to change visibility of particular button if Item number was serialized.
I found a way how to identify it by checking InventTrans statusReceipt.
But after that my colleague advised to me a way with checking Tracking Dimension Group and now I wanted to share this approach with you, guys!
Maybe it will be useful for someone in future.
Code below:
private boolean checkItemSerialized(ItemId _itemId)
{
    EcoResTrackingDimensionGroupItem        trackingDimensionGroupItem;
    EcoResTrackingDimensionGroup            trackingDimensionGroup;
    boolean ret;
    ;
    trackingDimensionGroupItem  = EcoResTrackingDimensionGroupItem::findByItem(curext(), _itemId);
    trackingDimensionGroup      = EcoResTrackingDimensionGroup::find(trackingDimensionGroupItem.TrackingDimensionGroup);
    if (trackingDimensionGroup.Name == #DimSerial)
    {
        ret = true;
    }
    return ret;
}

четверг, 10 августа 2017 г.

Make indent for textbox in SSRS Ax 2012

Hi All!

I've had a task:

Do indent for Address field in SSRS report.
And the easiest solution was set "Indent" property , namelt Left Indent to 10pt  and you will get next result:








Maybe for someone it will be a clue ( like for me).

Get contact info from site address


Hi fellows!

Recently I h ave had some difficults to get contact information from Site address and I did searching at least 2 days.
I tried tu use many different approaches, some of them was to complicated, some not, but all was not working unfortunately.

But today I found working ( I guess) way.
Here's the code how to get contact information from site address (either phone, email, url and so on). For my case it was Phone:

    LogisticsEntityPostalAddressView     postalAddressView;
    LogisticsElectronicAddress                  electronicAddress;
    LogisticsLocation                                 contactLocation;

    inventLocation = inventLocation::find(ShipmentTable.InventLocationId);
    if (inventLocation)
    {
        select firstonly postalAddressView
            where   postalAddressView.Entity     == inventLocation.RecId
            &&      postalAddressView.EntityType == LogisticsLocationEntityType::Site
            &&      postalAddressView.isPrimary  == NoYes::Yes;

        if (postalAddressView)
        {
            select firstOnly electronicAddress where electronicAddress.Type == LogisticsElectronicAddressMethodType::Phone
            join contactLocation where contactLocation.ParentLocation  == postalAddressView.Location
                && contactLocation.RecId == electronicAddress.Location;

            info(strFmt("Primary contact name: %1  Primary contact phone: %2",electronicAddress.Description, electronicAddress.Locator));
        }

I tried and it worked! I improved query, because originally it has 2 selects instead of 1.

Hope it will be useful for someone!

Happy DAX-ing. :)
   


четверг, 6 июля 2017 г.

Update/delete InventDim (memorize)


Recently I've found during searching one interesting information that could be useful for anyone who develops in AX.
The information related to manipulation with data in InventDim table.

InventDim table is backbone of Dynamics AX Inventory management module
before deleting inventDim record using method inventDim.delete(true) you should do following validation
* There should not be any record in InventSum table related the InventDimID which you are going to delete
* There shuld not be any record in InventTrans table related to InventDimID whicu you are going to delete
before updating inventDIM record using method inventDim.update(true) you should do following validation
* ensure that inventTrans records related to inventDimID which is getting updated is good to get updated with new 'inventBatchId' and 'InventSerialId', otherwise you will have bad information is On-hand details
* ensure that inventDim table is not having any record with new combination is inventory dimension, otherwise it will not get update.
It is recommended that we should not do any outside update and  delete in InventDim Table, but if you will take care of above data intigrity checks then you can update and delete the records in InventDim Table with out any issue.


I hope these observations will be helpful :)

Happy DAX-ing !

понедельник, 27 марта 2017 г.

How to extend BaseEnum Ax7

Today I had some misunderstanding of extension concept. I just wanted to create an extension of NumberSequence, but couldn't do it.
After some investigation I found out that only those BaseEnums which have IsExtendible propety set to true are allowed to extend.

So bear this info in mind during create own enums or extensions from standard enums :)

Happy DAX-ing!

среда, 15 марта 2017 г.

Remove "Close" button from form

Hi All!

Today I found that I fogrot how the Close button could be hidden from standard AX form.
But after google helped me and I share with you this information:

All you need to do is set the "Status bar style" property to SimpleWithoutClose.

And that's it :) Profit.

воскресенье, 26 февраля 2017 г.

Event handler for form datasource ax7

Hi, dear readers!
Recently I've had new task for Ax7, namely, I had to change behavior of one control on form. For this I must not customize current form, but extend it and create event handler to handle it. This was I done.
And below I just wanted to share with you some thoughts about  how we could do it faster and easier:

[FormDataSourceEventHandler(formDataSourceStr(WHSShipmentDetails, WHSShipmentTable), FormDataSourceEventType::Activated)]
    public static void WHSShipmentTable_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
    {
        WHSShipmentTable    shipmentTable = sender.cursor();  // our Args.record()
        //FormDataSource      shipmentDs = sender.formRun().dataSource(tableNum(WHSShipmentTable));      // in that way we could get DataSource to manipulate ds fields for example.
        FormControl         printConfirmControl = sender.formRun().design(0).controlName("ConfirmAndPrintShipmentRun"); //get control to change behavior
                printConfirmControl.enabled(WHSShipConfirm::isShipConfirmEnabledForShipment(shipmentTable));
    }

After creating new class, build the project and verify whether your event handler works or not.

Hope it'd be helpful!

Looking forward to seeing with you in new posts!