Requirement:
In D365 Finance and Operation POS we have filter on Inbound Operations to filter on order type either Transfer order or Purchase Order but the requirement is by default it has to show only Transfer Orders only.
Solution:
To achieve this we can either pass default parameter in POS extension but in that scenario user can clear the filter and will be able to see Purchase Order as well and the other option is to restrict while calling the inbound orders itself.
I extend the class “RetailTransactionService” method “getInventoryInboundDocuments” and customize the filter criteria to fix it for Transfer orders only using below code:
[ExtensionOf(classStr(RetailTransactionService))]
final class RetailTransactionService_POS_Extension
{
public static container getInventoryInboundDocuments(str _searchCriteriaJson)
{
int documentTypePosition = strScan(_searchCriteriaJson,"\"DocumentTypes\":",1,300);
str documentTypeFilter = subStr(_searchCriteriaJson,documentTypePosition,19);
str toSearchCriteriaJson = strReplace(_searchCriteriaJson,documentTypeFilter,"\"DocumentTypes\":[2],");
return next getInventoryInboundDocuments(toSearchCriteriaJson);
}
}
Inbound Operations before extension shows both Transfer Orders and Purchase Orders:

Inbound Operations after extension shows only Transfer Orders:

Thanks,
HaHappy Daxing with Rizz 😉
