In this blog, we are going to guide you through the following steps required for the successful configuration of Power ...
Mehr lesenAdvanced WHS Mobile Device Development: [Part 4] – How to Display Sales Order Line Details
Friday, July 17, 2020
Reading time: 3 minutes
Welcome to the final part of our WHS mobile device development series where we’ve walked through a mobile device development process using process guide framework with Dynamics 365 Finance & Supply Chain Management.
In this final part of the blog series, we’ll walk through how to display the sales order line details along with the finishing touches of this mobile device development process.

Dynamics 365 WHS Mobile Device Development: Step 3 - Displaying Sales Order Line Details
For the final step, we just have to retrieve the selected value and display its related information. In our case, two fields are needed to retrieve the sales line record: Sales ID (this was set in the 1st step) and sales line number (this was set in the previous step). We will use the WhsrfPassthrough object to access this data. After we have retrieved the sales line record, we can begin building the page. We add the title text using the _page.addLabel() method and record-related data using the _page.addTextBox() method.
protected void addDataControls(ProcessGuidePage _page)
{
SalesId salesId;
LineNum lineNum;
WhsrfPassthrough pass = controller.parmSessionState().parmPass();
if (pass.exists(ProcessGuideDataTypeNames::SalesId))
{
salesId = pass.lookupStr(ProcessGuideDataTypeNames::SalesId);
}
lineNum = conPeek(str2con(pass.lookupStr(ERASalesProcessGuidePromptSalesLineListStep::SALESLINEC), ‘, ‘), 2);
if (salesId && lineNum)
{
SalesLine salesLine = SalesLine::find(salesId, lineNum);
if (salesLine)
{
str qty = num2Str(salesLine.SalesQty, 0, 2, DecimalSeparator::Dot, ThousandSeparator::Space);
str price = num2Str(salesLine.LineAmount, 0, 2, DecimalSeparator::Dot, ThousandSeparator::Space);
//Fill details panel
_page.addLabel(ProcessGuideDataTypeNames::RFTitle, ‘Sales line Details‘, extendedTypeNum(Description));
_page.addTextBox(ProcessGuideDataTypeNames::SalesId, “@SYS9694“, extendedTypeNum(SalesId), false,
salesLine.SalesId);
_page.addTextBox(ProcessGuideDataTypeNames::SalesLineItemId, “@SYS12836“, extendedTypeNum(ItemId),
false, salesLine.ItemId);
_page.addTextBox(ProcessGuideDataTypeNames::SalesLineQty, “@SYS14578“, extendedTypeNum(SalesQty), false,
qty);
_page.addTextBox(ProcessGuideDataTypeNames::ProductLabelName, “@SYS59620“, extendedTypeNum(ItemFreeTxt),
false, salesLine.Name);
_page.addTextBox(ProcessGuideDataTypeNames::Price, “@SYS6901“, extendedTypeNum(SalesLineAmount), false,
price);
return;
}
}
throw error(‘Sales line was not found‘);
}
It’s important to emphasize that the first parameter argument of the _page.addTextBox() method should be unique among all fields on the page. For this reason, we have added missing static variables to the ProcessGuideDataTypeNames object to suit our solution.
In ERASalesProcessGuidePromptSalesLineDetailsStep class we check if the OK button was pressed and print information stating that the process is complete using the addCompletionMessage() method.
protected boolean isComplete()
{
#ProcessGuideActionNames
return (controller.parmClickedAction() == #ActionOK);
}
protected void doExecute()
{
//Add logic to process sales line
this.addCompletionMessage();
super();
}
private void addCompletionMessage()
{
ProcessGuideMessageData messageData = ProcessGuideMessageData::construct();
messageData.message = “Sales line was processed successfully“;
messageData.level = WHSRFColorText::Success;
navigationParametersFrom = ProcessGuideNavigationParameters::construct();
navigationParametersFrom.messageData = messageData;
}
Note: your logic can be added to doExecute() method to process the selected data.
If implemented correctly, the result should look like the following:
Dynamics 365 WHS Mobile Device Development: Finishing Touches
Similar to the old standard, in order to properly display the list view, we need to set the particular pattern for the step. The only different thing is distinguishing if it’s the right time to display a list. It is now more precise because you need to specify the exact step class name. See the example below for reference:
[WHSWorkExecuteMode(WHSWorkExecuteMode::ERASOList)]
public class ERAWHSMobileAppServiceXMLDecoratorFactorySOList implements WHSIMobileAppServiceXMLDecoratorFactory
{
public WHSMobileAppServiceXMLDecorator getDecorator(container _con)
{
if (this.isSOListStep(_con))
{
return new ERAWHSMobileAppServiceXMLDecoratorSOList();
}
return new WHSMobileAppServiceXMLDecoratorFactoryDefault().getDecorator(_con);
}
private boolean isSOListStep(container _con)
{
#WHSRF
const str InputStep = classStr(ERASalesProcessGuidePromptSalesLineListStep);
int curStemNum = conFind(conPeek(_con, 2), #CurrentStep);
str currStep = conPeek(conPeek(_con, 2), curStemNum + 1);
return currStep == InputStep;
}
}
If you don’t notice any change in the step appearance, try to clear the cache as stated above.
After the development is complete, your project should look something similar to this:
We hope you found these WHS mobile device development tips useful, along with the rest of Companial’s Dynamics 365 WHS mobile device development blog series. In case you missed it, Part 1 of the blog series introduces the Process Guide Framework, Part 2 looks at how to create a mobile device window for the sales order selection and Part 3 explores how to achieve the sales line list functionality in a mobile device.
If you have any questions on Dynamics 365 WHS mobile device development don’t hesitate to contact us at service@companial.com.
We look forward to hearing from you!
Edgaras Radvilas is a devoted Microsoft Dynamics AX professional with more than 7 years of experience in AX 2009, AX 2012, and Dynamics 365 F&SCM development and upgrades. His responsibilities also include solution architecture, technical design preparation, implementation, testing, and support duties. Skilled in X++ development for Sales, Purchases, Project management, Inventory and Warehouse management, Finances modules, as well as in building custom service-based integrations. In addition to that, he also has experience with warehouse management mobile app development.
- How to Solve RDL Sandboxing Problems that Arise When Opening SSRS Reports for D365 F&SCM 10.0.13 Platform Update - 18/01/2023
- Advanced WHS Mobile Device Development: [Part 4] – How to Display Sales Order Line Details - 02/12/2022
- Advanced WHS Mobile Device Development: [Part 3] – The Sales Line-List Functionality - 30/11/2022
Mehr über Finance and Supply Chain Management
How to deploy Power BI report from Dynamics 365 F&SCM through LCS project asset library
We will show you how to add your Power BI report to your LCS Project Asset library and how to ...
Mehr lesenHow do Existing AX Customers Benefit from Moving to Dynamics 365 Finance and Supply Chain Management in the Cloud?
If your customers are still considering whether to move to D365 or not, we‘re here to provide an overview of ...
Mehr lesenHow to Solve RDL Sandboxing Problems that Arise When Opening SSRS Reports for D365 F&SCM 10.0.13 Platform Update
In this blog we would like to share our experience of overcoming issues as well as insights to help make ...
Mehr lesenHow to keep the newest D365 F&SCM system updated without any hassle
In this blog post we are going to answer all questions and dispel any doubts that your customer might have ...
Mehr lesenHow to avoid issues with Virtual Company settings when migrating Microsoft Dynamics AX 2012 (or older versions) to D365 F&SCM
Migrating data from AX2012 (or an older version) to Microsoft D365 for F&SCM may present unexpected challenges. In this blog, ...
Mehr lesen