Sunday, November 29, 2009
Shifted to new Blog
Saturday, November 28, 2009
How to block New, Edit and View actions in the ListPage
In Microsoft Dynamics NAV RT Client, pages has default actions like New, Edit, View and etc…In the ListPage, New action is promoted and shown in the New Promoted Category. This action is not promoted in the card part.
According to my requirement, I do not want New promoted action in the listpage. This can be achived by customizing the Actions like the following:
But this process should need to be done in every client. The same requirement can be achieved by modifying the TIF information.
For Customer List Example: Remove the CardFormID field value in the TIF information for the Customer List and transform the page to form..
Limitations: Double clicking the Customer List will not open the Customer Card (Standard Functionality). Work around is to create a new action to open the Card and promote this action.
SAVERECORD and UPDATE
In Microsoft Dynamics NAV, CurrForm.SAVERECORD or CurrPage.SAVERECORD is used to save the current record shown on the form/page. CurrForm.UPDATE(True or False) or CurrPage.UPDATE(True or False) is used to save the current record based on the parameter and updates the controls in the form/page.
Using the two functions together in the form/page does not give any error normally but error will be displayed in pages if the following code is called before inserting the record.
CurrPage.SAVERECORD();//Which save the record.
CurrPage.UPDATE;//Which updates the controls.
For Example: Add the above lines of code in the Type – OnValidate() in the “46 Sales Order Subform” page and try to insert the sales line.
This is because above set of code is trying to insert the record in two places one is using SAVERECORD and second is UPDATE (even though Parameter is FALSE).
Friday, November 27, 2009
How to read BLOB data and export into a File
In Microsoft Dynamics NAV tables, we can create BLOB fields to store large amount of data. It is not possible to read the data in the BLOB fields directly.
The following steps shows the procedure to read the BLOB data. In this example, I have taken “User Metadata” table to read the data in the “Page Metadate Delta” field.
1) Create a codeunit with the below variables.
| Name | DataType | Subtype | Length |
| UserMetadata | Record | User Metadata | |
| Data | InStream | ||
| Line | Text | 1024 | |
| Pos | Integer | ||
| File1 | File |
2) Add the following code to the codeunit.
3) Save and Run the codeunit. Text file will be created in the given path with the data in the BLOB field.
Thanks,
Veerendra CH.
Thursday, November 26, 2009
Understanding the Difference Between GP, NAV, SL and AX
Here is the nice post from Houston Neal on “Understanding the Difference Between GP, NAV, SL and AX”.
Please click the link to read this post.
Monday, November 9, 2009
Object Subtype field in the AllObjWithCaption table
In Microsoft Dynamics NAV, AllObjWithCaption table is one of the virtual table from the older versions.
This AllObjWithCaption virtual table holds all the objects details like Type, ID, Name and Caption.
One new field Object Subtype is added to this table in NAV 2009.
This field is used to store subtype of two object types. 1) Codeunits 2) Pages
Codeunits has three Subtypes.
1) Normal: These are normal coduenits.
2) Test: Testing Codeunit
3) TestRunner: Test runner codeunit, used to run the Test Codeunits.
Pages has different subtypes like Card, List, Worksheet, Document, etc…
Saturday, October 24, 2009
How Run button in Object Designer opens the page in the RTC
In the NAV 2009 SP1, it is possible to run the Page from the Object Designer.
In the Object Designer, Run button will open the related page in Role Tailored Client. I think this is achieved using the HYPERLINK function in Navision.
HYPERLINK function passes a URL as an argument to an Internet browser.
By adding the following code in OnPush Tirgger of any button will open the related page in Role Tailored Client.
HYPERLINK('DynamicsNAV:////runpage?page=' + FORMAT(ID));
Here ID valud should be Page ID.
The above code can also be applied to open the reports in Role Tailored Client.
HYPERLINK('DynamicsNAV:////runreport?report=' + FORMAT(ID));
The above line of code can be added to any form/page to open the pages/reports dynamically.
Transformation Tool: Subfrom Menu Items to Pages
For example if you want a confirmation message before opening the reservation entries, you can write the code in the function or you can write like below:
If the code is like above, Transformation Tool will not move this Reservation Entries menu item to sub page. It will create a new Line menu button in the main page and add the Reservation Entries menu item to that.
Saturday, October 17, 2009
How to change SQL Server default backup location
As part of my job, I need to create databases regularly. Because of this I made a SQL Backup of the database with required objects and necessary setup. When ever I try to create a database, SQL Server is showing the default path of the backups.
It is possible to change the default location of the SQL Server backup files:
If we open the registry using REGEDIT or some other tool and if you navigate to this key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLSERVER and change the BackupDirectory value to the required location.
Monday, October 12, 2009
ProviderID property to System Parts
Last week after posting the learning on ProviderID property, I am going through the mibuso and found any interesting post related to the ProviderID linking to the System Parts.
I also tried to achieve this, but not able to find any solutions except create a new list page and adding system part to that.
The solution kine has given is working.
-Create a list page based on Sales Line.
-Add only two line. One Container and another Part.
-Change the Parttype to System and SystemPartID to Recordlinks for the part.
-Add the new list page to sale order form as Factbox
-Set the ProviderID and SubFormlink.
This solution is working as temporary.
Friday, October 9, 2009
ProviderID property in NAV 2009
ProviderID property is specifically for the RoleTailored client and not supported in the Classic Client.
This property enables you to create a link from a Repeater or any other type of control to a Factbox. It could also be used to link two FactBoxes. For example, the Sales Order page (42), uses this property to update the Sales Line FactBox by creating a ProviderID link to the SalesLines FastTab.
For Example:
If you open the Page 42 in design mode, <Control1906127307> “Sales Line FactBox” control ProviderID value is 58 which is the ID of the SalesLines control in the same page.
That is the reason if you open the Sales Order page in Role Tailored Client, Sales Line Factbox details are updated based on the Sales line you selected.
Tuesday, October 6, 2009
Error in NAV 2009 Reporting
Sometimes the following error may occur while designing the reports for RT Client:
“the provided metadata is not valid”
Troubleshooting steps has given below or click the MSDN link.
This error can happen when the following conditions are true:
-
You are using Windows Vista and User Access Control (UAC) is turned on.
-
The executable file that runs the Visual Studio development environment (devenv.exe) is set to run as an administrator.
-
The executable file that runs the Classic client with Microsoft SQL Server (finsql.exe) is not set to run as an administrator.
To resolve this issue, either turn off UAC or set both finsql.exe and devenv.exe to run as an administrator.
To turn off UAC
-
In Control Panel, select User Accounts.
-
In User Accounts, click Turn User Account Control On or Off.
-
Clear the Use User Account Control (UAC) to help protect your computer check box.
To set a program to run as an administrator
-
Right-click the .exe file, and then select Properties.
-
In the Properties window, on the Compatibility tab, in the Privilege Level section, select Run this program as an administrator.
Sunday, October 4, 2009
How to become an MVP (Most Valuable Professional)
Here is a nice post from Paul S. Randal on '”How to become an MVP”.
Click the link below:
Friday, October 2, 2009
How to Delete Personalization Settings
In the NAV 2009 Role Tailored Client, it is possible to reset the user specified settings, automation decisions and file handling decision using “Delete Personalization Settings” option shown below”
Open the Role Tailored Client.
Help regarding the options available in the “Reset User-Specified Settings” form is shown below:
Reset User-Specified Settings
You can personalize the appearance of the RoleTailored client, or decide what to do when the Microsoft Dynamics NAV server requests permission to run unknown software on your computer. The "Reset User-Specified Settings" dialog box gives you the opportunity to undo these personalization's and decisions.
User interface
This category covers changes that modify the appearance of pages in the RoleTailored client. You can specify which elements (such as fact boxes and lists) are shown in a particular page, and also specify the size and position of elements. Click "Reset UI settings" to restore all pages to their original default layout.
Automation objects
An automation object is a software component that can run on a Windows computer. The Microsoft Dynamics NAV server may request to run an automation object on your computer. The first time this happens, the client prompts you for permission to run the object. If you choose “Always allow" or "Never allow,” the client does not prompt you on subsequent occasions when it receives a request to run an object of the same type. You can only revisit this decision by clicking "Reset Automation decisions". The next time the server wants to run an automation object, the client presents the original three choices.
Client file access
The Microsoft Dynamics NAV server may request to run or download a file to your computer. The client offers three choices: Run, Save, or Cancel. It also provides a checkbox, which is selected by default: "Always ask before opening this type of file." If you clear this checkbox, subsequent files of the same type are automatically handled in the same way as the original. You can only then revisit this decision by clicking "Reset file handling decision". The next time the server wants to run or download a file, the client presents the original three choices.
Save View As in NAV 2009
In the Classic Client of NAV, it is possible to send the forms or reports in the Navigation Pane to the shortcuts using Ctrl+Alt+S or right click on the Item and selecting the “Send to Shortcuts” option.
Similar kind of option also available in the NAV 2009 RT Client. The following exercise will show the procedure to add any form to the Navigation Pane.
Open the Role Tailored Client and select the Sales Orders
Apply any filter to the Sales Order list page like the following:
Select the Save View As option like the following:
In the Save View As form you can change the Name accordingly and can change the Activity Group also.
System will also for restart confirmation to effect the changes and select Yes and check Home in the Navigation Pane.
New view is added to the Home and If you open the page you can still see the filters applied previously. Cool….
It is also possible to remove the views added to the Navigation Pane.
Select the Customize Navigation Page option.
Select the page you want to remove and select Remove option (or) Select Restore Defaults to remove all the changes and restore to the default view.
C/AL ASSERTERROR Statements
You use ASSERTERROR statements in test functions to test how your application behaves under failing conditions. The ASSERTERROR keyword specifies that an error is expected at run time in the statement that follows the ASSERTERROR keyword.
If a simple or compound statement that follows the ASSERTERROR keyword results in an error, then execution successfully continues to the next statement in the test function. You can get the error text of the statement by using the GETLASTERRORTEXT Function.
If a statement that follows the ASSERTERROR keyword does not result in an error, then the ASSERTERROR statement itself fails with the following error and the test function that is running produces a FAILURE result:
TestAsserterrorFail: FAILURE
An error was expected inside an ASSERTERROR statement.
Example
To create a test function to test the result of a failure of a CheckDate function that you have defined, you can use the following code. This example requires that you create a function called CheckDate to check whether the date is valid for the customized application and that you create the following text constant and variables.
Text constant
ENU value
Text001 'The date is outside the valid date range.'
Name
DataType
InvalidDate Date
InvalidDateErrorMessage Text
InvalidDate := 010184D;
InvalidDateErrorMessage := Text001;
ASSERTERROR CheckDate(InvalidDate);
IF GETLASTERRORTEXT <> InvalidDateErrorMessage THEN
ERROR('Unexpected error: %1', GETLASTERRORTEXT);
Also check the output without ASSERTERROR function.
Error List Table in NAV 2009
In the older version of NAV, compilation of objects will only show the first compilation error.
In the NAV 2009, if you compile multiple objects you will get all warnings and errors from all objects in a form called Error List.
Error List form has Design button will be open the related object in design mode.
These errors are stored in the new internal table called 2000000070 Error List.
Sunday, September 20, 2009
Search Option in NAV RoleTailored Client
Friday, September 18, 2009
ENABLING MICROSOFT DYNAMICS NAV SERVER
This gives you access to the special properties and .NET code that are required for computers running Microsoft Dynamics NAV Server to access the database. To set the flag in the Classic client, on the File menu, click Database, and then click New (for a new database) or click Alter (for an existing database). On the Options tab, select Enable for Microsoft Dynamics NAV Server.
Thursday, September 17, 2009
How to Zoom in NAV 2009 Pages?
In the NAV RT Client pages also it is possible to zoom the page using About the Page (Ctrl+Alt+F1) in the top right side of the page.
NOTE: Zooming the Listpart (i.e. subform) is only possible by keeping the cursor in the subform and pressing Ctrl+Alt+F1 Keys. Clicking the About the Page button in the top right side of the page only works for the main forms.
NOTE: In the classic client zoom option display the fields in the same orders as the fields in the table. In the RT Client zoom option displays first primary key field values and the remaining fields in the alphabetical order and Field ID also displayed...Nice....



