Pages

Tuesday 4 October 2016

INSTALLATION GUIDE FOR MICROSOFT DYNAMICS AX 2012 R3

Today I am going to illustrate how to install Dynamics AX 2012 R3 from scratch.

Please make sure that the AX prerequisites are installed already before starting installation of AX. Now I will illustrate the step by step AX installation.

STEP-1 INSTALLING AX DATABASES
(a) Open the Dynamics AX setup and double click on Autorun.















(b) The AX installation setup screen will open.



















(c) Now click on Install Microsoft dynamics AX components.



















(d) Now click next to go to the installation type selection page.
























Tuesday 14 June 2016

Consume XML File as Web Service SOAP Request

XMLports are used to export data from a Microsoft Dynamics NAV database to a file or import data from a file to a Microsoft Dynamics NAV database. Expose a codeunit as a web service that import data as XML. It work as receiver and support bulk data insert.

Create Item Buffer Table.














Create XML Port for the table


































Create Codeunit which expose as  WebService











Publish Web Services









Check the WSDL using Internet Explorer

















Use Boomerang – SOAP and REST Client





















  • Create new project
  • Create a Service
  • Enter WSDL URL and Service name. (Published Web Services in NAV - image 3)
















Click on Request on left hand side and Create XML as per image

Click on Send

Check the Item Buffer Table, Data is imported into the table.

Sunday 15 May 2016

Navision 2016: Using a Codeunit Web Service (SOAP) for Customer details

Creating and Using a Codeunit Web Service (SOAP)
Web services provide easy communication and data exchange in a secured environment. In Microsoft Dynamics NAV 2016, you can create, publish, and use web services. For example, you can publish a web service that return customer’s details in response.

Enable SOAP Web service
















Creating a codeunit in Microsoft Dynamics NAV.

















Publish Web Service
1.     Open the RoleTailored client, and then connect to the CRONUS International Ltd. company.
2.     In the Search box, enter Web Services, and then press Return.
3.     In the Web Services page, choose New.
4.     In the Object Type column, select Codeunit, then in the Object ID column enter 50000, and then enter Letters in the Service Namecolumn.
5.     Mark the check box in the Published column and choose OK to close the New - Web Services page.









Using the web service

1.     In Visual Studio, on the File menu, select New, and then choose Project.
2.     Under Installed Templates, expand the Visual C# node, select Windows, and then, select Console Application.
3.     Enter the name UsingLettersService for the application and choose OK to close the New Project page.The sample code in this walkthrough expects this exact application name, so do not change it.
4.     In Solution Explorer, right-click the References node in the project, and then choose Add Service Reference.
5.     In the Add Service Reference window, choose the Advanced button.
6.     In the Service Reference Settings window, choose the Add Web Reference button, type or paste the URL that you used when you checked the WSDL, such as http://localhost:9047/DynamicsNAV90/WS/Services, and then choose Go (the green button with the arrow).



7.     When the Letters service is displayed on the discovery Page, choose View Service, then in the Web reference name text box, renamelocalhost to WebService, and then choose Add Reference.
8.     In Solution Explorer, choose Program.cs and replace the existing code with the following code:

using System;
using System.Collections.Generic;
using System.Text;
namespace UsingLettersService
{
    // Imports newly generated web service proxy.
    using WebService;
    class Program
    {
        static void Main(string[] args)
        {
            // Creates a new instance of the service.
            Letters ws = new Letters();          
           
            // Uses default credentials for authenticating
            // with Microsoft Dynamics NAV.
            ws.UseDefaultCredentials = true;
            ws.Url = "http://localhost:9047/DynamicsNAV90/WS/CRONUS%20International%20Ltd./Codeunit/Letters";   
            // Declares variables to work with.
            string inputstring, outputstring;  
            inputstring = "20309920";

            // Calls the Microsoft Dynamics NAV codeunit web service.
            Outputstring = ws.CustomerDetails(inputstring);
            // Writes output to the screen.
            Console.WriteLine("Result: {0}", outputstring); 
            // Keeps the console window open until you press ENTER.
            Console.ReadLine();    
        }
    }
}

On the Build menu, select Build Solution to build your project and then, from the Debug menu, choose Start Debugging to run the application in debug mode.

Output:
Name      Email Id












Saturday 25 April 2015

Price Change item/ item without price should not print on Receipt: LS Retail 2013 R2

This is small customization in LS Retail for not print price change item in the receipt.

1. Create field in POS Trans. Line (99008981) table and Trans. Sales Entry (99001473) table.

Field No.  Field Name Data Type
50000  Print Line Boolean

2. Codeunit: POS Post Utility (99008902)

Add one line code in funtion: InsertSalesTransaction() 

SalesEntry."Customer No." := POSTransaction."Customer No."; //Existing
SalesEntry."Print Line"   := POSTransLineTmp."Print Line"; // Add Code

3. Create POS Command

Table: POS Command (99008920)

Create POS Command "PRICECH1" similar to PRICECH.

4. Codeunit: POS Transaction (99001570)

        //TRI HS START
        'PRICECH1':
          ChangePricePressed1(MenuLine.Parameter);
        //TRI HS STOP

Write above code after end of PRICECH Case statement.

Create ChangePricePressed1 Function as similar to ChangePricePressed function in the POS Transaction codeunit and add bold highlight code


LineRec.VALIDATE(Price,Dec);  //Existing Line

LineRec.VALIDATE(LineRec."Print Line",TRUE);       //Add Code
LineRec.MODIFY;                                                               //Add Code

WriteMgrStatus;      //Existing Line

5. Codeunit: POS Print Utility (99008903)

Add one line code in funtion as

PrintSalesInfo(VAR Transaction : Record "Transaction Header";Tray : Integer)

glTrans := Transaction;
SalesEntry.SETRANGE("Store No.",Transaction."Store No.");
SalesEntry.SETRANGE("POS Terminal No.",Transaction."POS Terminal No.");
SalesEntry.SETRANGE("Transaction No.",Transaction."Transaction No.");

SalesEntry.SETRANGE("Print Line",FALSE);  //Add Code
OrderByDepartment := GenPosFunc."Receipt Printing by Category";

6. Add PRICECH1 command in Post Command and Post Parameter 0


Thursday 2 April 2015

Block multiple Staff Login with same Staff ID in LS Retail POS (Nav 2013 R2)

Block same Staff Id login at difference terminals at same time in LS Retail POS.

Small Customization

1. Create Field in Staff table (99001461)
   Field Name              Type
   Login by                  Code        10
                                
2. Codeunit -> 10012718 (EPOS Controler)
   Function: LogoffPressed(pActivePanel : Text) : Boolean
     
   Create local variable
   Variable Name         Type              Subtype
    recStore                    record           Staff

@Function start
//TRI HS START 
IF (POSSession.StaffID = '') AND (POSSession.TerminalNo <> '') THEN BEGIN
  recStaff.RESET;
  recStaff.SETRANGE(recStaff."Login by",POSSession.TerminalNo);
  IF recStaff.FINDFIRST THEN
    REPEAT
      IF recStaff."Login by" = POSSession.TerminalNo THEN BEGIN
        recStaff1.RESET;
        recStaff1 := recStaff;
        recStaff1."Login by" := '';
        recStaff1.MODIFY;
      END;
    UNTIL recStaff.NEXT = 0;
END;
//TRI HS STOP

Add bold code between the two line as shown below

  IF POSSession.StaffID <> '' THEN BEGIN
//HS START# Code added to update Login Status field in Staff table
      recStaff.LOCKTABLE;
      recStaff.RESET;
      IF recStaff.GET(POSSession.StaffID) THEN BEGIN
        recStaff."Login by" := '';
        recStaff.MODIFY;
      END;
//HS STOP
    POSSession.SetStaff('');

3. Codeunit -> 99001572 (POS View)
   Function: Login(Manager : Boolean;SetNewStaffID : Code[10]) : Boolean
     
   Create local variable
   Variable Name         Type              Subtype
    recStore                    record           Staff

Add bold code between the two line as shown below

RetVal := POSSESSION.Login(Manager, TmpStaffID, TmpPassword, TmpWorkShift, MessageTxt);

//HS START # Code to block multiple login with same staff ID at POS

recStaff.LOCKTABLE;
recStaff.RESET;
IF recStaff.GET(TmpStaffID) THEN BEGIN
  IF RetVal AND (MessageTxt = '') THEN BEGIN
    IF (recStaff."Login by" = '') OR (recStaff."Login by" = POSSESSION.TerminalNo) THEN BEGIN
      recStaff."Login by" := POSSESSION.TerminalNo;
      recStaff.MODIFY;
    END ELSE BEGIN
      MessageTxt := 'Staff already Logged-in from ' + recStaff."Login by" +' terminal to the POS';
      RetVal := FALSE;
    END;
  END;
END;
//HS STOP

IF RetVal THEN BEGIN

---------------------------------------------------------------------------------

Enjoy...