最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

Mobile approvals for purchase orders

网络文摘 Mai Kirknel 476浏览 0评论

Prerequisites

Prerequisite Description
Mobile handbook pre-read https://ax.help.dynamics.com/en/wiki/mobile-development-handbook/
Microsoft Dynamics 365 for Operations An environment that has Microsoft Dynamics 365 for Operations version 1611 and Microsoft Dynamics 365 for Operations platform update 3 (November 2016)
Install hotfix KB 3204341. Task recorder can erroneously record two Close commands for drop-down dialog boxes. This hotfix is included in Dynamics 365 for Operations platform update 3 (November 2016).
Install hotfix KB 3207800. This hotfix enables attachments to be viewed on the mobile client. It’s included in Dynamics 365 for Operations platform update 3 (November 2016).
Install hotfix KB 4017918. Application code for the mobile purchase order approval application. This hotfix is included in Microsoft Dynamics AX application 7.1x (date).
An Android or iOS or a Microsoft Windows device that has the mobile app installed for Dynamics 365 for Operations Search for the app in the appropriate app store.

Introduction

To apply mobile approvals for purchase orders, you must install the three hotfixes that are mentioned in the “Prerequisites” section earlier in this topic. These hotfixes don’t provide a workspace for purchase order approvals. To learn what a workspace is in the context of mobile, read the mobile handbook pre-read that is mentioned in the “Prerequisites” section.

Hotfix KB 4017918 provides a workspace for purchase order approvals that can be published from System parameters > Manage mobile workspaces. In the “Example workspace” section later in this topic, you will find an example that illustrates the contents of the workspace.

Every organization orchestrates and defines its business process for vendor purchase orders differently. Therefore, you might want to design a new workspace that meets the requirements of your organization. Before you design a mobile experience for vendor purchase order approvals, you should consider the following aspects of the business process. The idea is to use these data points as much as possible to optimize the user experience on the device.

  • What fields from the purchase order header will the user want to see in the mobile experience, and in what order?
  • What fields from the purchase order lines will the user want to see in the mobile experience, and in what order?
  • How many purchase order lines are there in a purchase order? Apply the 80-20 rule, and optimize for the 80 percent.
  • Will users want to see accounting distributions on the mobile device during reviews? If the answer to this question is yes, you must consider the following questions:
    • How many accounting distributions (such as extended price, sales tax, charges, and splits) are there for a purchase order line? Again, apply the 80-20 rule.
    • Do the purchase orders also have accounting distributions on the purchase order header? If they do, should these accounting distributions be available on the device?
      Note: This topic doesn’t explain how to edit accounting distributions, because this functionality isn’t currently supported for mobile scenarios.
    • Will users want to see attachments for the purchase order on the device?

The design of the mobile experience for purchase order approvals will vary, depending on your answers to these questions. The goal is to optimize the mobile experience for the business process in an organization. The following scenario variations are based on different answers to the preceding questions.

Note: Purchase order approval workspaces can be designed only for approval workflows for purchase order headers. They can’t be designed for approval workflows for purchase order lines.

As general guidance, when you work with the mobile designer, be sure to “publish” any changes, to help guarantee that you don’t lose the updates.

Designing a simple purchase order approval scenario for Contoso

Scenario attribute Answer
What fields from the purchase order header will the user want to see in the mobile experience, and in what order?
  1. Purchase order
  2. Vendor account
  3. Vendor name
  4. Subtotal amount
  5. Total discount
  6. Charges
  7. Sales tax
  8. Total amount
What fields from the purchase order lines will the user want to see in the mobile experience, and in what order?
  1. Item name
  2. Procurement category
  3. Text – description of item
  4. Quantity
  5. Unit price
  6. Line net amount
How many purchase order lines are there in a purchase order? Apply the 80-20 rule, and optimize for the 80 percent. 1
Will users want to see accounting distributions on the mobile device during reviews? Yes
How many accounting distributions (such as extended price, sales tax, charges, and splits) are there for a purchase order line? Again, apply the 80-20 rule. Extended price: 1

Sales tax: 1 Charges: 1 Discount: 1

Do the purchase orders also have accounting distributions on the purchase order header? If they do, should these accounting distributions be available on the device? Not used
Will users want to see attachments for the purchase order on the device? Yes

Create the workspace

  1. In a browser, open Dynamics 365 for Operations, and sign in.
  2. After you’ve signed in, append &mode=mobile to the URL, as shown in the following example, and then refresh the page:
    https://<yoururl>/?cmp=usmf&mi=DefaultDashboard&mode=mobile.
  3. Click Settings (the gear symbol) in the upper-right corner of the page, and then click Mobile app. The mobile app designer should show up just as Task recorder shows up.
  4. Click Add to create a new workspace. For this example, name the workspace Purchase order approval.
  5. Enter a description.
  6. Select a workspace color. The color that you select will be used for the overall style of the mobile experience for this workspace.
  7. Select an icon for the workspace.
  8. Click Done.
  9. Click Publish workspace to save your work.

Design the Purchase orders assigned to me page

The first mobile page that you should design is the list of purchase orders that are assigned to the user for review. To design this mobile page, use the PurchMobileOrdersAssignedtoMe page in Dynamics 365 for Operations. Before you complete this procedure, make sure that at least one purchase order is assigned to you for review, and that the purchase order line has four distributions.

The following setup meets the requirements for this scenario:

  1. In the Dynamics 365 for Operations URL, replace the name of the menu item with PurchMobileOrdersAssignedtoMe, as shown in the following example:
    https://<yourURL>/?cmp=usmf&mi=PurchMobileOrdersAssignedtoMe&mode=mobile
    After you enter the URL, the page that is shown in the following illustration should appear. This page shows the purchase orders that are assigned to you. To find a specific purchase order, you can use the filter on the left. You can complete the steps to design the mobile page only if at least one purchase order is assigned to you. The new pages that are available have been designed specifically for developing mobile scenarios for vendor purchase orders. Therefore, you must use these pages.Purchase orders assigned to me page
  2. Click Settings (the gear symbol) in the upper-right corner of the page where you want to select the fields, and then click Mobile app.
  3. Select your workspace, and then click Edit.
  4. Click Add page to create the first mobile page.
    Add page button
  5. Enter a page title, such as Orders assigned to me, and a description, such as Purchase orders assigned to me for review.
  6. Click Done.
  7. In the mobile designer, on the Fields tab, click Select fields. The columns on the list page should resemble the following illustration.
    Columns on list page after Select fields is clicked
  8. Add the required columns from the list page that must be shown to users on the mobile page. The order in which you add columns is the order in which the fields will be shown to the end user. The only way to change the order of the fields is to re-select all the fields. Only the most important fields are shown in the mobile list view. The remaining fields will appear in the details view that we will design later. For this scenario, the following two fields are required. Click the plus sign (+) in these columns to add the fields to the mobile page:
    1. Purchase order number
    2. Vendor name
  9. You must also add the following columns now, so that we can enable workflow actions later.
    Task work items:

    1. Complete
    2. Return
    3. Request change
    4. Delegate

    Approval work items:

    1. Approve
    2. Reject
    3. Request change
    4. Delegate

    When you’ve finished adding all the fields, the mobile page should resemble the following illustration.
    Mobile page after fields are added

  10. Click Done to exit edit mode.
  11. Click Back and then Done to close the workspace.
  12. Click Publish workspace to save your work.

Design the Purchase order details page

To design the purchase order details page for mobile, use the PurchMobileOrderDetails page. Alternatively, if you want the totals to be calculated in Dynamics 365 for Operations, use the PurchMobileOrderDetailsWithTotals page. The calculation of totals can be a heavy process and therefore requires extra processing from Dynamics 365 for Operations. The calculation is done when the user of the mobile workspace loads the page that shows totals.

Note that, depending on the number of purchase orders in your system, this page shows the oldest purchase order (the purchase order that was created first). To find a specific purchase order, you can use the filter on the left. However, we don’t require a specific purchase order for this example. We just require some purchase order data so that we can design the mobile page.

The following two illustrations show the Purchase order details page. The only difference between the illustrations is that the second page includes fields for totals.

Purchase order details page (without totals)

Purchase order details page (with the Totals FastTab)

  1. In the Dynamics 365 for Operations URL, replace the name of the menu item with PurchMobileOrderDetails or PurchMobileOrderDetailsWithTotals to open the required page.
  2. Click Settings (the gear symbol) to open the mobile designer.
  3. Click Edit to start edit mode in the workspace.
  4. Select the Orders assigned to me page that you created earlier, and then click Edit.
  5. On the Fields tab, click the Grid column heading.
  6. Click Properties > Add page. Note that when you click the Grid heading and add a page, the relationship with the details page is automatically established.
  7. Enter a page title, such as Order details, and a description, such as View purchase order header and line details. Because this example requires that there be only one line on the PO, you can design the header and line information on the same page.
  8. Click Select fields. Note that the order in which you add fields is the order in which the fields will be shown to the end user. The only way to change the order of the fields is to re-select all the fields.
  9. Add the following header fields, based on the requirements for this scenario:
    1. Purchase order
    2. Vendor account
    3. Vendor name
    4. Work item subject
    5. Work item instructions
    6. Subtotal amount
    7. Total discount
    8. Charges
    9. Sales tax
    10. Total amount
  10. Add the following line fields:
    1. Item number
    2. Procurement category
    3. Product name
    4. Quantity
    5. Unit price
    6. Line net amount

    Note: If you had used the PurchMobileOrderLineDetails page to design a dedicated page for the PO line, the PurchMobileOrderDetails and PurchMobileOrderDetailsWithTotals pages would have more line fields to select from.

  11. When you’ve finished adding all the fields from the previous two steps, click Done. The mobile page should resemble the following illustration.
    Mobile page after fields are added
  12. Click Done to exit edit mode.
  13. Click Back and then Done to close the workspace.
  14. Click Publish workspace to save your work.

Add workflow actions

To add workflow actions, use the PurchMobileOrderDetailsWithTotals or PurchMobileOrderDetails page in Dynamics 365 for Operations. Follow these steps to add workflow actions on the details page.

  1. In the Dynamics 365 for Operations URL, replace the name of the menu item with PurchMobileOrderDetailsWithTotals or PurchMobileOrderDetails to open the required page.
  2. Click Settings (the gear symbol) to open the mobile designer.
  3. Click the Edit button to start edit mode in the workspace.
  4. Select the Order details page that you created earlier, and then click Edit.
  5. On the Actions tab, click Add action.
  6. Enter an action title, such as Approve. Optionally enter a description, such as Approve purchase order. Note that the action title that you enter here becomes the name of the action that is shown to the user in the mobile app.
  7. Click Done.
  8. Click Select fields.
  9. Go through the workflow process on the PurchMobileOrderDetails page, and complete the action that you want to record. To include a field for comments in the mobile experience, enter workflow comments as you go through the process.
  10. After you’ve finished running the workflow action, click Done to complete the field selection task.
  11. Click Done to exit edit mode.
  12. Click Back and then Done to close the workspace
  13. Click Publish workspace to save your work.
  14. Repeat the steps 5 through 13 to record all the required workflow actions.
    Note: The purchase orders that are assigned to you must be in a state that enables the workflow actions that you want to include in the mobile experience.
  15. Start Notepad or Microsoft Visual Studio, paste the following JavaScript code, and save the file as a .js file.
    Note: The names of pages and other controls in the code must match the names from the workspace.

    function main(metadataService, dataService, cacheService, $q) {
        return {
            appInit: function() {
                metadataService.configureControl('Orders-assigned-to-me', 'PurchTableApprovalApproveEnabled', { hidden: true });
                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 });
            },
            pageInit: function (pageMetadata, params) {
                if (pageMetadata.Name == 'Order-details') {
                    metadataService.configureAction('Approve', { visible: false });
                    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 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 });
                }
            }
        };
    }

    This code makes the following changes:

    1. Hide the extra workflow-related columns that you previously added on the mobile list page, to provide the information in context and enable the app to continue to the next step.
    2. Based on the workflow step that is active, apply logic to show only those actions.

Upload the code file to the workspace

  1. On the Logic tab, click Done to exit edit mode.
  2. Click Back and then Done to close the workspace.
  3. Click Publish workspace to save your work.

Enable purchase order attachments

  1. Click Settings (the gear symbol) in the upper-right corner of the page, and then click Mobile app.
  2. Click Edit to start edit mode in the workspace.
  3. Select the Order details page that you created earlier, and then click Edit.
  4. Set the Document management option to Yes, as shown in the following illustration.
    Note: If there are no requirements to show attachments on the mobile device, you can leave this option set to No, which is the default setting.
    Document management option set to Yes
  5. Click Done to exit edit mode.
  6. Click Back and then Done to close the workspace.
  7. Click Publish workspace to save your work.

Show purchase order accounting distributions

This scenario requires that there is only line-level distributions. Additionally, a purchase order must always have only one line. Because this scenario is simple, the user experience on the mobile device must be simple enough that the user doesn’t have to drill down several levels to view the distributions. Purchase orders in Dynamics 365 for Operations include an option for showing all distributions from the purchase order header. This experience is what we need for the mobile scenario. Therefore, we will use the PurchMobileOrderAccountingDistribution page to design this part of the mobile scenario.

The PurchMobileOrderAccountingDistributionHeaderOnly page shows only distribution lines that are linked to the header, and the PurchMobileOrderLineAccountingDistribution page shows only lines that are linked to a single order line. Furthermore, each page also has a variant that shows only the actual distribution lines, to provide a more compact view. These variant pages don’t build the full tree structure (see the lines that start with a plus sign [+] in the illustration under step 1). These variant pages are named PurchMobileOrderAccountingDistributionLeafNodesOnly, PurchMobileOrderAccountingDistributionHeaderLeafNodesOnly, and PurchMobileOrderLineAccountingDistributionLeafNodesOnly.

Note: By knowing the requirements, we can more easily decide which page to use and how to optimize the mobile experience for users when we design the scenario.

  1. In the Dynamics 365 for Operations URL, replace the name of the menu item to open the required page, as you’ve done in previous procedures. The page that appears should resemble the following illustration.
    Accounting distribution page
  2. Click Settings (the gear symbol) to open the mobile designer.
  3. Select the Orders assigned to me page.
  4. Click Edit to start edit mode in the workspace.
  5. Select the grid in the designer, and then click Properties.
  6. Click Add page.
  7. Enter a page title, such as View accounting. Optionally enter a description, such as View accounting for the purchase order.
  8. Click Done. The new page is now related to the “purchase order entity.”
  9. On the Fields tab, click Select fields, and select the following fields from the distributions page:
    1. Description (this field includes the description, the amount, and the currency)
    2. Ledger account
  10. Click Done to exit edit mode.
  11. Click Back to return to the Orders assigned to me page.
  12. Select the grid, and then click Properties.
  13. On the Select existing page field, select the Order details page. The Orders assigned to me page is now set to navigate to the Order details page.
  14. Click Done to close the workspace.
  15. Click Publish workspace to save your work.
    Note: The View accounting mobile page isn’t linked to any of the mobile pages that we have already designed. Because users should be able to navigate to the View accounting page from the Order details page on the mobile device, we must enable navigation from the Order details page to the View accounting page. To enable this navigation, open the .js file that you created earlier, and add the following lines to the end of the appInit function that you added earlier. Note that the names of pages and other controls in the JavaScript code must correspond to the names from the workspace.

    //Link to view accounting
    metadataService.addLink('Order-details', 'View-accounting', 'View-accounting-nav-control', 'View accounting', false);
    
  16. Click the Logic tab to upload the code file to the workspace. The previous code is overwritten.
  17. Click Done to exit edit mode.
  18. Click Back and then Done to close the workspace.
  19. Click Publish workspace to save your work.

Validation

From your mobile device, open the app, and connect to your Dynamics 365 for Operations instance. Make sure that you sign in to the company where vendor purchase orders are assigned to you for review. You should be able to perform the following actions:

  • See the My purchase orders approvals workspace.
  • Drill into the My purchase orders approvals workspace, and see the Orders assigned to me page.
  • Drill into the Orders assigned to me page, and see the list of purchase orders that are assigned to you.
  • Drill into one of the purchase orders, and see the purchase order header details and line details.
  • On the details page, see a link to attachments, use this link to navigate to the attachments list, and view the attachments.
  • On the details page, see a link to the View accounting page, use this link to navigate to the distributions page, and view the distributions.
  • Click the Actions menu at the bottom of the details page, and perform the workflow actions that are applicable to the workflow step.

Example workspace

After you install KB 4017918, you can find a Purchase order approval workspace under System parameters > Manage mobile workspaces. You can use this workspace as is, or you can modify it.

This workspace is designed for an order that has multiple lines and rich accounting distribution information. Unlike our example, there is a dedicated page that shows the order line details. The Order line details mobile page was designed by using the PurchMobileOrderLineDetails page.

The workspace has been designed so that it includes the following pages.

To open the Orders assigned to me page, in the list of mobile workspaces, click Orders assigned to me.

Orders assigned to me mobile page

To open the Order details page, on the Orders assigned to me page, click an order.

This page is designed so that it has header fields and multiple lines.

Order details mobile page

 

To open the Order line details page, on the Order details page, click a line.

Order line details mobile page

To open this page, on the Order details page, click Actions.

Example of workflow actions that are available to the user when a TASK work item is assigned.

Actions on the Order details mobile page

To open the Complete task page, on the Order details page, click the Complete action.

Here is an example for one of the workflow actions.

Complete task mobile page

Information about how to open the Order line details page is provided earlier in this table.

To open this page, on the Order line details page, click Accounting distribution.

To open this page to view the details of the account, on the Line accounting distribution page, click the extended price.

Available pages for the design of the purchase order approval workspace

A collection of pages is available for you to use when you design your purchase order approval workspace. The pages are represented by the following menu items:

  • PurchMobileOrdersAssignedtoMe – Show a few purchase order header fields and the workflow actions.
  • PurchMobileOrderDetails – Show purchase order header fields, a few purchase order line fields, and the workflow subject and instruction.
  • PurchMobileOrderDetailsWithTotals – Show purchase order header fields, a few purchase order line fields, totals, and the workflow subject and instruction.
  • PurchMobileOrderLineDetails – Show purchase order line fields.

Note: Not all fields from the purchase order are available on these pages.

Use the following pages if you want to include accounting distributions in the mobile workspace:

  • PurchMobileOrderAccountingDistribution – Show the complete distribution for the whole order.
  • PurchMobileOrderAccountingDistributionHeaderOnly – Show the distribution only for the order header. Exclude the lines.
  • PurchMobileOrderLineAccountingDistribution – Show the distribution for a line.

Each of the preceding pages has a variant that shows a more compact version of the data by excluding records that simulate the tree structure (in other words, records that begin with a plus sign [+] in the illustrations):

  • PurchMobileOrderAccountingDistributionLeafNodesOnly
  • PurchMobileOrderAccountingDistributionHeaderLeafNodesOnly
  • PurchMobileOrderLineAccountingDistributionLeafNodesOnly

Finally, there is a page that shows the segment details for the account:

  • PurchMobileLedgerDimensionPreview

Conclusion

The mobile platform and the application capabilities let you design mobile scenarios that are optimized for a user base in an organization. By using the example and the workspace that are provided in this topic, you can try other variations and create different experiences that meet a specific requirement.

转载请注明:ww12345678 的部落格 | AX Helper » Mobile approvals for purchase orders

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址