Thursday, 26 June 2014

Add navigation items in a form view

Hello again. This time I would like to share something with regard to CRM Dynamics 2013. I was trying to add a new navigation button under an account form. So this is how you do it.


First, you go into the solution where you want to add the new customization, in my case the solution was called Tickets. I made sure the Account Entity was included into it, yet I did not bother to include its dependencies.
image

Wednesday, 18 June 2014

Switching your HDMI inputs on a Samsung TV

Hi all, let's assume that you have a Samsung TV and a Raspberry Pi connected on an HDMI input.

Using CEC you could send:
 echo "as" | cec-client -s
to switch to the next input,. However this is inconvenient since it does not switch "back" to your previous input. So what can you do?

Get this lovely utility from here. (Disclaimer: I did not write this, I got it on GitHub). It is a lovely python script which you can use to send commands to your samsung TV AFTER you have turned it on. In my case I use the commands KEY_HDMI2 or KEY_HDMI3 but there is a great variety of commands that you can send.

Keep in mind, your device (where the script will run needs to be paired with your TV in order for this to work. This can be a simple procedure, the first time you fire a command the TV asks if you would like to pair with the device, you say yes and that's all.

Python is already installed on the xBian Linux for R-Pi. So, in the same manner that I have described here, you can set up an ssh command that executes this script with python on your raspberry Pi.

Usage:
$ python samsung.py KEY_HDMI.

A more comprehensive list of commands can be found online, search google for samsung and KEY_HDMI or look for example here.

Tuesday, 25 February 2014

Make SalesLogix Remember User Specific Preferences

Hello. Today I needed to implement a little checkbox in Saleslogix with a little twist. This checkbox must remember its value according to the user that is currently using it. In other words, if a user checks this box and then closes his SLX client, the checkbox must be checked the next time the user navigates to it.
This should be – like I said – user-dependent. Every user should be able to decide in which state he / she wants to operate the checkbox.
Saleslogix offers such methods out of the box. No creation of corresponding database tables and manual manipulation of values. This is done by using the embedded Application.UserOptions methods.
Inside the OnFormChange event, we check if the values exist and if so, we set them for the current instance:
 if Application.UserOptions.Exists("hideTestCheckBox", "LicenseContact" & Application.BasicFunctions.CurrentUserID) = true then  
     hideTestCheckBox.Checked = Application.UserOptions.GetAsBoolean("hideTestCheckBox", "LicenseContact" & Application.BasicFunctions.CurrentUserID)  
 End If  
Pay attention to the “Application.BasicFunctions.CurrentUserID” modifier for the CATEGORY KEY of the UserOption. Actually, the name UserOptions is not appropriate here since these keys are actually common for all users. Thus, we need to concatenate the group key with the current user ID to avoid exceptions trying to push entries with the same Primary key in SLX DB.

(The primary key consists of the combination of the two strings inside the “Exists” statement, in our case “hideTestCheckBox” and “LicenseContact + UserID”)

In the event where the checkbox gets updated, we need to push the updated value in the User Options. This is done as such:

 Sub hideTestCheckBoxClick(Sender)  
 if Application.UserOptions.Exists("hideTestCheckBox", "LicenseContact" & Application.BasicFunctions.CurrentUserID) = false then  
   Application.UserOptions.Add "hideTestCheckBox", "LicenseContact" & Application.BasicFunctions.CurrentUserID, "Hide Test Licenses", hideTestCheckBox.Checked  
 end if  
   Application.UserOptions.SetAsBoolean "hideTestCheckBox", "LicenseContact" & Application.BasicFunctions.CurrentUserID, hideTestCheckBox.Checked, false  
   UpdateDataGrid   
 End Sub  

Obviously we need to add the key to the database in case it is not there yet. The first “IF” statement is run only once here per user. But this is mandatory, otherwise SLX throws an exception that the key is missing.

Cheers!

Friday, 10 January 2014

Force-Validate Hidden Form Fields client-side


Hello again. Let´s say you have a couple of hidden fields inside an html form and the latest version of jQuery keeps on ignoring their validation on the client side. This has been the updated default behavior after version 1.9.0. Do you need to change it? Try inserting the script below in your page that contains the form.

Friday, 20 December 2013

IIS 7 File Uploads: maximum size restricted per default

I was working on an updated way to attach files to tickets asynchronously via the Kendo Upload component. Everything was working smoothly on my development machine. I then played a local release on my own IIS. From that point on I realized that every file bigger than 30Mb that I was trying to upload was failing.
I captured the server response with fiddler, 404 page not found. How can this be? I attached the process to VS Debugger, which seemed to be working ok, but the breakpoint inside my Save() method was never hit, except for that times that I was trying to upload a smaller than 30Mb file…

Irritating huh? Well, this is what is actually going on. I found the answer on this excellent post by Web Trenches. IIS 7 limits maximum upload file size to 30Mb by default. This can however be changed and there are 2 ways to do it: