While calling a Stored procedure on a linked Server I face this error : “Server ‘xxx’ is not configured for RPC” Open the linked server properties and go to the Server Options tab, there is an option for RPC and RPC Out. RPC Out needs to be set to True in order to execute a…
First Example The macro will select records from a table ‘CustTable’ and print a field from the same as the table to be fetched, and the fields (%1, %2, %3) to be printed are specified in the parameters for the first Macro call.In the second Macro call, the table has not been specified so text…
When the packing slip ID is generated from the load or the shipment or the packing station, the table WHSLoadTableCustPackingSlipJour stores the link between the load ID and the packing slip ID. The below example method gets Load from a given packing slip
There a clever query utility which let’s you create dynamic ranges. The different options are (today’s date is 25-02-2014): To see the results in a job or to play around with the different date options, you can copy and use the job below:
I have a form with a string field. In this field I want to display a lookup with the users of my organization (userid and display name). When I select a user I want to save the user’s display name in the form field. Override the form field’s lookup() method with this code
After creating a data entity you may get the error Validation started 10/28/2023 10:21:26.Validation step: Database synchronization started. Time: 10/28/2023 10:21:26Log level – Error | Infolog diagnostic message: Log level – Error | Infolog diagnostic message: ‘Cannot create a record in Entity (DMFEntity). Entity: Sales orders, OTS_SalesTableStaging.The record already exists.’ on category ‘Error’. these advise…
In a dialog you cannot use primitive type dialog fields. You must necessarily use extended data typesSo how do you use simple string or integer data? Simple, use an extended data type that extends a primitive data type.
In D365FO you can rename the primary key of a table record with the Rename function. This allows you to rename the primary key of any record and ensures data consistency It can be accessed from the Record information form (shown in the following screenshot), which can be opened by selecting Record info from the right-click menu on any record You can…
In simple dialogs we want the form to validate the newly inserted fields when the OK button is pressed and not close if one of these contains an incorrect value. In simple dialogs we cannot avoid closing the form unless we override the canClose() method Follow this example to reach the goal.
First configure SMTP parameters Then use this sample code
Use the following values to specify the positions of the day, month, and year in the _sequence parameter: For example, if the sequence in the string is month, year, then day, the _sequence parameter must be 231. A zero date is returned if the input parameters specify an invalid date. The following two examples specify…
By default, the page size is 8.5 x 11 inches but you can change this size by using the Report Properties pane, Page Setup dialog box or by changing the PageHeight and PageWidth properties in the Properties pane. The page size does not grow or shrink to accommodate the contents of the report body.
The FORMAT() Function The FORMAT() function returns a value formatted in the specified format and optional culture. You can use it to return the month name from a date. Here’s an example: Result: In this case we provided a format string of MMMM which is a custom date and time format string for returning the month name. The good thing about the FORMAT() function is…
The above query gives a datetime value for midnight at the beginning of December 31. This is about 24 hours short of the last moment of the year. If you want to include time that might occur on December 31, then you should compare to the first of the next year, with a < comparison.…
I will show you how you can fix missing labels on horizontal Axis on Columns charts of SSRS report
The “SRSAnalysisEnums” table contains the base enumeration and their translations that is necessary for the generation and update of the SQL Server Analysis Services projects. This table used by the Microsoft for internal purpose, but you can use it to get the enum translations in your language This table can also be regenerated by executing…
To retrieve part of a string in X++ you can use substr() function. This is the function definition str subStr(str _text, int _position, int _number) Parameters Parameter Description _text The original string. _position The position in the original string where the part to retrieve begins. _number A signed integer that indicates the direction and number…
In this example I will be showing you how to get a sales order delivery address using below code.
I need to remove a group by statement from a QueybuildDataSource object. and didn’t find any method to do this (The opposite of addGroupByField). Unfortunately, x++ does not have any method to remove one field from group by but by some tricks we can do that. I have written a method for removing group by…
I have a form and I want to get Form Control objects only from Control name. Thi s example shows hot to do that
SQL Server Reporting Services starts up slowly after a period of inactivity when I try to access the reports page. Sometimes it’s slow accessing it just half an hour later, sometimes hours later, or next day, but I can’t figure out why or the pattern behind it? SSRS has a XML configuration file with a…
To check how many CPU’s SQL Database Server is able to use, run the following SQL Query: select scheduler_id,cpu_id, status, is_online from sys.dm_os_schedulers the CPUs used are those with status = Visible online
In AX X++, there are two keywords that are often confused between one another but do very different things: Break and Continue. Both have their own purpose independent of each other but often people forget. Break – Breaks out of the loop completely. If there are 10 records to loop over, it will break skip all…
Accidentally left the caps lock on and typed something, but can’t be bothered to start again and retype it all? Simply enter your text in this site and choose the case you want to convert it to
If you want to display dates according to client’s datetime format then you have to specify in Language property of Report.Set Language property under localization tab of Report properties (see below)
Comma separator tool automatically converts a column to a comma list or list to CSV (comma-separated values). Copy your column of data and watch the conversion happen. You can do the reverse and convert a delimited list to a column. You can use our comma separator tool to convert column lists to comma-separated value (CSV)…
Below is the example for how to use notexists join in x++.
DateNull for the date can be checked by two ways :
If you need to copy data from one table to another table which has similar structure (Eg. to history or logging table) the .data() and buf2Buf() cannot be used. But we can make some modification to the buf2Buf() method to copy based on field name instead of field Id. Just create a new static method…
Do you need to remove spaces from a string in X++? For example: Suppose you want to remove the spaces between ‘abc’, ‘def’, and ‘ghi’ in the string txt. You can achieve this by using the strRem function in X++. Here’s how: The strRem function removes all occurrences of a specified substring from a given…
To populate a temporary table with data from a persisted table, use the setTmp() and data() method. The following code example copies all invent items in Toronto to the temporary table.
How about running custom X++ scripts without any downtime? This video explains how : https://www.linkedin.com/feed/update/urn:li:activity:6894355177550209025
If you’re gonna write code like A = B /C, you better make sure that C holds a value.Of course you can do a check with a simple if-statement (if C then A = B/C), but there is an easier way. You can use minOne, a method that exists in the Global class.
Example below explains how to create a QueryBuildRange on default field CreatedDateTime.
I need to get the second occurrence of the space for below text. It should be the space after the 56 select charindex(‘ ‘, ‘Posted/edited: 56 days ago’, 2) The solution would be: Select charindex(‘ ‘,’Posted/edited: 56 days ago’,(charindex(‘ ‘, ‘Posted/edited: 56 days ago’) +1))
When we open the child form from another form the datasource of the child form is sync with the previous form this is due to the dynalink between these two forms and all the data is shown on the child form. you can use the below code on the init method of the child form…
Use this command.Select * from SysTableIdView Where SystableIdView.Name = ‘PurchTable’You will get Table id
Reserve: Remove reservation:
To check if a UTCDateTime is null you can use Global::utcDateTimeNull()
Below shows how to get the serial ids or the current qty that is reserved for a sales order, sales line or sales parm line (picking, packing, etc.. form aka SalesEditLines (form))
Do you want to filter a form date field showing only today’s records? You can use AddRange Method and “T” value like shown below
you can easily find the latest Posted sales order confirmation with X++. To do this you need to extend the CustConfirmJour Table class and create a new method. Here is an example
Very useful post that explains how to send e-mails in X++ using simple emails or e-mail templates : http://elandax.blogspot.com/2019/03/how-to-send-email-email-template.html
if you want to deepen your knowledge on Microsoft’s SysOperation Framework, here you will find the official Microsoft documentation
If you have a SysOperation-framework class and want use a dialog to execute it via batch by default, you can activate this checkbox by including a call to parmBatchExecute() in the UIBuilder: When you’ll execute the class the checkbox will be activated by default
Did you Implement a new class with SysExtensionFramework and notice the code it never reached? The reason could be a caching issue. Sometime it caches too much and don’t refresh the cache. Flush cache via URL One way to flush the cache is calling a menu item called ACTION:SysFlushAOD.Append &mi=ACTION%3ASysFlushAOD to your URL:https://usnconeboxax1aos.cloud.onebox.dynamics.com/?cmp=DAT&mi=ACTION%3ASysFlushAOD Flush cache via menu The…
Amount conversion between 2 currencies
This method will convert the transaction currency into accounting currency defined in ledger.
With the Warehouse Management Mobile App you can use the ProcessGuide framework and you can add different types of controls including comboboxes. To add a combobox and insert values inside you can use the code below. Use _page.addComboBox() method. In this example I filled the combo with 2 values (Yes/No). To separate the values use…
I have a table record with several fields. I’m reading the fields of this table but I don’t know the type of any of them. Some might be of type string, others of type numeric, and still others of type enum. Not knowing the type of enum Ax only returns the numeric value, but I…
To retrieve the enumId from a Table fieldId you can just use SysDictField and enumId() method
Write below job to get list of fields, mendatory, base data type and label for any particular table or view:
I know table name and table field name as string . For example Table1 and fieldName “code” as string I want to get the value of this field from database . How can i get this information ? You can solve by following this example
How can I create a linked server between a local SQL Server instance and an Azure SQL Database? This post explains hot to do : https://www.mssqltips.com/sqlservertip/6224/create-a-sql-server-linked-server-to-azure-sql-database/
Let’s say you have a datetime value that you know is encoded in UTC (if you don’t know what timezone your data was originally encoded in you’re out of luck) If you want to convert the UTC datetime to Eastern Standard Time calculating the right daylight saving time, you can use on AT TIME ZONE ‘UTC’ and then…
You can get Form Control label text by calling labeltext() method
When you create a recurring data job in Dynamics 365 (AX7) you will be asked for an application id in the “Setup authorization policy” tab. This post explains how to do the right setup : https://axbloggerblog.blogspot.com/2017/02/d365-recurring-integration-application.html
When you copy value from Result grid, data will be retrieved as per your Query options setting in SSMS ( Query -> Query Options -> Results -> Grid -> Max characters retrieved) Default characters value is 65535 and data copied from result grid is only of length 65535 If you want to increase maximum number…
This example shows how to change the text colour of a Form control through X++ code. The color will be changed in RED And this will be the result If you want to convert to GREEN just modify like shown below
Actually, the only way I found to increase Font Size of a Form Static text is to change the Style Property value of the control By default the property is set to Auto and the text appears in a normal size (like shown below) But I wanto to increase the size so I changed the…
To get FieldId from a Field name, where the Field name is a string type you can use fieldname2id() method
To get TableId from table name, where the table name is a string type you can use tableName2Id() method
Code below shows the proper way of adding SalesLine with ConfigId
To indentitfy blocking session you can use sp_who2 system stored procedure. Below is sample code
While any operation is performed by the user, there are cases such as need to receive confirmation from the user to perform the operation. In these cases we can use “DialogButton” for user interaction not say “Yes/No” to perform the operation. Below is an example code
Good post that describes how to call a new Form from a calling form : https://dynamics365musings.com/call-a-form-from-another-form/
If you want to use wild-cards in Ax, you can write a SQL statement with a LIKE keyword But if you want to use NOT LIKE you can do in 3 different ways :
In this article, we will see how to create sales order and purchase order using x++ >> Create Sales order and Purchase order using X++
To convenrt a strint into real you can use str2Num() method
I often work with FormControls and need to understand the type of control in order to use the right properties and methods. The code below shows how to intercept the control type and cast it with the matching type
Inside my form I want to open another form. To achieve this goal without writing code I can use a Display Menu item, but I can also use a normal button to open it. Using a normal button requires write some X++ code. First create a button on your form’s Button group Then override clicked()…
I’m building a form from a table. One of its fields is a enum YesNo. I can’t figure out why every time I add it to the form it appears as a checkbox instead of a combobox. I want a combobox with a lookup and inside display the values “Yes” and “No”. After several attempts…
I’m setting up a QueryRange and found that if I pass my filter field an empty string the query doesn’t run the range. I would have expected all records where the range field is empty to be shown but not… How can I solve this problem? Easy!! Instead of using an empty string I use…
I am creating a new entity from a newly created custom table then i am getting an error ” Natural key for the table TestEntityTable was not found”. The problem is that the table uses RecId as its primary index, and the Data Entity Wizard doesn’t support tables with a RecId-based primary key. To solve I…
I’m building a Form with a field with a lookup inside. I don’t want the user to be able to enter values that are not within the range of values allowed by the lookup. How to do?A solution could be to use the validate() method signaling an error in case of an incorrect value. But…
Sometimes it may be necessary to figure out if a form’s text control (FormStringControl) has changed. To understand if it has actually been modified we cannot use the modified() method because this is always called even if the value has remained the same. Alternatively we can use the textchange() method which is called only if…
I have a custom lookup with a GroupBy inside Query statement First time, when the is nothing choosen the group by works fine. If I choose something from list and again want to change it, now the group by is lost. To solve the issue simply use sysTableLookup.parmUseLookupValue(false) like show in below code
When attempting to debug X++ code the Visual Studio 2019 debugger can crash unexpectedly…. You can work around this issue by going back into your Dynamics 365 Finance and Operations environment and navigating to Options before moving to the debugging section Check the check box “Debug items in the solution and items in specific packages“.…
The default setting in Visual Studio is to resolve work items on check in. To change this behaviour, go to Tools > Options > Source Control > Visual Studio Team Foundation Server and uncheck the box marked Resolve associated work items on check-in
If your Visual Studio vertical scroll bar disappears just enable it by going to Tools > Options > Text Editor > All Languages > Scroll Bars Check the appropriate scroll bars et voila
“Delivery Schedule” in SalesOrders is a useful functionality that allow split Sales Line in multiple lines. But once i split the rows how can we find the link between parent row and child rows. It’s simply…you can find inside SalesDeliverySchedule Table Put the InventTransId of Parent line in “Orderline” field and get InventtransId of child…
Users can change their own options and customizations themselves, but in some cases administrators need to change user options in bulk or for a list of users. To do this, simply enter System administration > Users Choose user and press “User options” Now you can access user setting and manage “usage data” or “Personalization”
Did you just update your D365FO release to 10.0.31 and encountered errors while deploying the package? Something like that : This is because Microsoft added some additional logic to the CreatePackage.psm1 file (located in your AosService\PackagesLocalDirectory\bin folder). This logic is basically checking for ‘orphaned’ netmodule files within your solution. To solve the issue just delete…
System administrators can modify the limit for the number of records that are available for calculating aggregates by adjusting the Maximum number of local records for each grid parameter on the Client performance options page. The default value is 25,000 records. Administrators should be careful when they adjust this value, because a value that is too large can exhaust…
Select the text you want to convert. To convert text to all upper case, choose Edit > Advanced > Make Uppercase or press Ctrl+Shift+U. To convert text to all lower case, choose Edit > Advanced > Make Lowercase or press Ctrl+U.