Monday, May 24, 2010

How to insert records into NAV from Visual Studio

Below is a simple console application to create a customer record from the visual studio.

namespace ConsoleApplication1
{
    using Customer;
    class Program
    {
        static void Main(string[] args)
        {
            Customer_Service service = new Customer_Service();
            service.UseDefaultCredentials = true;
            Customer.Customer customer = new Customer.Customer() { No = "123491", Blocked = Blocked.Ship};
            service.Create(ref customer);
        }   
    }
}

This will insert customer record but Blocked field does not contains the correct value. This can be achieved by changing the line as below:

Customer.Customer customer = new Customer.Customer() { No = "123491", Blocked = Blocked.Ship, BlockedSpecified = true};

This is mostly required for all fields except the string type because I think web services request/responses are in xml and type conversions are required internally from string to other data type.

Thursday, May 20, 2010

HideValue Property in NAV 2009 Pages

May be many of you are aware of the new field property “HideValue” for the Pages.

imageIf you set this property to TRUE, value in this field is not displayed in the Page. In the following scenario, I will explain how to automatically set this property to TRUE using the Transformation Tool, instead of changing the property value manually.

Let’s go to the customer card and go to OnFormat Trigger of the Name field. Adding one line of code will do the same functionality as HideValue property.

image Transform the form to page using the Transformation Tool and check the output in Role Tailored Client.

Form Output:image

Page Output:image

Wednesday, May 19, 2010

Microsoft Unveils New Functionality for Microsoft Dynamics NAV 2009

Microsoft unveils the new functionalities for Microsoft Dynamics NAV 2009. You can read the press release.

PRAGUE — May 19, 2010 — As part of Microsoft Corp.’s commitment to providing leading enterprise resource planning (ERP) solutions to midrange organizations worldwide, the company today unveiled Microsoft Dynamics NAV 2009 R2 at Directions EMEA 2010. Because of the investment in architecture for Microsoft Dynamics NAV 2009, customers are able to take advantage of the benefits of the software-plus-services vision through the R2 release more quickly than scheduled, including built-in integration with Microsoft Dynamics CRM and online Payment Service. Microsoft Dynamics NAV 2009 customers will benefit from the following:

Microsoft Dynamics CRM integration. Today’s fast-paced business environment demands instant access to customers and vendors. Microsoft is providing built-in integration with Microsoft Dynamics CRM. Benefits of customer relationship management (CRM) integration include eliminating redundant data entries, keeping information up to date in both ERP and CRM solutions, and providing salespeople with the ability to quickly access detailed business information about contracts, pricing and product availability. Customers can choose between integration to on-premises Microsoft Dynamics CRM or Microsoft Dynamics CRM Online with the option to migrate to either option over time.

Online Payment Service for Microsoft Dynamics NAV. This enables customers to process payment transactions from the Microsoft Dynamics NAV interface across multiple channels, including e-commerce, point of sale and call center transactions. The Payment Service works with leading payment processing services and all major credit cards.

RoleTailored interface access for remote or roaming users. Microsoft Dynamics NAV 2009 R2 supports direct access from the Microsoft Dynamics RoleTailored experience over the Internet. This allows for remote or roaming users to take advantage of the richness and Microsoft Office integration of the RoleTailored interface and the many integration features connected to local resources, such as the operating system and Microsoft Office. This reduces the complexity and overhead compared with using other applications such as Citrix Systems and Terminal Services, especially for hosting partners offering cloud-based Microsoft Dynamics NAV deployments.

Microsoft Application Virtualization support. The Microsoft Dynamics NAV 2009 R2 RoleTailored interface can be deployed using Microsoft Application Virtualization (App-V) technology, which is relevant for both on-premise and hosted solutions. This provides a better experience for the end user as all integration with local applications is done on the desktop. It also cuts IT costs by centrally managing Microsoft Dynamics NAV client installations with automatic deployment to the desktop after an update.

Windows 7 user experience improvements. Through Microsoft Dynamics NAV 2009 R2,jumplists can be used to open recently accessed customers and vendors for increased business productivity and efficiency, and the icon overlay functionality provides information on system events and status streamlined with the Windows 7 user experience.

Treemap visualization. Microsoft Dynamics NAV 2009 R2 showcases the possibilities around business data visualizations abilities in Microsoft Dynamics NAV through rich ad hoc data visualization. It provides treemap analysis that enables the comparison of any two values, for example sales and profits, which increases business productivity and business insight. The innovative client extensibility framework used allows partners to extend the user experience of Microsoft Dynamics NAV to integrate visualizations into any end-user scenario.

“We’re delivering this release in response to customer and partner feedback,” said Crispin Read, general manager of Microsoft Dynamics ERP at Microsoft. “Microsoft is committed to continuously bringing forth innovation in our ERP solutions, including the integration with cloud services. These latest enhancements to Microsoft Dynamics NAV 2009 are an important step in delivering solutions that drive real business productivity.”

“The new features in Microsoft Dynamics NAV 2009 R2 improve our business opportunities and benefit our customers. The fact that Microsoft is able to deliver faster than planned reaffirms our decision to build our solutions on Microsoft Dynamics NAV,” said Christian Sega, managing director at agiles Informationssysteme GmbH, an industry solution provider and consulting company specializing in horizontal workflow solutions built on Microsoft Dynamics NAV.

Microsoft Dynamics NAV 2009 R2 will be available in the fourth quarter of 2010.

Tuesday, May 11, 2010

Web Reference in Visual Studio

As specified in one of the help scenario, I created a codeunit with two functions in it and published that to the web services along with the customer card and named both as ‘PageWithCapitalization’.

image

imageWhen I try to create a web reference in the Visual Studio, as the two web services I published has same Service Name, the Page web reference also has the methods of the codeunit.

image

Monday, May 10, 2010

sp_$ndo$loginproc Login Stored Procedure on the SQL Server Option

A login stored procedure is a stored procedure that you can use to perform predefined functions after a user logs on to Microsoft Dynamics NAV with Microsoft SQL Server. A typical function would be to generate a message informing the user that the database is currently in single-user mode so that an administrator can perform database maintenance tasks and is therefore inaccessible.

The login stored procedure is run immediately after the user has logged on to SQL Server and opened a database and before Microsoft Dynamics NAV carries out any tasks including executing any C/AL triggers. The user must have successfully logged on to the server and have access to the database before the stored procedure is run.

Creating the Stored Procedure

The stored procedure is created in the database and has a predefined name and a list of parameters.

The stored procedure is called [sp_$ndo$loginproc] and has the following characteristics:

  • It takes two VARCHAR parameters: the name of the application and the C/SIDE version number. These parameters must be declared as part of the stored procedure but do not have to be used.

  • It can perform transactions. Microsoft Dynamics NAV uses a COMMIT to flush any outstanding transactions after the stored procedure has finished executing.

  • The RAISERROR statement can be used to display an error message in Microsoft Dynamics NAV and prevent the user from accessing the database.

  • The PRINT statement can be used to display a warning in Microsoft Dynamics NAV and allow the user to access the database.

  • If the stored procedure returns a value, it is ignored.

  • If the stored procedure does not exist, no action is taken by Microsoft Dynamics NAV and the login process continues as usual.

The following examples show how to create a login procedure in the Query Analyzer tool. The database must be selected before these statements are executed.

Example 1

The following code example displays a warning message in Microsoft Dynamics NAV and permits the login.

IF EXISTS (SELECT name FROM sysobjects
WHERE name = 'sp_$ndo$loginproc' AND type = 'P')
DROP PROCEDURE [sp_$ndo$loginproc]
GO
CREATE PROCEDURE [sp_$ndo$loginproc]
@appname VARCHAR(64) = NULL,
@appversion VARCHAR(16) = NULL
AS
BEGIN
PRINT 'The system will be unavailable on Sunday April 1.'
END
GO
GRANT EXECUTE ON [sp_$ndo$loginproc] TO public
GO

Example 2

The following code example displays an error message in Microsoft Dynamics NAV and prevents the login.

IF EXISTS (SELECT name FROM sysobjects
WHERE name = 'sp_$ndo$loginproc' AND type = 'P')
DROP PROCEDURE [sp_$ndo$loginproc]
GO
CREATE PROCEDURE [sp_$ndo$loginproc]
@appname VARCHAR(64) = NULL,
@appversion VARCHAR(16) = NULL
AS
BEGIN
IF SUSER_SNAME() IN ('ACCOUNTS\jim', 'SALES\bill')
RAISERROR ('Contact the system administrator.', 11, 1)
END
GO
GRANT EXECUTE ON [sp_$ndo$loginproc] TO public
GO

Sunday, May 9, 2010

What makes Expert - Matt.Traxinger

Today I read the following post from Mr. Matt.Traxinger and really impressed with it…

The what is not nearly as important as the why.
Obviously the most important part of being an expert is understanding what you're doing. Don't get that confused with knowing what you're doing. Just because you can perform the lab exercises in the functional and technical manuals with your eyes closed doesn't mean you're an expert. Knowing how to run Adjust Cost, even knowing what it does, is not the same as understanding why it needs to be run.

It's not what you know, it's who you know
If you know what every button, every object, and every line of code in the system does then congratulations. You should either be billing 2000 hours a year and making a six-figure salary or running your own solution center. It's important to remember that in an application as big as NAV you're never going to know it all. Even Microsoft MVPs and senior level professionals have questions sometimes. That's not to say that you shouldn't strive to learn as much as possible, but you should have a place, or better yet, specific people that you can bounce questions off of. Speaking from experience, it's not easy to learn when you don't have anyone to help you. If you need a place to start, I highly recommendwww.mibuso.com.

Love what you do
I've developed in my fair share of languages: Basic, C, C++, Java, Jython, C#, SmallTalk, Lisp, just to list the more well known ones. I've built windows applications, web sites, all sorts of things. I have to say, though, that I absolutely love being an ERP developer. If I spent my days writing OS and device driver code I would go insane. Whenever people ask me what I do, it's basically a conversation ender: Computer Programmer (I boil it down to a term they should be familiar with). Little do they know they're missing out on so much fun. I can't imagine doing anything different. If you don't feel the same way about what you do, then you should find something you do love. Don't spend your time trying to become an expert in something you don't want to do.

Transferability
If you can't put the things you know into words (that includes speaking, writing, coding, and anything else that involves knowledge transfer) then you cannot be considered an expert. The purpose of becoming an expert is not just to hoard everything you've learned, but to turn that knowledge into practical, useful tools. More importantly, your knowledge should be used to make other more knowledgeable. Think back to when you were the junior developer, wanting to succeed, but not knowing where to start. The ability to help others will only make you more successful.