February 28, 2019

New post series 'QuickFix'

Hi Folks,

I will be starting a new series of the post named as 'QuickFix', where I will be sharing some quick fix to the frequent and small issue while development. I hope you will help you. Keep sharing your feedback if you want to see any specific post. Thanks to all my readers for motivation and support.


-Harry Follow us on Facebook to keep in rhythm with us. @Facebook.com/theaxapta

February 24, 2019

Set background color for a field in form grid [DisplayOptionInitialize]

Hi Folks,

Today I am going to discuss how to make a filed text/background colorful :) This could be really helpful if you want to set such color based on an enum, like the status of the record or some kind of color coding on the grid based on an enum value. You can apply color on the entire grid line or one/more specific fields on the grid. So let's get started.

First, let's see how to achieve this using event handler. Assume there is field 'onHold' and you want to set vendor account no background/text to red or green based on this.  Go to your 'VendTable' form and vendTable data source and copy the event handler names 'DisplayOptionInitialize'. Paste this in a new class and write below code under this method (once you paste the event handler).
<CodeSample>


On new forms, the same can be achieved using overriding 'DisplayOption' method on the data source. Below code will give a hint


public void displayOption(Common _record, FormRowDisplayOption _options)
        {
            VendTable    vendTable = _record;

          //  _options.affectedElementsByField(<FieldName>);
            //    _options.backColor(<Color>);
            super(_record, _options);
        }
Please note, the color thing doesn't work when the user selects a record, it will make the selected line in default color setting. But useful when opening a grid and see the entire set of records.

See more..

Table Event handler methods in Dynamics 365 FO


Form Event handler methods in Dynamics 365 FO


Cheers!!!
-Harry Follow us on Facebook to keep in rhythm with us. https:fb.com/theaxapta

February 21, 2019

[Solved] Capture screenshots toggle doesn't appear on Task recorder

Hi Folks,

The Task records are slightly different in D365FO than earlier versions. If you are not getting the 'Capture screenshots' toggle on task recorder window on your environment try below steps,

1. Download FMLab folder from Github, https://github.com/Microsoft/FMLab
2. Unzip it and there must be a folder named 'TaskRecorderScreenshot'.
3. Now go to google chrome and go to More tool > Extensions
4. Click on 'load unpacked' and select  'TaskRecorderScreenshot' folder from the downloaded FMLab folder.
5. Once done, make sure its enabled on chrome extension.

Restart the chrome and check you must get the 'Capture screenshots' toggle on task recorder window.

Cheers!!!
-Harry
Follow us on Facebook to keep in rhythm with us. https:fb.com/theaxapta

February 08, 2019

How to get QueryRange from Query object X++

Hi Folks,

This post is about how to get QueryRange from a query object in x++ code. This is very useful when you have to pass a query on another object and perform a certain operation based on this query and its ranges.

To understand this code sample better, let's take a scenario. On FormA I have to build a query (OR use AOT query) on run time based on certain ranges. When the user clicks on a button system will pass this query to FormB and on FormB we have to use this query and its ranges to perform other sets of operations.

Now let's see the code, which may need to write on Form B to take a query as a parameter and fetch the ranges and its values in code.



I hope this will help.

-Cheers!!!
Harry
PS: My VM is down for some reason and I couldn't prove the code and have to write it manually so you might get some syntax issues in the above code.

February 01, 2019

[Solved] Error while generating vendor payment #MSDyn365FO

Hi Folks,

I was getting an error while generating a payment journal, thought accounts payable. Here are a quick summary and solution on the same. 

Error: While creating payment Journal and Click on Generate payments button system throwing below error
Generate payments Message details Cannot edit a record in Journal lines (LedgerJournalTransPayment_BR). The record has never been selected














Possible Reason:
It might be coming to a new environment where you never did a setup for payment method, that you are using in your journal.

Solution:
1. Go to Methods of payment(Purchase Ledger /Accounts payable > Payment setup > Methods of payment). Select the method with you are using in your journal. Let's take Cheque for eg.
2.  GO to file format tab and check value under field ‘Export format’, which belongs to BR country-specific features.






Ideally, it should match the method of payment. But here its ‘Configurable layout file’ which is not a Cheque layout.

















3. So now click on the Setup button and add Cheque in selected formats. Save it and close




















4. Change to cheque
















5. Now try to generate payment again, it should work.

Cheers!!!

Harry
Follow us on Facebook to keep in rhythm with us. https:fb.com/theaxapta