Friday 10 February 2012

How to hide Placeholder in SSRS 2008?


For the ones who are working with SSRS, Placeholder is not new for them. So, today I will not go into explaining what is Placeholder, How and Where it is used, etc. I will straight away target the issue mentioned and try to explain a possible way to overcome that. However, for the ones who do not know about Placeholder, please visit this MSDN link.


Let’s first try to understand the problem I am talking about. Please have a look at Diag: 1-

Diag1 Diag: 1

Here, as you have noticed, 4 different placeholders are used to make up the details for the Attribute column; 2 each for Labels & their respective values. Now, the requirement is such that the Labels & their Values for the Sub Category are to be shown only if the Value exists ELSE even the label should not be shown. This can be easily managed using the below expression for the Label & Value placeholders respectively -

Diag3Diag: 2

 Diag2 Diag: 3

But the main issue here is the BLANK SPACE CREATED refer Diag: 1. There is not direct property available to Hide the Placeholder. Hence, the need arises to find out some work around.


The expected output is -

Diag4 Diag: 4

To get the expected output, the main credit goes to the below Placeholder property -

Diag5 Diag: 5

We just need to select HTML as the Markup type and then set the Value expression as under -

Diag6 Diag: 6

And yes, we are done !


This was the solution I could manage to find out. There might exist other solutions as well. Please revert back if you are aware of any such solution by adding a comment below.

Friday 3 February 2012

CRM 2011: How to launch a Dialog on click of custom ribbon button?

In this post I will explain how to launch a Dialog from Ribbon Button in Dynamics CRM. The requirement is like configure a custom ribbon button on custom entity which will launch a dialog (Process).

In this Example, I’ve used custom entity “Flight Route” contains a button called “Test Button” which will launch a dialog. Dialog will select a flight name from the option set and insert new note record on the selected flight route record.

Following are steps that demonstrate launch dialog from ribbon button.

Before to start with a launch dialog, we need to create
1. Create a dialog for “Flight Route” entity
· Select Solution.
· Select Processes.
· Create new process.


· Specify the Process name.
· Select Entity.
· Select “Activate as” as “Process” and “Category” as “Dialog”.
· Configure it as an on-demand process.
· For this dialog make sure that it should contain at least one
  “Prompt and Response”


2. Javascript Library as a web resource
· Create new Web resource” /javascripts/LaunchModalDialog.js”


· Click on Text Editor.
Insert below function in Text editor window.

   1: function LaunchModalDialog(dialogId,typeName,recordId)

   2: {

   3: var serverUrl = Xrm.Page.context.getServerUrl();

   4: recordId=recordId.replace("{", "");

   5: recordId=recordId.replace("}", "");


   7: dialogId=dialogId.replace("{", "");

   8: dialogId=dialogId.replace("}", "");


  10: // Load modal

  11: var serverUri = serverUrl +'/cs/dialog/rundialog.aspx';


  13: var mypath =  serverUri +'?DialogId=%7b' +dialogId.toUpperCase()  +'%7d&EntityName=' + typeName+'&ObjectId=%7b' +recordId+'%7d';


  15: // First item from selected contacts only

  16: window.showModalDialog(mypath);


  18: // Reload form.

  19: window.location.reload(true);

  20: }

In above JavaScript method I have used 3 different parameters.

dialogId is id of the dialog we need to open from button (String Parameter)
typeName is entity’s logical name (String Parameter)
recordId is entity’s current record id form where the dialog will be launched.

3.  Get the Dialog Id Value
· Once you have created new dialog.
· Click Start Dialog.


· That will open new dialog window.
· Get the dialog id value from the URL(Ctrl+N) and note it down somewhere,
   to use the same in coming steps.


4. Insert custom button on entity’s form using Visual Ribbon editor. ( To create a new button on ribbon, you can refer below link---)

5. After inserting a new custom button,
follow the below steps to add JavaScript function with parameters
· Click on Add link for specifying the “Function name” and “Library”
           a. Specify function name and library name.
          b. Click on “Add” link as shown below. It will open a list of
              parameter types which you can pass with the function.


As discussed earlier (refer step 2) we need 3 different parameters to call JavaScript method. Pass those values as described below. The first parameter will be the value which we have noted in step 3. The second one is entity name. And the last one is the record GUID.


· Clicks on save. It will save and publish the changes on CRM server.


6. Now you can verify the button on your entity’s form ribbon.


7. On click of this button your dialog will be launched.


8. Select Flight Name from the list and click next and then Finish on the last screen.


9. At the end, a note will be generated on Flight Route entity