Good morning all.
I am facing a problem with POS on Dynamics AX R3 CU11. When creating a SO on POS, everything is fine until I want to create a new shipping address. The system lets me to fill everything in but says that Customer couldn't be saved centrally after hitting Save on the new shipping address.
I was digging into it and found out that it fails on finding the newly created address in the DirPartyPostalAddressView. Whatever is passed as parameters, this method always returns null as it cannot find the record.
It's code is
public static DirPartyPostalAddressView find(DirPartyRecId _party, LogisticsLocationRecId _location, utcdatetime _validFrom = DateTimeUtil::utcNow(), utcdatetime _validTo = _validFrom)
{
DirPartyPostalAddressView postalAddressView;
select firstonly postalAddressView
where postalAddressView.Party == _party &&
postalAddressView.Location == _location &&
postalAddressView.ValidFrom <= _validFrom &&
postalAddressView.ValidTo >= _validTo;
return postalAddressView;
}
At first, I suspected it's because some mismatch of UTC datetime and it is not returning the record because of it. But it did not work even when I removed the ValidFrom/ValidTo conditions. It just looks like the view is not getting materialised or the last created record is not getting there yet. (I even tried to commit any transaction before calling this method - no luck, the address is physically created but it is not getting into the view.)
And the strange thing - if I call the same method of RTS directly from a job in AX, it perfectly works (even with running it under the user of RTS web service). So it is happening only when it is physically called from the web service.
Call stack is basically:
DirPartyPostalAddressView.find (line 5)
DirPartyLocationEntity.createAddressForParty (line 36)
DirParty.createOrUpdatePostalAddress (line 28)
RetailTransactionServiceCustomer.createAddress (line 144)
RetailTransactionService.createAddress (line 80)
Thanks a lot for any help/ideas.
*This post is locked for comments