Tuesday, March 10, 2026
Thursday, February 22, 2024
How to get a user group from a workflow work item
Below code snippet to get the user group for a workflow work item (if user group used for work item assignment)
WorkflowStepTable stepTable;
str userGroup;
select stepTable where stepTable.ElementId == WorkflowworkItemTable(buffer).ElementId;
userGroup = WorkflowConfigPersonPicker::newAssignmentTable(stepTable.workflowAssignmentTable()).parmParticipantTokenValue();
Wednesday, October 13, 2021
How To Get Dynamics 365 F&O URL through code - X++
var app = Microsoft.Dynamics.ApplicationPlatform.Environment.EnvironmentFactory::GetApplicationEnvironment();
Str envURL= app.Infrastructure.HostUrl;
#D365F&O #Dynamics #Finance #URL
How to cancel form control super method call
FormControlCancelableSuperEventArgs cancelSuperEventArgs = e as FormControlCancelableSuperEventArgs;
cancelSuperEventArgs.CancelSuperCall();
#D365FO #Dynamics #X++ #UI
Tuesday, February 23, 2021
How to get a list of tables (data sources) in an Entity through code - X++
public void tableList(TableName _tableName)
{
DictDataEntity dictEntity = new DictDataEntity(tableName2Id(_tableName));
int dataSourceCount;
Query query;
QueryBuildDataSource dataSourceName;
str entityTableName;
if (dictEntity)
{
query = dictEntity.query();
if (query.dataSourceCount() >= 1)
{
dataSourceCount = query.dataSourceCount();
}
for(int datasource=1;datasource<=dataSourceCount;datasource++)
{
dataSourceName = query.dataSourceNo(datasource);
entityTableName = tableId2Name(dataSourceName.table());
info(entityTableName );
}
}
}
#D365F&O #DataEntities #X++
Wednesday, June 3, 2020
How to List Down Data Entities with Data Management Enabled- D365F&O
Tuesday, January 14, 2020
Power BI - How to embed a PBIX using Form in D365FO and add in a workspace.
We have an option in D365 to embed PowerBI visuals and run through workspaces. Here I am providing steps to do the same.
1. Create a PowerBI report using power BI desktop and save the file, .pbix file will be saved. You can refer below youTube tutorial
Tuesday, August 13, 2019
How to add an Entity in Data Project through code (X++)
if (DMFQuickImportExportFormHelper::validateEntity(_entityName, _sourceName, DMFOperationType::Export))
{
ttsbegin;
addEntity.clear();
addEntity.initValue();
addEntity.DefaultRefreshType = DMFRefreshType::IncrementalPush;
addEntity.DefinitionGroup = _definitionGroup;
addEntity.Entity = _entityName;
addEntity.EntityXMLName = _targetEntity;
addEntity.SkipStaging = NoYes::Yes;
addEntity.source = _sourceName;
addEntity.validationStatus = NoYesError::Yes;
addEntity.ExecutionUnit = NoYes::Yes;
addEntity.LevelInExecutionUnit = NoYes::Yes;
addEntity.insert();
//Generate mapping
DMFXmlGeneration::generateMappingV2(addEntity);
ttscommit;
}
Variables -
- _entityName - Name of the Entity
- _SourceName - Source Data Format (like BYOD, Excel)
- _definitionGroup - Definition Group Name (or Data Project Name)
Thursday, June 27, 2019
How to get Azure Blob URL in D365FO
Thursday, April 4, 2019
How to get the primary table from Data Entity in D365F&O
public static TableName getPrimaryTable(TableName _tableName)
{
TableName tableName;
Query q;
QueryBuildDataSource dataSource;
DictDataEntity dictEntity = new DictDataEntity(tableName2Id(_tableName));
if (dictEntity)
{
q = dictEntity.query();
if (q.dataSourceCount() >= 1)
{
dataSource = q.dataSourceNo(1);
if (dataSource)
{
tableName = tableId2Name(dataSource.table());
}
}
}
return tableName;
}
And if we need all tables from the data entity, we can loop the data source count.
#D365F&O #AX #Entities
Friday, July 27, 2018
Metadata Lookup - list of forms in D365
In AX 2012 we have a table called 'UtilElements' to get the list of objects and then you can filter with 'UtilElementType' in your query.
In 365, they have introduced an API instead to get the list of metaData based on your requirements.
var forms = Microsoft.Dynamics.Ax.Xpp.MetadataSupport::FormNames();
Saturday, July 21, 2018
Power BI - How to embed a PBIX in D365FO and add in a workspace.
1. Create a PowerBI report using power BI desktop and save the file, .pbix file will be saved. You can refer below youTube tutorial
Monday, June 11, 2018
Data Entities - Custom Query Change Tracking in D365FO
If we are enabling primary or All table change tracking on entity, system won't update the WMSLocation when we are updating or adding column in table 'demoLocationType'.
Solution - We should write a custom method and name that 'defaultCTQuery' and in that method we would have create a query based on the relation between above two tables WMSLocation and demoLocationType and return the query object.
public static Query defaultCTQuery()
{
Query q;
q = new Query();
QueryBuildDataSource qbd = q.addDataSource(tablename2id('WMSLocation'));
qbd = qbd.addDataSource(tablename2id('demoLocationType'));
qbd.relations(false);
qbd.addLink(fieldName2Id(tableName2Id('WMSLocation'),'wMSLocationId'),fieldName2Id(tableName2Id('demoLocationType'),'wMSLocationId'));
return q;
}
And then go to Data Entities -> Filter the entity (WMSLocation) -> Change Tracking -> Enable Custom query.
Tags- #DataEntities, #ChangeTracking, #MSDYN365FO
Tuesday, May 1, 2018
How to write a display method in extensions (D365)
1. Create a new class and give a name, best practice is to give a name of the object with extension keyword
2. Once class is created, make sure you are using proper syntax and namespaces as below and also write the display method based on your requirement -
4. Now find the 'InventJournalMovement' form in AOT and create an Extension
Tags: #DisplayMethods , #Extensions, #X++, #D365FO
Wednesday, April 25, 2018
How to override a clicked method of a button in a form Extension D365
1. Create extension of 'CustInvoiceJour' form
2. Open extension of that form from the solution explorer and add a button
4. 'OnClicked' event handler is copied and now you can paste as a method in any of your custom class or you can create a new class. I am using one of my custom classes.
5. Now the question is, how we will get the selected record on that form or how would we get the form data source, if you take a look of this above method, you will seen we have a formContol as a parameter and by using that we can get the form data source and selected records.
After getting the table buffer and form data source, we can perform other operations.
Tags : X++ , D365, Form extensions, Events, OnClicked
Wednesday, April 18, 2018
Add controls run time and override the method in D356 (X++)
We would be creating buttons run time based on the setup companies in some custom table, Like I have table called 'DemoCompanyList' and that table has 3 companies setup
1. USMF
2. USMG
3. IND
Lets create a form and give a name 'DemoRunTimeControl' and then we can apply the pattern based on our requirement and then add Action Pane - Button Group - Menu Button(control name - ButtonHeaderInquiry), change the AutoDeclaration property to 'Yes' for this control.
Form Methods -
init() - To get the list of companies and call method addRunTimeButtons()
addRunTimeButton() - In this method we will add buttons to menu button and also register the clicked method so that when we click on those buttons, it should the written clicked method.
RunTimeButton_clicked() - In this method we will opening the custInvoiceJour menu item based on the clicked button.
[Form]
public class DemoRunTimeControl extends FormRun
{
Map buttonCompany;
public void init()
{
container companies;
counter i;
super();
buttonCompany = new Map(Types::Integer, Types::String);
companies = DemoCompanyList::findCompanyList(); // Find company list will return the list of the companies
for (i = 1; i <= conLen(companies); i++)
{
element.addRunTimeButton(conPeek(companies, i)); //addRunTimeButtons will add buttons based on the company setup
}
}
private void addRunTimeButtons(DataAreaId _dataAreaId = #emptyString)
{
FormButtonControl runTimeControl;
#define.runTimeCtrl ('DemoRunTimeButton')
runTimeControl = ButtonHeaderInquiry.addControl(FormControlType::Button, #runTimeCtrl + _dataAreaId);
//Invoice (%1)
runTimeControl.text(strfmt("Customer Invoice (%1)", _dataAreaId));
runTimeControl.registerOverrideMethod(methodStr(FormButtonControl, clicked), formMethodStr(DemoRunTimeControl, 'RunTimeButton_clicked'), element);
buttonCompany.insert(runTimeControl.id(), _dataAreaId);
}
public void RunTimeButton_clicked(FormButtonControl _formButtonControl)
{
//Set the local control to the actual control that is calling the method.
_formButtonControl = this.controlCallingMethod();
CompanyId company;
company = buttonCompany.lookup(_formButtonControl.id());
if (company)
{
changecompany (company)
{
//Open invoice journal in specific company
new MenuFunction(MenuItemDisplayStr(CustInvoiceJour),MenuItemType::Display).run();
}
}
}
}
Thursday, September 21, 2017
Microsoft Flows - How to create a very simple flow
Here are steps to create a flow-
1. Open a web browser and open URL https://us.flow.microsoft.com/en-us/
2. Click on 'My flows' and then hit '+ click from blank'
3. It will open a page as below and then we should select a trigger, I have selected 'When a new mail arrives' for this demo
- Add an action
- Add a condition
6. We have multiple actions to select, I have selected 'Notifications' for this demo
7. You will get two options
- Send me a mobile notifications (Mobile App required)
- Send me a email notifications
After selecting values, hit 'create flow' and done.
9. You can see that flow under 'My Flows' and also can review run history. I already sent an email from my 'ajitax@outlook.com' email id to my work id which is associated with Microsoft Flow.
10. As soon as I received email from this particular email id (ajitax@outlook.com), flow notification showed up in my mobile.
Wednesday, September 20, 2017
TF400813: Resource not available for anonymous access. Client authentication required.
I was trying setting up TFS online (VSO) from my AX 2012 R3 instance
And got this below error -
I am using VS 2013 and Team Explorer 2010
Resolution -
Restart AOS and try. If that doesn't work, try after restarting Dev itself.













































