Tuesday, December 24, 2013

CRM 2011 Pages Without the Ribbon

If you have the need to create a CRM page and you don't want users to have the ribbon visible, you can use the following URL as a template to get to whatever record you need:

http://<servername>/HAC/userdefined/edit.aspx?_CreateFromId=%7b<GUID of a record you're coming from, if applicable>%7d&_CreateFromType=<form type (Ex: 1,2,3)>&etc=<entity type code>&id=%7b<GUID of your record>%7d&pagemode=iframe#

Replace Everything in yellow and you're good to go:


Note that the hotkeys will still work, such as CRTL-S for save and CTRL-D for delete.

CRM 2011 - Debugging Server Side Code (Plugins)

Creating and debugging plug-ins can be one of the more annoying tasks in CRM, and from my experience actually deters people from creating plug-ins where appropriate and people end up making oData calls in JavaScript on Forms instead. So I figured I'd do a quick write-up on debugging plug-ins. If you're working on premise it's a pretty simple task. Open up the solution with your code in Visual Studio (any recent version will work), click on Debug in the top toolbar then click Attach to Process...



Next, make sure the 'See Processes from All users' box is checked. This might not be necessary based off the account you logged in as, but it can't hurt. You don't have to change the Transport or Qualifier options. Finally, select the w3wp process. 'Attach To' should change to the .NET version of your solution.

Once attached, Visual Studio should stop at any breakpoint entered in your code as soon as that line is hit.

Now if you're not debugging / coding on the same box that CRM has been deployed to it's a little more complicated to debug. Thanks to updates in the Plugin Registration tool and the introduction of the Plugin Profiler though, it's easier than it used to be. First, fire up the Plugin Registration tool and connect to your CRM instance.


Once connected, click on the Profiler in the top toolbar.  Once installed it'll show up as Uninstall Profiler as shown below.  Additionally you'll see the new option of Debug:



Once installed, click on the step that you want to debug.  A new button called 'Profile' will appear in the toolbar.  Click on that, and (Profiling) should appear next to the step that you had selected:



Now do whatever will fire off this plugin.  When you do that, the UI will respond with a pretty ugly message, this is ok and expected.  When this happens, click on the Download Log button and save the text file somewhere easily accessible as we'll need it in the next step.  Also note that whatever you did in the UI will NOT be saved to the database:


Now go back to the Plugin Registration tool.  Click on Debug.  In the box that comes up, set the Profile Location to the text file that you just saved and set the Assembly Location to be the DLL of your compiled plugin.  The Plug-In value will probably be automatically selected, but if not set that as well.   Next, in step 3 you'll see a line telling you what process to attach to.  As we did earlier in attaching to the w3wp process, this time we'll be attaching to the Plugin Registration process.  So for example, in the screenshot below I'd attach to process 6164:



Once attached, click on the Start Plug-in Execution button in Plugin Registration.  What will happen is that the data/action you just did in the UI will be re-done and Visual Studio will stop on any breakpoints in the code you that added, again very similar to what happened in the first example in this post.  Another good part about this method is that if you need to run the same steps over and over, you can just re-run the trace.  No need to enter the same information into the UI over and over.

From personal experience, I've noticed that some versions of the Profiler / Plugin registration play better with CRM than others.  You might have to try different versions of the SDK to find one that works well for you.  If you get some ugly error message, I'd start there.

Enjoy.

Thursday, November 14, 2013

CRM 2011 'Defaulting' to Classic Forms - UR12+

If you're looking to use the Classic forms in CRM instead of the new Polaris Flow UI forms, all you need to do is add a JavaScript Web Resource to the Form. As the new forms don't support JavaScript (in CRM 2011 anyway), once a JavaScript file is added the form will always revert back to the classic forms. Note that even if you open up the form and the process one is displayed and you manually change to the Classic form, even if you save/close and re-open that record later you'll be put back into the new Flow UI form. You can keep changing the form that you use every time you open it up, but if you're 100% sure you don't want to use this form, just add an empty JavaScript Web Resource to the page. Even something as simple as: function nothing() {} Small issue, simple fix, but hopefully this'll save some people a few minutes of time.

Monday, August 5, 2013

Word - Remove Text From Table of Contents

I know this is an MSCRM blog and the first post here is not even remotely MSCRM related, but today is documentation day and when creating documents I'm always losing a ton of time spacing, formatting, and messing with a table of contents.  I was working on a document today where I didn't want to change the style of some text looked but I wanted to remove that text from the table of contents. I didn't find anything from digging around online so I figured I'd make a quick post.

In Word 2010 at least, first click on the text you want removed from the table of contents. Then head over to the References tab, then in the Table of Contents section click on Add Text. Seems strange to me that 'Add Text' is where you'd go to edit things, but there you have it. Then click on 'Do Not Show in Table of Contents' and finally 'Update Table' (Update the entire table) and you're all set.

Make sure the text style didn't change on you, I've seen font sizes get updated when changing from 'Level 2' to 'None' for instance.