The Dev Guy

The Dev Guy

Monday, June 22, 2015

Upgrading from SL 2011 SDK Visual Studio 2010 to SL 2015 SDK Visual Studio 2013


 

Goal 

Time has come to move from SL Dynamics 2011 to SL Dynamics 2015. You need to upgrade your VS 2010 projects to VS 2013 and SL Dynamics SDK 2011 to 2015.

Environment

Windows 2012 Server SQL Server 2012 SP 2 and Visual Studio 2013.

Issue

            Upgrade utility leaves a few steps to do. Its not just run and ready to go like earlier versions, and you can’t just open the project in VS 2013 and bam you are done.

You have to run the conversion utility then there are manual steps you have to perform.            

 

Resolution                                             

            First you need to install the SDK and Legacy Code Utility. They are options on the SL install utility. Must have both.

            Second Run the SL DynamicsSLSDKConversion.exe that is placed in the VT directory under the main SL directory. Then a Code Converter directory holds the exe.

Select your project and run the utility. Note that it does an in-place conversion, back up first. See Image Below

 

            Third open the project in Visual Studio 2013. You will notice many errors no matter how simple your project was. I’m am going to go through the steps you need to do for a standard sl screen project that you had grids and controls from the vb toolkit in but not much else.  

Manual Steps Listed below:
 

Right mouse on Project (not solution) and select properties.
 

Click on References and click Add
  

Browse to C:\Windows\Microsoft.NET\assembly\GAC_32

a.       Add Solomon.Kernel

b.      Add Microsoft.Dynamics.SL.Controls

 

Delete OLE reference

 

Delete VB compatibility reference

 

Delete the two Solomon Controls Reference

 
 
 

Click on Application Tab

 

Change Framework to .Net Framework 4.0 Client Profile


Copy Microsoft.Dynamics.SL.SDK.vb to the project directory (I like to have the project with all support files within,  you don’t have to, just reference the right file)
 

Exclude Solomon.VBTools.vb from the project

 


Add Microsoft.Dynamics.SL.SDK.vb to the project

                 Your project references should like below:
 


                 Now you should be able to compile.

Conclusion 
          SL Upgrade for the SDK from 2011 to 2015 is done with some manual steps.

Thursday, April 30, 2015

Passing Parameters in Dynamics SL Screen and Insert into Grid


Goal 

You have a SL Dynamics custom screen with a grid. You want to pass parameters to this screen from another screen and, if values are passed, you want to insert a new line in the grid, put the values in it but Not save the line unless the user hits save. 
I recently had to do this where there was a bank feed that had vendor sometimes missing from the file but had a vendor name. So I created a cross walk table that has the bank feed vendor and name and the user  selected vendor id that it should walk to.  The user would select the line with the issue and click a button to add the vendor passed and the vendor name to the cross walk table.   

Environment

SQL 2008, Windows Server 2008 for SL and SQL Server, Windows 7 workstations, and Dynamics SL 2011.

We are developing in Visual Studio 2010. Please see my other post on how to get around the 64 bit issue.

Issue

            The problem is just figuring what code to use to perform these tasks: 
1) check parameters if passed
2) insert new blank line into grid on the fly
3) place values passed into this new blank line 

Resolution                                             

            The Resolution was as follows:
1) use ApplSetParmValue and ApplGetParmValue functions to pass and read the parameters.
2) use Edit_New() sub to insert new blank line into grid
3) use SetObjectValue functions to set the grid to have the values passed
 

Code in Calling Program:

Call ApplSetParmValue(PRMSECTION_VBRDT, "BankVendorID", sBank)

Call ApplSetParmValue(PRMSECTION_VBRDT, "VENDORName", sVendorName)
Code in Browse window Program (this is added to the form load after the detailload of the grid:

Dim sVendorID As String

Dim sVendorName As String

sVendorID = ApplGetParmValue(PRMSECTION_VBRDT, "BankVendorID")

sVendorName = ApplGetParmValue(PRMSECTION_VBRDT, "VENDORName")
 
Code to check if passed and insert line to grid:

If sVendorID <> "" or sVendorName <> "" Then

          
Edit_New(LEVEL0)
 
serr9 = SetObjectValue(txtVendorID, Mid(sVendorID, 1, 10))

serr9 = SetObjectValue(txtVendorName, Mid(sVendorName, 1, 30))
 
End If

The code checks if either of the parameters filled the memory fields.
if so Edit_New is passed the level that the grid is on and inserts a value. The focus is always set to this new line. That's why I chose the Edit_New.
Finally using SetObjectValue set the text fields for the values passed. 
That's it!

Conclusion 

 

It is relatively easy to pass parameters and add to a grid on the fly, allowing the user to accept or reject the changes before they are saved using the Solomon RDT Toolkit.