Friday, April 26, 2013

How to add additional sorting options in lookup???

In Dynamics GP, all the lookup windows have some default sorting options. However, if the user wants to add more custom sorts then that custom sorts can be added using Advanced Lookups Setup window.

For example, Customers and Prospects lookup can be sorted by Customer Id, Customer Name along with some additional sorting options (Customer Class, Type, Salesperson ID, Sales Territory ID and Corporate Customer Number). 

  



To add more sorting options for Customers and Prospects window:

1. Go to Advanced Lookups Setup window (Microsoft Dynamics  GPàToolsàSetupàCompanyàAdvanced Lookups)





2.      In Advanced Lookups Setup, choose Customers from Lookup Name drop down list.


3.       Maximum of four sorting options can be added for each lookup window. Select Sort by Field drop down to choose the respective sorting options.
4.      Here, Currency ID, Balance Type, Checkbook ID and Fax have been added as Sort by Field.
5.      Click Save to save the sorting options for the corresponding lookup window.
6.      Now, Customers and Prospects lookup window will display as per the below screenshot.



7.      In Customer and Prospects lookup window, if Currency ID is selected in Additional Sorts then the lookup window will display as per the below screenshot.



Hope this helps!!!

Menu Export/Import between Groups in Dynamics SL


Given below are the steps to copy the menu from the existing group to a new group in Dynamics SL.

Step 1:
Open the Menu maintenance screen and select the Group which needs to be replicated. 

Step 2:
Go to Action - > Export menu item, to export the menu of the selected group as an XML format.

(Note: Unless you specify another location, the exported file is saved in to your My Documents folder. The default file name is Menu.xml)
 

 Step 3:

Select the group the menu needs to be imported.
Go to Action - > Import menu item, to import the XML file to the selected group.
 
 

Step 4:
Respond to the System Message 9859 with Yes to overwrite an existing menu; No to append an existing menu
 



Hope this is helpful!!

Bulk Upload Documents to Online SharePoint from MS CRM Online



Microsoft Dynamics CRM 2011 allows managing documents available in SharePoint with native methods. This allows create, upload, view and delete documents available in SharePoint from within Microsoft Dynamics CRM.
Bulk upload of attachment to any MS CRM using on premise SharePoint can be achieved using native web service. But this gets tricky between Online SharePoint and Online MS CRM. Below are steps for achieving this using CRM plugin.
  • Gain access to Online SharePoint service. Please use this link to get detailed information to access SharePoint service
  • Retrieve MS CRM attachments document body.
  • Upload the retrieved attachments to the SP online using SP service retrieved in first step.

Note:   This above web service needs to be publically hosted. This hosted web service is then consumed through Plugin registered in MSCRM online.

Here is the part of web service code and for uploading attachments to SP online.

string FinalURL = <<SHAREPOINT URL/FILENAME + EXTENSTION>>
                HttpWebRequest request = HttpWebRequest.Create(FinalURL) as HttpWebRequest;
                request.Method = "PUT";
                request.ContentType = "application/x-www-form-urlencoded";
                request.CookieContainer = new CookieContainer();
                request.CookieContainer.Add(SetAuthCookies(<<SHAREPOINT URL>>, <<USERNAME>>, <<PASSWORD>>)); // Online SP Service
                request.AllowAutoRedirect = false;
                request.UserAgent = userAgent;
                request.Headers.Add("Overwrite""F");
                request.Timeout = Timeout.Infinite;

                Byte[] Documentstream = Convert.FromBase64String(<<DOCUMENTSBODY>>);
                Stream stream = new MemoryStream(Documentstream);

                Stream outStream = request.GetRequestStream();
                string status = CopyStream(stream, outStream);

                if (status == "success")
                {
                    outStream.Close();
                    HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                }

Hope this is helpful!!! Happy Coding!!!

Converting image files to text in Dynamics NAV


The article given below will help us to retrieve the "Text characters from an image" using Microsoft Dynamics NAV.
We can convert any format of an image(.bmp, .png, .tif, .jpeg)

Here I have taken the scenario of converting an "Error Message" image into a text file. Likewise, any image that has characters can be converted into a text file 

Consider, the below image:
         I captured the error message as screenshot and stored in local machine. For example : I saved in 'D:\Sample Error.tif' (Note: We need to use this file path and name when coding)
 

 

The text characters that are seen in the image can be stored in a document/text file.

Is this possible with NAV?
Yes it is possible with NAV and it can be developed by referencing the automation Server called Microsoft Office Document Imaging (MODI) which works by implementing OCR.

Microsoft Office Document Imaging can be readily available with Microsoft Office Tools package. If not contact your system administrator to include the MODI in office Tools.
How to read the characters?
To read the characters we are now going to develop a new codeunit.

Declare the following variables:
Doc – Automation-Microsoft Office Document Imaging 12.0 TypeLibrary.Document

image – Automation – Microsoft Office Document Imaging 12.0 Type Library.Image

filename – File

I – Integer

n – Integer

outstre – Outstream

 Type the following code:

IF ISCLEAR(doc) THEn

   CREATE(doc);

     //specify the file path and filename with extension as text/document file
    // This enables you to save your image file as text file

    filename.CREATE(<FILE PATH>);  // filepath\filename.txt
    filename.CREATEOUTSTREAM(outstre);  

    //Specify the file path, file name and extension of your image file.

    doc.Create(<File path of the image>);         //D:\Sample Error.tif
 
    doc.OCR(9,TRUE,TRUE);
                        // Where ‘9’ indicates the Language “English”, Boolean variables are optional

    i:=doc.Images.Count;

   FOR n:=0 TO i-1 DO //Loop to convert multiple images stored within one image
        BEGIN
         image:=doc.Images.Item(n);

          outstre.WRITETEXT(image.Layout.Text);

        END;

Now  Save and Run the codeunit.

Want to Check the Output?
 
 
In the above Output Everything looks fine, with some exceptions:
                 There are some Special/Junk character values inserted in between the text (*I,FJ). This is because OCR cannot recognize icon values. So in place of icons, the special characters inserted automatically.

 
Note: The special Characters like Single Quote(‘’), Double Quotes (“”) cannot be recognized by OCR.

The concept written above works not only with NAV but also with any VB.Net application with some modification


Monday, April 22, 2013

Importing Capabilities of Dynamics SL

Effective data import into Dynamics SL can be attained through any of the below techniques from legacy system and other products.

1.       Solomon Object Model:

·       Any Dynamics SL window can be accessed as an object and pass data directly into the window.
·       Any COM-compliant application or programming tool can use Solomon Object model Eg: VB.Net/ C# by adding the Microsoft.Dynamics.SL.ObjectModel.dll as the reference.
·       Best for Dynamics SL Data import Automations as it strictly follows the SL rules and validations ensuring the SL data integrity.
·       The data source could be the databases of home grown/legacy application or the CSV file.

2.       Transaction import (TI):

·       Integration tool of Dynamics SL to transfer data from an external file into any Dynamics SL window
·       Existing Dynamics SL business logic will validate the imported data ensuring the Transaction integrity is an advantage.
·       Can be launched as a batch script file or can be scheduled to run automatically using the “Application Server” tool of Dynamics SL.
·       The data source could be the data file in the comma or tab delimited format.
·       TI processing works only with the Active Desktop connection. If the machine is locked, TI won’t work and will resume only after the machine is unlocked which is a major disadvantage for data import automations.

3.       SQL injection:

·       Injecting the data into the SQL tables of Dynamics SL directly.
·       Need to replicate the table impacts and the validations of Dynamics SL while importing the data into SL.
·       Not highly recommended as there is always a threat of not replicating all the business rules of Dynamics SL.
 
We are recommending Solomon Object Model for the Data import automations to Dynamics SL as the business logic of the screen will be preserved.

New Clients in NAV 2013

 
The latest version of NAV 2013 provides us two Web-based clients namely SharePoint client and Web client. Apart from these two we have the Windows client that exists from the earlier versions.

The Microsoft Dynamics NAV SharePoint client enables users to interact with Microsoft Dynamics NAV data from a Microsoft SharePoint website. End users can work with Microsoft Dynamics NAV data in a familiar SharePoint environment

The Microsoft Dynamics NAV Web client gives users access to Microsoft Dynamics NAV data over a network, such as the Internet. From a web browser, users can view and modify data from a user-friendly interface that resembles the Microsoft Dynamics NAV Windows client

Why do we need these new Clients?
  • To make our ERP accessible from anywhere i.e. through non windows applications
  • To compete in the ERP Markets
  • Expecting Lower Implementation costs, raise quality, provide more value and less user training
  • Provide the NAV functionality outside the company (to customers, "web access" instead of VPN)

A Detail Look Web Client
The Microsoft Dynamics NAV Web client does not replace the Microsoft Dynamics NAV Windows client but complements it by enabling scenarios that are not possible with the Microsoft Dynamics NAV Windows client. Also administering in NAV web client does not involve separate user accounts for the Microsoft Dynamics NAV Web client and Microsoft Dynamics NAV Windows client. The permissions that are granted to a specific user account apply to all RoleTailored clients.
 
Advantages/Benefits in using Web client
  • One click to access NAV
  • No distracting navigation (No Departments, Page search, Navigate Page)
  • No "Complications"
  • Users cannot change the language, company or work date
  • No special training required, no shortcuts to know
  • Use web clients for focused tasks for non-ERP users 
SharePoint Client
The Microsoft Dynamics NAV SharePoint client is built on the Microsoft Dynamics NAV Portal Framework for Microsoft SharePoint 2010, which is a web-based application framework that integrates Microsoft Dynamics NAV with Microsoft SharePoint applications. The Microsoft Dynamics NAV SharePoint client is designed for occasional users who typically need an overview of their daily work status and perform relatively simple or light data entry.

NAV Portal Framework (Integration with SharePoint)
  • NAV web parts to connect to other share point parts
  • Share point authentication and scalability
  • Share point Themes and style sheets
  • Share point environment (time zones , regional settings)
  • No menu suite navigation is possible in SP client

By integrating with SharePoint, the Microsoft Dynamics NAV SharePoint client lets you take advantage of the business productivity and administration benefits in Microsoft SharePoint, including 
  • Workflows,
  • Business connectivity services,
  • Workspaces.
  • SharePoint authentication,
  • Scalability    

Retrieving more than 50 record using REST OData in JavaScript


Normally we can retrieve only 50 records using an OData Rest End Points method for a single fetch.  Since the retrieve method also returns the paging cookie, we can iterate the retrieve process until we retrieve all records.  But while retrieving large number of data the performance will be significantly affected.
Below is the code to iterate the retrieve process until all records are retrieved.
var oReturn = null;
function RetrieveData() {
    var context = GetGlobalContext();
    var serverUrl = context.getServerUrl();
    ODataPath = serverUrl + "/XRMServices/2011/OrganizationData.svc/EntitySet";
    jQuery.support.cors = true;
    $.ajax({
        type: "GET",
        async: false,
        contentType: "application/json; charset=utf-8",
        datatype: "json",
        url: ODataPath,
        beforeSend: function (XMLHttpRequest) {
            XMLHttpRequest.setRequestHeader("Accept", "application/json");
        },
        success: function (data, textStatus, XmlHttpRequest) {
            if (data.d != null) {
                    var odataReturn = data.d;
                    if (oReturn == null)
                        oReturn = odataReturn.results;
                    else
                        oReturn = oReturn.concat(odataReturn.results);

     //Check if more records available in the page and call the same RetrieveData()

                    if (null != odataReturn._next) {
                        _next = odataReturn._next;
                        RetrieveData();
                    }
                }
        },
        error: function (XmlHttpRequest, textStatus, errorThrown) { alert('Unable to retrieve data:' + textStatus); }
    });
    return oReturn;

Hope this is helpful;

Friday, April 19, 2013

How to secure VBA projects?

Here are the simple steps to protect your VBA code from unauthorized person.

Step 1: Open Visual Basic Editor. Go to Microsoft Dynamics GPàToolsàCustomizeàVisual Basic Editor.

Step 2: Right click on the relevant project and select the project properties options. One can access the project properties window by using the Tools menu, too.


   
Step 3: Click the Protection Tab and check the Lock project for viewing check box.


Step 4: Enter a password to prevent unauthorized access.


Step 5: Click OK to apply the settings.

Step 6: Save your VBA project and exit from Dynamics GP. When you try to open the VBA project next time you will be prompted to enter a password to view the content.



Hope this helps!!!

Sunday, April 14, 2013

Exploiting the Cross Browser Support


With the release of the UR 12 Service Update, your CRM organization will support multiple browsers. This could be problematic for your organization if you have custom JavaScript that isn’t cross-browser yet.  Once the managed solution is installed it will automatically block any user from accessing the organization with a browser other than IE browser. This solution is very easy to use and configure as I have mentioned out below.

Click here to download the ControlBrowserSupportForOrganization_1_0_0_0_managed.zip solution.
Next, install the managed solution you downloaded above into your CRM organization. 
Step1: Go to Settings –> Solutions –> Import –> Browse to ControlBrowserSupportForOrganization_1_0_0_0_managed.zip and follow the wizard.
After the solution has finished installing.
Step2: Go back to Settings –> Customization –> Click Customize the System

Step3: Now click on Web Resources on the left and find the HTML web resource named Organization Browser Support Message.
Double-click the Organization Browser Support Message resource to open it.  You will be presented with the dialog below.  Edit the highlighted tokens to change the Organization Name and Administrator Name to the respective values for your CRM organization.

Step4: If you have users (such as any developers) that will need to access your CRM organization in a browser other than IE, you can open up their User record in CRM and give them the “Any Browser Allowed” security role.  This will enable that user to browse to your CRM organization using any supported browser.

Hope this will be helpful!