Thursday, September 14, 2017

How to extend receipt using custom fields

Hello it has been a while since my last post. Today I want to guide you thru on extending the receipt layout using custom fields. This is great if the business wanted to see additional fields or information on the receipt. If you follow this guide you will become a pro/expert on modifying the receipt :P

1. Open up the AOT and go to RetailLangaugeText table, open it and fill in the column “languageId” to “en-us”, Text to how you want it to show up on the receipt designer and uniqe TextId. You can close the AOT after you’re done.




2. Go to Retail > Setup > POS > Profiles > Custom fields and add your custom field and assign a unique Caption text ID that you created earlier in the AOT.

3. We want to add the new Custom field on the Receipt layout. Go to receipt designer and add the field to the correct section of the receipt. In my case I added "Discount Price" to the "Lines" section of the receipt. Click “Save” at the top and close this form.


4.  Open up your Retail SDK and open up your Commerce Run-time solution. If you don't have the Retail SDK you would need to install this component using AX Setup.

5. On the Solution Explorer type in “ReceiptService.cs” into the search bar and open that class.

6.  The receipt layout has 3 sections: Header, Line, Footer. Depending on where you are planning to put your custom field matter in this case. If you are using the custom field in Header or Footer, the method you want to use is GetInfoFromTransaction(). If you are using the field in the Lines section then the method you want to code in is GetInfoFromSaleLineItem(). In my case I’m planning to put mine on the Lines of the receipt so I will be putting my custom code in GetInfoFromSaleLineItem().

7. This method contains numerous case statements. What I’m trying to achieve on the receipt is to show the discounted price of the item instead of the original price.


8. Navigate to where the Reference folder and we want to copy these DLLs.


9.  Open IIS and we want to stop the “RetailServer”.


10. Paste the DLLs into this folder. After this is done don’t forget to start IIS back up!

11. Open mPOS and login. Go back to Visual Studio and we want to attach the process.

12. Attach the following processes, click Attach if you get a warning. We want to make sure that our symbols get loaded for debugging. We can see this if you see a red circle where you put the breakpoint. If you see a white circle, then that mean the symbol did not load.

13.  From here you can debug and test your code to see if it working correctly.

14.  I was able to get the discounted price to show instead of the original price. For the customer they would like to know how much they have saved so I included the Regular and Saving fields. This will let the customer know the amount they have saved.






Friday, July 28, 2017

Async Client Troubleshoot: Unable to authenticate username and password

As I was setting async client service up I was constantly getting an error everytime I test the connection. I checked the event viewer and the error I would get is relating to username and password. I have checked to make sure the credentials in AX matches the one I had setup in the Async Client Configuration Tool. I sync metadata and nothing seems to work. I didn't have any SSL certificate error and my async server works perfectly fine on my async client host. So after digging around and talking with Microsoft we found out that there were duplicate records in the dbo.DATASTORE table that was preventing the async client tool to authenticate the username and password.

1. To remedy the problem we need to go to where we created our Async Server Message Database.
2. Query the dbo.DATASTORE table.
3. Delete the duplicates record (you might run into an FK error because other tables are also using the same record.) Make sure you delete those childs records and then come back and delete the duplicates record in the dbo.DATASTORE table.
4. Once that is done go back in AX > Retail > Channel Database form and fill out the credential.
5. Go to Retail scheduler parameters and click "Sync metadata".
6. If you query the dbo.DATASTORE table you should only see one record.
7. Go back to Async Client Configuration Tool, fill the credential exactly like how you had in AX.
8. Click "Test Connection" you should get a message box prompting "Connection successful".
9. Go to Services and restart the Async Client service.
10. Go to back to Channel database form in AX and run your job and see if it applied. If the job applied your async client service is working like it supposed to.



EDIT:
This is a cascading delete on those FK constraints. If you still get constraints errors make sure you delete other child records first. Go into your channel database and create a new query. Copy the following queries and execute to delete all child records.

delete from DOWNLOADSESSIONDATASTORE where datastoreid in (select id from datastore where name = 'RetailStore')
delete from DATASTOREHEARTBEATLOG where datastoreid in (select id from datastore where name = 'RetailStore')
delete from UPLOADSESSIONLOG where datastoreid in (select id from datastore where name = 'RetailStore')
delete from DATASTORE where name = 'RetailStore'

Hopefully this will help those that are stuck and unable to get the async client service up and running. Cheers!

Friday, June 30, 2017

D365 mPOS installation and activation.

D365 VM Retail Setup and Installation

1.      Navigate to Retail and commerce > Channels > Channel deployment.
2.      On the Channel deployment page, click the Registers tile.
3.      On the Registers page, select Houston-3.
4.      On the page for the register, under General, verify that the Support offline option is set to No. If you want to have offline functionality, then you can enable it.
5.      Now navigate to Retail and commerce > Channels > Channel deployment.
6.      On the Channel deployment page, click the Devices tile.
7.      Select Houston-3 as your device.
8.      At the select Download button and select Configuration file.
***The browsers might block the download pop-up that is generated. You must select either Allow once or Options for this site > Always allow. Then, while the device is still selected, click Download again.
9.      Save the Configuration file on the desktop.
10.  Next, download Retail Modern POS.
11.  Instead of saving the file we can go ahead and click Run.
12.  Once the application successfully installed we need to copy the Configuration file to the newly created folder.
13.  Copy Configuration file you saved on your desktop.
14.  Open file explorer and navigate to C:\Program Files (x86)\Microsoft Dynamics 365\70\Retail Modern POS\Tools. Go ahead and paste the Configuration file in this folder.
15.  In D365 environment navigate to Retail and commerce > Employees > Workers in the filter box type in 000160 and open that worker up.
16.  Select Retail in the action pane and click Clear identity.
17.  In the action pane click Edit, and in the worker, select Retail tab.
18.  Under External Identity we need to fill out the following:
Alias: your email
UPN: your email
External sub identifier: Azure object ID
You might wonder where the crap can I find my Azure object ID, say no more
1.      You can find it by going to https://portal.azure.com use your email to login.
2.      In the search box type Users and hit enter.
3.      Select All Users on the left.
4.      Type in your name and select your user.
5.      Copy Object ID and paste that in your External Identity.


19.  Once that is done go ahead and click Save.
20.  In the search box of D365 type Channel database. In here we want to select Houston as Retail channel. In the action pane click Full data sync and select 1060 job. Click OK and let the job run.
21.  In the search box of D365 type Download sessions. In this form, we want to make sure our 1060 job has applied. Once it has applied we can move forward.
22.  In the search box of D365 type Channel profiles. In this form, we want to copy the property value of Retail Server URL.

23.  Now click on Start and type Retail Modern POS. Paste the Retail Server URL in the textbox. Click Next, you will be prompted to login, use your email and password. If all goes well you should have mPOS activated and ready to use!


Monday, April 24, 2017

D365O Retail External Identity

It has been a while and finally I am back! I have D365O VM on my machine and I have been fiddling with in the environment for a little bit now. I attempted to install mPOS using D365O. The process was much smoother compared to the previous version of AX 2012 R3. There were less parts that we had to worry about and made the installation of mPOS a breeze. I was able to get everything setup and configured within an hour or so. Everything went great until I tried to login to mPOS. I would get an error relating to external identity. I remembered that I forgot to associate myself to a worker for the store I'm using. However, during the setup I ran into an issue with associating external identity. I was unable to find my email that I need to associate myself to one of the worker that belongs to the retail store. With a little bit of research I found out there was another way to associate yourself to the worker.

1) Go to worker 000160 (usually the worker we mainly used in the VM).
2) In "External Identity" action pane click "Clear Identity".
3) In the worker select the "Retail" tab and click "Edit".
4) In "External Identity" section fill the following textbox with this information.
    These information can be found if you login to Azure Portal.
    Alias: email of the AAD User (Azure Active Directory)
    UPN: Email of the AAD User
    External sub identifier: AAD's User's Object ID
 
5) Once you're done you should now be associate to worker 000160, and should be able to login to mPOS without any error.

Have fun exploring!

Monday, March 20, 2017

mPOS Offline Provision



I'm sure we all get frustrated when creating an offline database for mPOS only to find out that it wasn't able to provisioned, and the process drop your newly created offline database completely. ¯\_(ツ)_/¯ this is the look I generally make when that happens. Then I asked myself what went wrong and go back to the drawing board to trace the error. Luckily Brian Storie from Microsoft have given a breakdown of the steps we need to take in order to create AND provision our offline database correctly. All credits are given to Brian Storie. The steps sometimes works, but it's definitely a good place to start.


Open Windows File Exporer
1. Go to: C:\Program Files (x86)\Microsoft Dynamics AX\60\Retail Database Utility
2. Click File > Open Command Prompt > Command Prompt with Admin
    Enter the following command (Please change the highlighted values to the name of the SQL  
    Server hosting your channel DB, and the name of your Channel DB)

RetailDbUtilityCmd.exe DeprovisionChannelDB /StoreServerName:YOURSERVERNAME /StoreDatabaseName:YOURCHANNELDATABASE

3. After this command completes, open SQL Server Management Studio, connect to the Channel DB.
4. Expand Tables under the Channel DB
5. Verify any table that ends with _tracking are all deleted in YOURCHANNELDATABASE. (if one does exist then manually delete it)
6. Verify the following three tables do not exist (dbo.schema_info dbo.Scope_config dbo.Scope_info) if they do manually delete them
7. Open “Retail Channel Configuration Utility” as an admin. Go to “Create offline database” section. Enter correct channel database and offline database information. Then click “Apply”.



If all goes well you should be able to create and provision your offline database successfully. hopefully this should help those who are having provisioning problem when creating a new offline database. If you want to know more details on the error, the log file is located in

C:\Program Files (x86)\Microsoft Dynamics AX\60\Retail Database Utility\RetailDatabaseUtility.log

Thursday, March 9, 2017

"You can't switch to offline mode. Either the offline components are not installed or the logon failed"

I'm back once again with a new issue and possibly a solution on how to fix this problem.
I'm assuming at this point you had offline database installed and you wanted to test whether the offline mode is working or not. You've added "Database connection status" button and this allows you to switch to offline mode. When you tried to hit "Disconnect" you get an error "You can't switch to offline mode. Either the offline components are not installed or the logon failed" okay here are the steps I generally take and seems to works most of the times (I can't guaranteed it will work for you, but it's a good place to start debugging the issue).



Step 1: If you have offline sync service running. Go ahead and stop the service. If the service get stuck in "Stopping" status then you need to execute this command line using command prompt as admin.
Type in:
 sc queryex DynamicsRetailModernPOSOfflineSyncService

what you need to look for is the PID. Once you have locate the PID you want to go ahead and type this command line.
taskkill /f /pid (PID) <---put in your PID, ignore the parentheses. 
So for example if my PID is 12345 then I would type in. taskkill /f /pid 12345.
After you have done that go back into services and refresh to make sure the offline sync service status is blank.



Step 2: Go to Retail Channel Configuration Utility, select Configure Retail Modern POS and fill in the correct information in here.

To make sure you're using the correct DB hit the "Test connection" and it will let you know if you are connected successfully or not. I also "Configure POS User permissions". Once everything is done click "Apply" and you should get a message box saying that it was successful.



























Step 3: Go to Services and hit refresh and make sure the offline sync service status is set to "Running".



Step 4: Go into AX and run the 1070 job and make sure it applied.


Step 5: Log into mPOS and attempt to go offline by clicking "Disconnect". If everything is done correctly you should be able to go offline without getting any error saying you don't have offline component installed.


Step 6: Go grab a beer from the fridge cause you deserve it! ¯\_(ツ)_/¯

Monday, February 27, 2017

Modern POS Offline Service stuck in stopping status


If you run into a problem where you're trying to stop the Modern POS Offline Sync Service, and it's stuck in "Stopping" status. Then there is another way to completely stop this service using command prompt. The first command we want to type is sc queryex DynamicsRetailModernPOSOfflineSyncService.

You might wonder where the heck did I get that service name from? You can find that out by going into your offline service, right-click and click properties and you should be able to see your service name. After executing that command you should find what's the PID for the offline sync service. The next command we need to run is taskkill /f /pid <PID>. The PID changes over time so make sure to run the first command so you don't end up killing a random service. If you did it correctly you should get a message of "SUCCESS" and the service should be completely stopped. You can check by refreshing your services window.