Thursday, March 22, 2018

Setup an external catalogue for PunchOut eProcurement

D365O has a functionality to do PunchOut eProcurement. The main idea is not having to maintain the vendor item numbers in your system as well as always having the latest information on the vendor items.

Read more in here https://docs.microsoft.com/en-us/dynamics365/unified-operations/supply-chain/procurement/set-up-external-catalog-for-punchout

The steps needed to set this up:
  1. Open Procurement and sourcing > Catalogues > External catalogues
  2. Create a new entry, map it against a vendor, and select one or more the procurement category that will be used. If you only have one procurement category, then all items returned from the vendor’s website will be mapped to that category, otherwise you will have to map the items manually.
  3. The most important setting will be on the message format section, where you will need to configure it so that D365O knows which URL to open, what kind of information that needs to be passed to the vendor’s website. You should contact your vendor (which supports PunchOut eProcurement) to get the information.
  4. Some dynamic information can be configured in the Extrinsics section. Currently the possible dynamic value options are user email, User name, and random value.
  5. You can then click “Validate settings” to make sure that you can open the vendor’s website without any error.
  6. After that, you can then activate the catalogue.
Once you’ve done all that, in the purchase requisition form, you can click the “External catalogues” button on the line section, which will open a dialog where you can choose which vendor’s website that you want to open (based on the configuration that you’ve done on the external catalogues form).

When you click the button, you will get a prompt that says that you will now be redirected to an external site, and after you click OK, you should see the vendor’s website.

You can then place items into the shopping basket, and when you have completed the check out, it will take you back to D365O which gives you the chance to review the order. You can remove lines that you don’t need, or you can choose a different procurement category if needed.


When you click the Add to requisition button at the bottom of the page, it will then transfer the lines into the purchase requisition.
Few important notes:
  • The unit of measurements from the vendor’s website need to exist in D365O, otherwise the lines will be ignored in the validate shopping cart form.
  • The vendor’s website must support TLS v1.2 as D365O environments in tier 2 or higher enforce it.
  • There is a bug (in application 7.2 and 7.3) where it is expecting an element called “SupplierPartAuxiliaryId” in the XML response from the vendor’s website, which the value from that element is not being used in D365O. The bug will only become an issue if the XML response from the vendor’s website do not have that element.
    KB4094740 can be installed to resolve the issue.

Thursday, March 15, 2018

D365O mobile workspace

Starting from platform update 4, D365O introduces the ability to create mobile workspaces which can be loaded from Microsoft Dynamics 365 Unified Operations app, which is available for Android and iOS devices.

The easiest way to learn this is to follow the video tutorials from
https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/mobile-apps/platform/mobile-platform-home-page

Although it looks like very easy to do, you might need to create some forms to make it easier to add the fields into the workspace. If you take a look on Accounts Payable Mobile or SCM Mobile App models, you'll see that Microsoft does that in order to build the standard mobile workspaces.

For PO approval workspace, you can see this page for information on which hotfixes that you need to install.

So with that workspace, there is a new form called PurchMobileOrdersAssignedToMe, which basically is a simple list with very few header information such as PO number, order account and name. The interesting part is there are some checkboxes to indicate if that PO record should have which workflow buttons can be enabled or not.

        public boolean isMenuItemEnabled(WorkflowWorkItemTable _workItem, str _menuItemName)
        {
            container menuItemsContainer;
            str messageText;
            str instruction;

            [menuItemsContainer, messageText, instruction] = SysWorkflowFormControls::getActionBarContentForWorkItem(_workItem);

            return conFind(menuItemsContainer, _menuItemName) > 0;
        }

        public display boolean purchTableApprovalApproveEnabled(WorkflowWorkItemTable _workItem)
        {
            return this.isMenuItemEnabled(_workItem, menuItemActionStr(PurchTableApprovalApprove));
        }

        public display boolean purchTableApprovalDelegateEnabled(WorkflowWorkItemTable _workItem)
        {
            return this.isMenuItemEnabled(_workItem, menuItemActionStr(PurchTableApprovalDelegate));
        }


These checkboxes then get used in the logic of the workspace to show and hide the action buttons. The logic .js file is like this (I put couple of comments to explain what the line does):

function main(metadataService, dataService, cacheService, $q) {
return {
appInit: function() {
            metadataService.configureControl('Orders-assigned-to-me', 'PurchTableApprovalApproveEnabled', { hidden: true }); //to hide the ApproveEnabled checkbox
            metadataService.configureControl('Orders-assigned-to-me', 'PurchTableApprovalDelegateEnabled', { hidden: true });
            metadataService.configureControl('Orders-assigned-to-me', 'PurchTableApprovalRejectEnabled', { hidden: true });
            metadataService.configureControl('Orders-assigned-to-me', 'PurchTableApprovalRequestChangeEnabled', { hidden: true });
            metadataService.configureControl('Orders-assigned-to-me', 'PurchTableTaskCompleteEnabled', { hidden: true });
            metadataService.configureControl('Orders-assigned-to-me', 'PurchTableTaskDelegateEnabled', { hidden: true });
            metadataService.configureControl('Orders-assigned-to-me', 'PurchTableTaskRequestChangeEnabled', { hidden: true });
            metadataService.configureControl('Orders-assigned-to-me', 'PurchTableTaskReturnEnabled', { hidden: true });

            metadataService.hideNavigation('Select-user');

metadataService.addLink('Order-details', 'Header-accounting-distribution', 'header-accounting-distribution', 'Accounting distribution', false);
metadataService.addLink('Order-line-details', 'Line-accounting-distribution', 'line-accounting-distribution', 'Accounting distribution', false);

            metadataService.configureControl('Header-accounting-distribution', 'Grid', { nonEntityProjection: true });
            metadataService.configureControl('Line-accounting-distribution', 'Grid', { nonEntityProjection: true });
            metadataService.configureControl('Order-details', 'LineGrid', { ListStyle: 'Card' });
},
        pageInit: function (pageMetadata, params) {
if (pageMetadata.Name == 'Order-details') {

                metadataService.configureAction('Approve', { visible: false });  //to hide the Approve action/button
                metadataService.configureAction('Reject', { visible: false });
                metadataService.configureAction('Request-change-1', { visible: false });
                metadataService.configureAction('Delegate-approval', { visible: false });

                metadataService.configureAction('Complete-task', { visible: false });
                metadataService.configureAction('Return', { visible: false });
                metadataService.configureAction('Request-change', { visible: false });
                metadataService.configureAction('Delegate-task', { visible: false });

                var entityContextParts = params.pageContext.split(':');
                var data = dataService.getEntityData(entityContextParts[0], entityContextParts[1]);

                var workflowWorkItemRecord = data.getPropertyValue('WorkflowWorkItemTable');
if (workflowWorkItemRecord)
{
var workflowWorkItemData = dataService.getEntityData("WorkflowWorkItemTable", workflowWorkItemRecord);

var approveVisible = Boolean(workflowWorkItemData.getPropertyValue('purchTableApprovalApproveEnabled') == 1);
var rejectVisible = Boolean(workflowWorkItemData.getPropertyValue('purchTableApprovalRejectEnabled') == 1);
var requestChangeVisible = Boolean(workflowWorkItemData.getPropertyValue('purchTableApprovalRequestChangeEnabled') == 1);
var delegateVisible = Boolean(workflowWorkItemData.getPropertyValue('purchTableApprovalDelegateEnabled') == 1);

var completeVisible = Boolean(workflowWorkItemData.getPropertyValue('purchTableTaskCompleteEnabled') == 1);
var returnTaskVisible = Boolean(workflowWorkItemData.getPropertyValue('purchTableTaskReturnEnabled') == 1);
var requestChangeTaskVisible = Boolean(workflowWorkItemData.getPropertyValue('purchTableTaskRequestChangeEnabled') == 1);
var delegateTaskVisible = Boolean(workflowWorkItemData.getPropertyValue('purchTableTaskDelegateEnabled') == 1);
}
else
{
var approveVisible = Boolean(data.getPropertyValue('WorkflowWorkItemTable/purchTableApprovalApproveEnabled').value == 1);
var rejectVisible = Boolean(data.getPropertyValue('WorkflowWorkItemTable/purchTableApprovalRejectEnabled').value == 1);
var requestChangeVisible = Boolean(data.getPropertyValue('WorkflowWorkItemTable/purchTableApprovalRequestChangeEnabled').value == 1);
var delegateVisible = Boolean(data.getPropertyValue('WorkflowWorkItemTable/purchTableApprovalDelegateEnabled').value == 1);

var completeVisible = Boolean(data.getPropertyValue('WorkflowWorkItemTable/purchTableTaskCompleteEnabled').value == 1);
var returnTaskVisible = Boolean(data.getPropertyValue('WorkflowWorkItemTable/purchTableTaskReturnEnabled').value == 1);
var requestChangeTaskVisible = Boolean(data.getPropertyValue('WorkflowWorkItemTable/purchTableTaskRequestChangeEnabled').value == 1);
var delegateTaskVisible = Boolean(data.getPropertyValue('WorkflowWorkItemTable/purchTableTaskDelegateEnabled').value == 1);
}

                metadataService.configureAction('Approve', { visible: approveVisible });
                metadataService.configureAction('Reject', { visible: rejectVisible });
                metadataService.configureAction('Request-change-1', { visible: requestChangeVisible });
                metadataService.configureAction('Delegate-approval', { visible: delegateVisible });

                metadataService.configureAction('Complete-task', { visible: completeVisible });
                metadataService.configureAction('Return', { visible: returnTaskVisible });
                metadataService.configureAction('Request-change', { visible: requestChangeTaskVisible });
                metadataService.configureAction('Delegate-task', { visible: delegateTaskVisible });
}
}
};
}