среда, 5 сентября 2018 г.

Get LogisticsLocation record from customer

Hi! 
Today I've had a requirement to show some custom fields from the LogisticsLocation record from the customer table. I wrote a display method for a particular field, but this approach can be used in different ways. It depends on your requirements.
So, below the code:

public display IsReservedAccount displayIsReservedAccount(CustTable _customer)
{
    DirParty                        dirParty;
    LogisticsLocation               location;
    LogisticsPostalAddress          address;
    dirParty = DirParty::constructFromCommon(_customer);
    address = dirParty.getPrimaryPostalAddressLocation().getPostalAddress();
    location = LogisticsLocation::find(address.Location);
    return location.IsReservedAccount;
}
Hope it will be useful for someone as for myself. 

пятница, 18 мая 2018 г.

Check how many rows were selected on the form grid

Hi!

This approach is common for either DAX 2012 or D365FO.

If you need to check how many rows were selected by the user, you just need to get the formDataSource value before, for example

FormDatasource fds = _args.record().datasource();

And then write next code:
if (fds.recordsMarked().lastIndex() > 1)
{
    info("more than 1 record was selected");
}  

Hope, this information will be useful for someone as for me.

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

Disable auto complete of form control


Hi!
Today I've faced with an issue which causes some discontent of my client. He wanted to scan barcode via barcode field but without autocomplete in this field. What I mean: when you input something into the field (the field type doesn't matter), the system "remembers" this value and if you try to enter it one more time when you started to enter, the system will complete it for you. For example:
"111". When you started entering 111 second time the system will finish it for you.
And I'd need to disable this feature as my client wants. But I didn't find any property which can help me with this.
After a while, my friend suggested I use the method delAutoCompleteString() on the control.

Finally, the code for disabling autocompletion for control would look like this:
public boolean modified()
{
boolean ret;
;
ret = super();
element.delAutoCompleteString(this);
return ret;
          } 

I hope, this information will be helpful for someone else :)

Happy DAX-ing!

пятница, 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 !