Thursday, May 23, 2013

Capturing Save Event Arguments using Execution Context Parameter in CRM2011


When working with Dynamics CRM form scripting, there are several occasions where one needs to know the execution event for performing manipulation through scripting. For this reason Dynamics CRM provides execution context as an optional parameter that can be passed to a JScript library function through an event handler.
In below screenshot you can see “Pass execution context as first parameter” check box checked which passes execution context to the script function in CRM form.



There are different ways an entity record gets saved in Microsoft Dynamics CRM. This can be determined by getEventArgs() in execution context parameter as below:

function Form_onsave(executionObj) // exectuionObj passed as First Paramter
{
var eventmode=executionObj.getEventArgs().getSaveMode();

if (eventmode==2) { // returns 2 for Save and Close.
///
// Do the necessary logic
///
    }
}

The above code is an example to check “Save and Close” to perform some action. Similarly we can detect different save by return value from getSaveMode(). Below is the list of different save modes.

Entity
Event Mode
Value
All
Save
1
All
Save and Close
2
All
Save and New
59
Activities
Save as Completed
58
All
Deactivate
5
All
Reactivate
6
User or Team owned entities
Assign
47
Email (E-mail)
Send
7
Lead
Qualify
16
Lead
Disqualify
15

 Hope this was helpful!

Friday, May 17, 2013

How to disable homepage features in Dynamics GP through SQL Server???


Dynamics GP homepage can be customized for each user or role. GP don’t have an option to disable a particular or all features for all the users.



Follow the below steps to disable the homepage features for all the users: 
1. Open SQL Server Management Studio.
2. Take a backup of the DYNAMICS database.
3. Execute the following query in DYNAMICS database.


UPDATE DYNAMICS.dbo.SY08100 SET COLNUMBR = 0, SEQNUMBR = 0, Visible = 0 WHERE
    (DICTID = 0) AND ((COLNUMBR <> 0) OR (SEQNUMBR <> 0) OR (Visible <> 0)) AND USERID not in ('sa', 'DYNSA')


This script will disable all the homepage features for all users except sa and DYNSA.

Execute the below query to disable a particular feature:

UPDATE DYNAMICS.dbo.SY08100 SET COLNUMBR = 0, SEQNUMBR = 0, Visible = 0 WHERE (SectionID in (1, 2, 3, 4, 5, 6)) AND
    (DICTID = 0) AND ((COLNUMBR <> 0) OR (SEQNUMBR <> 0) OR (Visible <> 0)) AND USERID not in ('sa', 'DYNSA')

SectionID field values and the corresponding homepage feature:

1 à To Do list
2 à Quick Links
3 à Metrics
4 à My Reports
5 à Microsoft Office Outlook
6 à Connect

It is highly recommended to execute these scripts only by GP administrator. Also, during this script execution process all the users should be out of GP.

Note: If the Customize Home Page task is assigned to the User’s role then users can enable the features in Dynamics GP.

To restrict the Customize Home Page option, remove the Customize Home Page task from the corresponding user’s role by following steps

1. On the Microsoft Dynamics GP menu, click Tools, click Setup, click System, and then click Security Tasks.
2. In the Task ID area, select the <User Role> (or DEFAULTUSER).
3. In the Product area, select Microsoft Dynamics GP.
4. In the Type area, select Windows.
5. In the Series area, select System.
6. Click to clear the Customize Home Page check box to remove access to the window.
7. Click OK.


Hope this helps!!!

Dynamics SL - Customization failures and way to handle


Given below are the few thoughts on our investigation with the customization failure issue in Dynamics SL 7.0 or SL 2011.Here are the various error messages due to the customization failure.
  • “Fatal Exception occurred in VBA and was caught by .\vba.ccp at line 332”
  • “Customization has stopped working because VBA Trim function not recognize”
  • “System Message 20406 - Error loading VBA project”
             
                 

You may try the below steps.
  • Locate the APC folder (C:\Users\User Name\AppData\Roaming\Microsoft Dynamics SL\APC).
  • By default the APC folder is hidden due to some security reason. You may need to enable the visibility of hidden files / folders.
  • Delete the swimapi.kpr and swimapiex.exd files. These files are responsible for the loading of customizations prior to screen load.
  • On launching the customized screen again, these files will be recreated.

This may resolve the customizations failures in Dynamics SL.

Drag and Drop file using Control Add-Ins in Microsoft Dynamics NAV


Control add-ins for the Microsoft Dynamics NAV are built with the Microsoft .NET Framework–based assemblies that you install on computers that are running the Microsoft Dynamics NAV Windows client.        

To include a control add-in on a Role Center, you apply the control add-in on a page that is assigned to a part of the Role Center. Control add-ins are not supported by the Microsoft Dynamics NAV Web client or Microsoft Dynamics NAV Portal Framework for Microsoft SharePoint 2010

Here we will see an example of Drag and Drop a file in the text box controls. On drag and drop the text box will provide you the path of the file with the filename and extension.

Follow the below procedure for Drag and Drop a file:
    1.       Open Visual Studio.
    2.       Select C# class library and provide the name for the solution. Here we have given name as DragDrop.
    3.       A New Class file will open.
    4.       Add the following references:
  • System.Drawing
  • System.Windows.Forms
  •  Microsoft.Dynamics.Framework.UI.Extensibilty.dll, by default, it is available in Program Files\Microsoft Dynamics NAV\60\RoleTailored Client folder.
   5.   Type the below code

using System.Drawing;

using System.Windows.Forms;

using Microsoft.Dynamics.Framework.UI.Extensibility;

using Microsoft.Dynamics.Framework.UI.Extensibility.WinForms;

using System.IO;

 

namespace DragDrop

{
    [ControlAddInExport ("DragandDrop3.5")]
    public class DraGDroP:WinFormsControlAddInBase

    {

        TextBox txt;

        protected override Control CreateControl()

        {

            txt = new TextBox();

            txt.MinimumSize = new Size(50, 0);

            txt.MaximumSize = new Size(500, Int32.MaxValue);

            txt.DragEnter += new DragEventHandler(txt_DragEnter);

            txt.DragDrop += new DragEventHandler(txt_DragDrop);

            txt.AllowDrop = true;

            return txt;

            throw new NotImplementedException();

        }

        private void txt_DragEnter(Object Sender, DragEventArgs e)

        {

            if(e.Data.GetDataPresent(DataFormats.FileDrop,false))

            {

                e.Effect =DragDropEffects.All;

            }

        }

        private void txt_DragDrop(Object sender, DragEventArgs e)

        {

            try

            {

                int index = 0;

                string data;

                string[] filecollection =(string[])e.Data.GetData(DataFormats.FileDrop );

                foreach (string file in filecollection )

                {

                    //this.txt.Text = Path.GetFileName (file);

                    this.txt.Text = Path.GetFullPath(file);

                    }

                data=this.txt.Text;

            }

            catch (Exception ex)

            {

            }

        }

    }

}
 
 
  6.    Now we need to Sign the Add-In assembly
  7.       Go to Project propertiesàsigning.
  8.       Select the checkbox “Sign the assembly”. Now choose a String Name key.
  9.       Click New. Specify the name and protect your assembly with Password.
  10.   Save and Build the Solution.
  11.   Copy the assembly dll from the folder you have saved. By Default, C:\My Documents\Visual Studio\Projects\[Addin Project name]\bin\Debug.
  12.   Paste the dll in the Add-Ins folder of the Role Tailored client. By default, C:\Program Files\Microsoft Dynamics NAV\60\RoleTailored Client\Add-ins.
  13.   Now we need to create a Public Key token.
  14.   Follow the link for creating public key token. http://msdn.microsoft.com/en-in/library/dd983825.aspx
  15.   Copy the Public key token created.
  16.    Now Open table Client add-in(2000000069) in Dynamics NAV.
  17.   Type the Control Add-in name as “DragandDrop3.5”.
 18.   Paste the copied Public Key.
  19.   Now Exit from the table.
  20.   Create a New Page in Page Designer. Like Below image.
 
 
21.   Go to the Control Add –in Property of a Field “Drag a File and Drop” and Choose the Public key token that created for this add-in.
22.   Save, Compile and Run the Page.
23.   Now drag a file from any of your folder and place in the text box.
24.   Refer the below image
 
Hope this helps in dragging a file and retrieving its full path by dropping the file.

Thursday, May 16, 2013

Resolving “Could not load Microsoft.IdentityModel” MS CRM 2011 service authentication error in windows 8

Most often when CRM development is carried out in new machine or in updated OS, the system pops out with CRM authentication service issue as displayed in below screen. Since the system is not yet configured with the “Windows Identity Foundation”.



To enable and to fix the issue, either of the follwing solution can be followed.

Solution 1:
Go to “Control Panel“>> “Programs and Features” >> in the left navigation pane click “Turn Windows features on or off” then select the “Windows Identity Foundation” and click “OK”.

Solution 2:
Go to “My Computer” and search the assembly name called “Microsoft.IdentityModel”. If the machine finds the library, then copy the dll and pasted it into the corresponding framework version folder under “C:\Program Files\Reference Assemblies\Microsoft\Framework”. Add this assembly as a reference in the visual studio application.


Hope this helps!



Friday, May 10, 2013

Adding Smartlist report to Dynamics GP Reminder


In Dynamics GP, we can easily create a remainder using standard and custom smartlist. The following steps clearly illustrates about the creation of custom smartlist reminder in Dynamics GP.

Steps to create Smartlist reminder:

1. Go to Microsoft Dynamics GP à Smartlist to open any smartlist report.
2. Click Favorites to open Add or Remove Favorites.
3. Enter the Smartlist name in name field (Ex: Customers Over Credit Limit)


4. Click Add favorite and reminder to open Custom Reminder window and select the Remind me when   condition based on the requirement. Click OK to set the reminder.


5. Go to Microsoft Dynamics GP àReminders, to find our custom smartlist report.


6. Check the GP Home page to view the custom Smartlist reminder.


7. The details of the reminder can be viewed through smartlist by clicking the reminder (Customer over Credit Limit).



Hope this helps!!!

Dynamics SL – Password protection for the Approval & Inquiry screens of Project Series

Password Maintenance (PA.PWD.00)
 (Open SL -> Project-> Project Controller-> Maintenance -> Password Maintenance)

Password Maintenance provides the entry and maintenance of security passwords, which are prompted for in certain screens. Specific key values, such as company ID, Employee ID, and subaccount, trigger prompting for a password in selected inquiry and approval screens throughout the system, particularly in review and approval screens. This screen is used to associate the key value with its corresponding password.

Field descriptions for Password Maintenance Screen given below.
1.      Password Type:
PV lookup in Password Type Valid password types are CPNY for company passwords, EMP for employee passwords, and ORG for organizational (subaccount) passwords. 
2.      Key Value:
Enter the secured key value to be password protected. For example, if the password type is EMP, enter the Employee ID to password-protect in the secured screens.
3.      Password:
Passwords can contain from 6 to 22 characters. They can include both upper- and lowercase letters in addition to numerals and special characters such as punctuation. When users enter their password on a secured screen, the characters in the password do not appear.

  Security reasons, it is important that this screen be restricted from unauthorized use.
Time Review and Approval Screen (TM.TRA.00)
  Open SL -> Project-> Time & Expense for Projects-> Processes -> Time Review and Approval
  • Select the Employee id with the password setup.
  • Enter Password window pops up prompting the user to enter the password.
Project inquiry (UZ.UPI.00)
  Open SL -> Project-> Employee Utilization-> inquiries -> Project inquiry
  • Select the Employee id with the password setup.
  • Enter Password window pops up prompting the user to enter the password.



Hope this helps!!