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.
Search This Blog
February 08, 2019
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
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
January 21, 2019
List panel control in Dynamics 365 FO #MSDyn365FO
Hi Folks,
A list panel is an interactive control to assign multiple values to a record. It let the user select multiple records against selected record on a form/grid. To understand it better let's take an example, I want to assign vendor group(s) to an employee so he/she can access those vendor related stuff like Masters, Transactions or PR creation (I am not covering the security in this post, its only about the List panel control). In today’s post I will be creating a new object for a random example, in real time you may need to tweak the solution to fit your requirement.
To do this what I need are
1. A new table to store these data. 1 Employee: N Vendor Groups
2. A new form where I can select an employee and then select one or many vendor groups to this selected employee.
3. List panel on this new form to do actual operation.
First, let's see how my form and table should look like,


and your table browser should look like below,

To achieve this setup you need to create a new table as below

and new form as below,

Now, lets coming to coding part. Although there are many ways to achieve this setup, the best I would recommend is by using SysListPanelRelationTableCallback framework class. By using this class you can achieve this with minimal coding. You need to add a group on from here we have ListPanelGroup which will be used to create list panel control. Overwrite init method on form and paste below code.
A. Initialize the control.
here
11-15 parameters can be used to further manipulate the control with some validations.
B. Tab change
Now add a new method on the form to fill the list for previously assigned records
void tabChanged(int fromTab, int toTab)
{
#define.TabEmplOverview(1)
#define.TabvendGroup(2)
switch (toTab)
{
case #TabvendGroup:
listPanel.parmRelationRangeValue(HcmWorker.name()); //This should be compatible to 7th parameter of SysListPanelRelationTableCallback in init method
listPanel.parmRelationRangeRecId(HcmWorker.RecId);
listPanel.fill();
break;
}
}
C. Tab change
Copy paste below code in tabChanged method to call above method every time when the user changes the tab.
[Control("Tab")]
class Tab
{
public void tabChanged(int _fromTab, int _toTab)
{
super(_fromTab, _toTab);
element.tabChanged(_fromTab, _toTab);
}
}
That's it, you just created a very simple list panel control with minimal coding.
Cheers!!!
Harry
A list panel is an interactive control to assign multiple values to a record. It let the user select multiple records against selected record on a form/grid. To understand it better let's take an example, I want to assign vendor group(s) to an employee so he/she can access those vendor related stuff like Masters, Transactions or PR creation (I am not covering the security in this post, its only about the List panel control). In today’s post I will be creating a new object for a random example, in real time you may need to tweak the solution to fit your requirement.
To do this what I need are
1. A new table to store these data. 1 Employee: N Vendor Groups
2. A new form where I can select an employee and then select one or many vendor groups to this selected employee.
3. List panel on this new form to do actual operation.
First, let's see how my form and table should look like,
and your table browser should look like below,
To achieve this setup you need to create a new table as below
and new form as below,
Now, lets coming to coding part. Although there are many ways to achieve this setup, the best I would recommend is by using SysListPanelRelationTableCallback framework class. By using this class you can achieve this with minimal coding. You need to add a group on from here we have ListPanelGroup which will be used to create list panel control. Overwrite init method on form and paste below code.
A. Initialize the control.
here
- Form control
- Caption for available records in the list
- Caption for selected records in the list
- ImageId (e.g. #ImageUser)
- Relation table: new table which we created to store data.
- Relation field: Field which you need to save in table from the list.
- Relation range field: Source field which you want to select in relation to binding with related field.
- Data table: Source table for list records. here we have VendGroup table.
- Data field: Field to be selected from list panel control.
- Data container field Ids: Fields that you want to show in available records.
- dataRangeField
- dataRangeValue
- validateMethod
- selectedMethod
- availableMethod
11-15 parameters can be used to further manipulate the control with some validations.
B. Tab change
Now add a new method on the form to fill the list for previously assigned records
void tabChanged(int fromTab, int toTab)
{
#define.TabEmplOverview(1)
#define.TabvendGroup(2)
switch (toTab)
{
case #TabvendGroup:
listPanel.parmRelationRangeValue(HcmWorker.name()); //This should be compatible to 7th parameter of SysListPanelRelationTableCallback in init method
listPanel.parmRelationRangeRecId(HcmWorker.RecId);
listPanel.fill();
break;
}
}
C. Tab change
Copy paste below code in tabChanged method to call above method every time when the user changes the tab.
[Control("Tab")]
class Tab
{
public void tabChanged(int _fromTab, int _toTab)
{
super(_fromTab, _toTab);
element.tabChanged(_fromTab, _toTab);
}
}
That's it, you just created a very simple list panel control with minimal coding.
Cheers!!!
Harry
January 11, 2019
General Electronic Reporting (GER) configuration Import in new environment
Hi Folks,
Generic Electronic Reporting (GER) aka Electronic Reporting (ER) is a great tool to configure document formats for both incoming and outgoing electronic documents in accordance with the legal requirements of various countries/regions. The ER engine lets business users use GER without the help of a developer OR any change in code, as users configure the document formats instead of code development. The user can create different types of documents like JSON, PDF, EXCEL, WORD, XML, and TEXT to support different system requirements. For more details on GER refer to MS documentation here.
Now let's see how to move GER configuration from dev to another environment. Once you complete all your change in the respective model or format, change the status to complete with some meaningful description. Post that system will create one more version with a draft.

Now you can change the status of a completed version to Shared. If you are facing any error, double-check if the configuration repositories are configured properly with LCS. Once you shared a version it will be available on LCS to import in any other environment. You can see them in your LCS project. Log in into https://lcs.dynamics.com/v2/

Now in the new environment, make sure you configured repositories properly for both operation and LCS. Select LCS and click Open.

In the next screen post-LCS connection authorization you must see all customized reporting configuration that is shared over LCS. Select your desired configuration, select the right version, and Import it.
That's it…..
The configuration is successfully imported into your current machine and ready to use. If you are importing a format, make sure the respective data model already exists in your environment. If it's not there you should import the data model as well.
Cheers…
Harry
Generic Electronic Reporting (GER) aka Electronic Reporting (ER) is a great tool to configure document formats for both incoming and outgoing electronic documents in accordance with the legal requirements of various countries/regions. The ER engine lets business users use GER without the help of a developer OR any change in code, as users configure the document formats instead of code development. The user can create different types of documents like JSON, PDF, EXCEL, WORD, XML, and TEXT to support different system requirements. For more details on GER refer to MS documentation here.
Now let's see how to move GER configuration from dev to another environment. Once you complete all your change in the respective model or format, change the status to complete with some meaningful description. Post that system will create one more version with a draft.
Now you can change the status of a completed version to Shared. If you are facing any error, double-check if the configuration repositories are configured properly with LCS. Once you shared a version it will be available on LCS to import in any other environment. You can see them in your LCS project. Log in into https://lcs.dynamics.com/v2/
Now in the new environment, make sure you configured repositories properly for both operation and LCS. Select LCS and click Open.
In the next screen post-LCS connection authorization you must see all customized reporting configuration that is shared over LCS. Select your desired configuration, select the right version, and Import it.
That's it…..
Cheers…
Harry
Subscribe to:
Posts (Atom)