Assessing the Problem and the Solution
The Acumatica Mobile App utilizes screen FS400100 to generate the Appointment List Menu Item. When Field Techs display this screen, they have two filter options: date range and staff member. Missing from the filters is a status to remove on hold, completed, closed, or canceled appointments. The goal: remove the clutter so Field Techs can focus on just the appointments they need.
A quick and easy solution would be to expose a generic inquiry (GI) to the mobile app with these filters. The issue is that the GI navigation on the mobile app lacks the same functionality as the core Acumatica has, namely being able to open the transactional appointment screen when displayed.
A better option is to simply modify the Appointment List screen and add a status. What approach shall we take to do this?
Evaluating the Existing Code
The first thing we want to do is navigate to the Account Summary screen FS400100 in Acumatica. Using the hand dandy Inspect Element, CTRL+ALT+CLICK, we can identify the Business Logic Code (BLC) is AppointmentInq and the two DACs AppointmentInqFilter and FSAppointmentFSServiceOrder.
Notice that the header filter, DAC AppointmentInqFilter, does not contain the Status field in the filter header section of the inquiry screen (FS400100). Therefore, we will need to add it.
Next, we need to look at the query that will filter the records. This is the Appointments View declared on the BLC using the FSAppointmentFSServiceOrder DAC with a few joins to other tables.
Notice the following:
- It is decorated with PXFilterable
- Uses the Traditional standard BQL and is not yet updated to BQL Fluent
- Does not use the newer IEnumberable
Design Solutions
Option One
Add the field to an extension DAC and override the select view Appointments from the graph extension & add the filter field to the mobile app.
Pros: Quick and easy to do… Cons: Hard to maintain as versions changes have to keep up with view changes and it’s not Acumatica’s recommended approach.
In this option, we will need to add the follwing to the existing filter view:
.And<Current<AppointmentInqFilter.usrStatus>.IsNull
,Or<Current<AppointmentInqFilterExt.usrStatus>.IsEqual<FSAppointmentFSServiceOrder.status>>
Option Two
Add the field to an extension DAC and Override the view with a Delegate View & Add the filter field to the mobile app
Pros – Acumatica provides an example in the T300 training course, where you will find it in section 11.7.
Here is the code:
GIST: https://gist.github.com/anaxetogrind/dc53fe2e62bfde79b9a36e0d26192818
Testing & Gotchas
At first, I had my current statement the wrong way around in the Where And statement. That is to say, I placed it on my FSAppointmentFSServiceOrder portion of the Where clause. This created a weird situation where the code compiled without error but upon running the process Acumatica threw an invalid Syntax near ); error. This seemed like an SQL error to me, so I was able to trace the problem down by looking at the generated SQL via the Request Profiler. From there, I could see in the P25 parameter that my UsrStatus was being populated but my Status from the appointment was blank. So SQL read: and (@P25 = ). The missing value caused the error and was fixable by correcting the Where clause statement in the method.
Also, during testing, I noticed I had forgotten to set the Commit Changes to true on the UsrStatus field. This caused the records not to be refreshed unless another Filter Field was also updated.
Update the Mobile App
Lastly, we need to add the filter field to the Mobile Application. The Appointment List is in the Appointment Summary screen FS400100. Looking at the WSDL/MSDL, we see that our UsrStatus field is added to the Selection container.
A quick update line on the Commands screen for the Mobile Application to Update FS400100 and a quick update to the Menu to force the application to update.
GIST: https://gist.github.com/anaxetogrind/9862b713ed15116d5cb5194a9e4ea988
And just like that, the mobile application now includes our filter:
I hope you have found this post useful. Happy Coding!