Quantcast
Channel: Develop 1 Limited Blog - Ribbon Workbench
Viewing all 31 articles
Browse latest View live

Restore Add Activity buttons in CRM 2013

$
0
0

By default the CRM2013 form Command Bar doesn't show the old 'Add' tab buttons for activities. The intension is that users will want to use the new Activities Tab control on the forms as show below:

In an upgrade from CRM 2011 you may want to preserve the add activity buttons on a form. This post describes how you can easily bring back those add activity buttons using the Ribbon Workbench.

1) Create a solution containing the entities that you wish to restore buttons for. I am using the Account entity for this post.

2) Open the solution containing the Account entity in the Ribbon Workbench for CRM 2013 and select the 'account' entity if not already selected. You will see by default the Command Bar is selected.

3) Select the Ribbon tab to show all the buttons that are defined.

4) Select the 'Form' ribbon using the drop down in the top right corner of the design surface and then select the 'Add' tab. You should now see the CRM 2013 activity buttons.

5) Right click on the phone call button and select 'Customise Command'

6) In the 'Solution Elements' panel expand the 'Commands' node and select 'Edit Display Rules'

7) Select the 'Mscrm.HideOnCommandBar' rule and click 'Remove'. If you do not see this rule, then it is likely that you have forgotten to select the 'Form' ribbon in step 4 above.

8) Click OK and then repeat for each of the add buttons that you want to restore.

9) Since we are not customising the enable/display rules – only the command, expand the Enable Rules and Display Rules node, and for each rule that is prefixed with Mscrm, select and set the 'IsCore' property to 'False'.

Display Rules

  • Mscrm.HideOnCommandBar
  • Mscrm.AddActivityToPrimary
  • Mscrm.WriteActivityPermission

Enable Rules

  • Mscrm.AppendToPrimary
  • Mscrm.FormStateExistingOrReadOnly

10) Click 'Publish' and your form should now show the activity buttons who's command's you customised.

 

@ScottDurow


Ribbon Workbench updated - getServerUrl is removed in CRM2013 UR2

$
0
0

With CRM2013 UR2 being released very soon I have made an update to the Ribbon Workbench that you'll be prompted to install by the auto update when you next open the Ribbon Workbench. I strongly advise you to install this update before you install UR2 otherwise the Ribbon Workbench will no longer work, and you'll need to re-download and re-install.

This is because when I updated the Ribbon Workbench for CRM2013 I retained the use of getServerUrl – the update now uses getClientUrl because UR2 has removed getServerUrl altogether.

getServerUrl was deprecated back in CRM2011 with UR12 so it's probably about time it was removed anyways!

Create a command bar button for your custom activities

$
0
0

When creating a new custom activity entity you are presented with a great many checkboxes to choose from. One of these checkboxes is 'Display in Activities Menus' that will ensure that the activity type is included in the Activities Menu on records

The Custom Activities flyout menu is a dynamically generated menu so that if you load up an entity in the Ribbon Workbench and expand this button you won't see any menu items. This has been the subject for confusion for users who are trying to move this button out of the sub menu and put it on the main Command Bar as a short cut for uses. Since the menu is created dynamically at run time there is no button to customise and move. This post shows you how to create a custom activity button on the opportunity form.

1. Determine the Entity Type Code of your custom activity.
Each custom entity has an Entity Type code. This integer value is different to the entity logical name and could be different on each organization you deploy your solution. We need to know this entity type code in order to create a new record of a specific entity type.

To find the value, create a new record for your custom entity in Internet Explorer and press Ctrl-N (opens a new window with Url visible) and copy the URL. This should look something like:

http://server/Org/main.aspx?etc=10005...

You need to note the etc number for later.

2. Install Ribbon Workbench

You'll need to install the Ribbon Workbench as described by 'Getting started with the Ribbon Workbench'

3. Create and open a solution containing the Opportunity Entity

The Ribbon Workbench requires a solution to load that contains the entities that you wish to work on. Since we are adding the new button to the opportunity entity, add it to the solution – only add the entities you need to speed up the solution load/publish time. When you first open the Ribbon Workbench it will allow you to select your new solution.

4. Click on the 'Ribbon' tab and change drop down in the top right to 'Form'

We need a template command to use and so we select the 'Ribbon' view rather than the Command Bar view so to locate the 'Task' button on the Form ribbon.

5. Select the 'Add' tab and then right click on the 'Task' button and select 'Customise Command'

The Task button is located on the 'Add' tab. Using 'Customise Command' creates a copy of the add task command that we can change to reference our custom acitivty.



6. Expand the Commands node to see the customised command and select 'Mscrm.AddTaskToPrimaryRecord'.
7. Rename the command to be something like 'Mscrm.AddCustomActivityToPrimaryRecord'

By renaming the command we are creating a new command specifically for our new button, rather than customising the existing one.

8. Expand the Command and JavaScript command and change the Int value to be the Entity Type Code of your custom activity

Remember that the entity type code is unique to your custom entity – but it could change between deployments.

9. Right click on the command and select 'Edit Display Rules' and Remove the 'HideOnCommandBar' rule

Since the Task button only shows on the legacy ribbon, we need to change the command so it also shows on the command bar by removing this display rule.

10. Select the 'Command Bar' tab and drag a button onto the Form command bar

11. Set the Command to be your new custom command (e.g. Mscrm.AddCustomActivityToPrimaryRecord)

12. Set the image16 to be /_imgs/ribbon/AddActivity_16.png (or a custom image you have for your entity)

13. Expand the 'Display Rules' and set the 'IsCore' property to 'True' on each Display Rule.

14. Expand the 'Enable Rules' and set the 'IsCore' property to 'True' on each Enable Rule.

By setting the 'IsCore' property to true, we only reference them rather than redefining them.

15. Publish your customisations

16. Test the new button on the opportunity form!

And then there were seven!

$
0
0

If you've updated to the CRM2013 Spring '14 Wave (Service Pack 1) I think you'll agree that it contains some pretty awesome features.

You can read a good roundup of the developer features in the SDK (http://msdn.microsoft.com/en-us/library/gg309589.aspx#BKMK_NewInSpring2014) but have you noticed that there is a little less white space across the top of your forms? This is because the Command Bar now shows 7 rather than 5 buttons before buttons are added to the ellipses overflow.

It is worth noting that the number of buttons that are displayed before the overflow is not (yet?) configurable and nor can you revert back to displaying only 5 (pre SP1). That said, I really appreciate this little change that is a result of the product team listening to feedback from users. What's more it has no impact on the Ribbon Xml or Ribbon Workbench.

You might like to read more about the Command Bar in my post from way back when CRM2013 was first released.

@ScottDurow

Ribbon Workbench 2015 (Happy New Year!)

$
0
0

Happy New Year – I hope 2015 will bring you lots of good things. Dynamics CRM 2015 upgrades are rolling out to Dynamics CRM online organisations with rapidly increasing frequency and so I have updated the Ribbon Workbench for 2015 support. You will see a new update notification when you next open the Ribbon Workbench and you can let the auto update do the download and install for you. If you would rather install manually you can download and install over the top of the previous version.

Automatic update is mandatory after 10th January – why?

You'll have the option to update before the 10th of January and then you'll be forced to update after that. Some people have asked me other the last couple of years why I roll out these mandatory updates. Initially this was about ensuring that the beta version was updated with any bug fixes but since then it has been a way of ensuring that I keep rolling out new version. I set a 6 month release cycle target so that even though I roll out minor updates I have to roll out at least one mandatory update every 6 months! I hope you don't mind being forced to update too much – I certainly feel that the benefits outweigh the downsides and it keeps me on my toes J

Command bar 2015

The good news about the 2015 command bar is that after the big shift from the ribbon in CRM2013 there haven't been any significant changes. All of your ribbon xml customisations in CRM2013 will remain to work in CRM2015 provided that any JavaScript you are calling in your commands doesn't use any deprecated SDK elements. If you compare the RibbonXml XSD between the CRM2013 and CRM2015 SDKs you'll see that they are in fact identical!

All the best for 2015!

@ScottDurow

The cream cracker conundrum (or customising the sub grid command bar)

$
0
0

I still find the streamlined user experience offered by the Command Bar a welcome change from the CRM2011 Ribbon. The sub-grid command bar is the only possible exception with the loss of the ability to add custom sub-grid buttons. There are only at most two buttons on a sub grid – 'Add' and 'Open Associated Sub-Grid'

The user must click on the 'Open associated sub-grid' button to show the full associated view and the full command bar with custom buttons. I say 'possible exception' because in fact there are still the same number of clicks involved (users had to click on the sub grid to show the contextual ribbon before) but it does feel as though we should have the ability to add buttons to the sub-grid command bar. I can think of some good reasons why this design decision may have been made (performance for one!) – but this post details what you CAN do to the sub-grid command bar.

Because the 'Open associated sub-grid' button is a bit of a mouthful, I'll refer to it from now on as the 'cream cracker' because it kind of looks like one and is equally a bit of a mouth full! (Thanks goes to my friends at the British Red Cross who first named it this way!)

Hiding buttons

We have established that you cannot add buttons to the form sub grid, but both the 'Add New' and 'Cream cracker' buttons are customisable in terms of their command and visibility (but you cannot change the image or the tool tip text).

To hide the sub grid buttons you have the following options:

  1. Hiding based on a security role (if the user does not have access to append a record to the parent or create new records of the sub grid type, the 'add new' button will be invisible
  2. Hiding all of the time using a 'Hide Action'
  3. Hiding conditionally using a security role
  4. Hiding conditionally using a custom JavaScript rule.

A common requirement is to hide the Add New button on a sub-gird until a specific criteria is met on the parent form. The standard ValueRule cannot be used because this rule will only work when the command button is added to a form command bar. So to achieve the conditional show/hide we must use a Custom JavaScript Rule.

The first hurdle is to determine which button needs to be customised. The sub grid 'Add New' button calls a different command depending on the nature of the relationship.

If you have a foreign-key attribute on your child entity that is marked as Field Requirement = 'Optional' then the Add New button will be the AddExistingStandard since it allows you to search for an existing record first. If the Field Requirement = 'Business required' then the button will be AddNewStandard

 

 

Once you've identified the right button, you can then open the ribbon workbench and click Customize Command and add the Value Rule as described by my user voice article.

Changing the command actions

Although we cannot add new buttons (did I mention that?!) we can change the command actions that either of those two buttons call. Since we can't customise the button, the only option here is to customise the command and change its behaviour in a very similar way to adding custom enable rules.

  1. Right click the button in the Ribbon Workbench and select Customise Command
  2. Expand the command in the Commands node in the Solution Elements panel and select the command that has been created for you to customise.
  3. Right click Edit Actions and you can simply delete the standard action and add your own custom ones.
  4. Remember to mark all the enable and display rules that you don't want to customise as IsCore=True.

Once such use of this technique is to replace the standard add new button with a custom dialog.

Refreshing the sub grid Command Bar

You will find that when the form is loaded and the sub grid is refreshed for the first time the EnableRules are evaluated. If however the conditions for the EnableRules change (e.g. a value changes on the parent form) the sub grid command bar will not automatically refresh to reflect the new state. Upon adding or deleting rows in the sub grid the command bar is refreshed – but this isn't much use in this case.

The main form command bar can be refreshed using Xrm.Page.ui.refreshRibbon() however this will not refresh sub grid command bars. Instead, we can add an onchange event to the fields that are used in our ValueRule and call:

Xrm.Page.data.save();

This will refresh the sub grids and re-evaluate any of the EnableRules however it will also save any other dirty attributes and so should be used with caution if you do not have auto-save enabled.

Responding to new/deleted rows in the sub grid

Since the sub grid command bar is refreshed when new rows are added or deleted we can use the fact that the EnableRules will be re-evaluated to call custom JavaScript when the sub grid changes. This simulates a sub-gird onchange event and was first described by James Wood's blog post for CRM2011. He states on his blog that this technique doesn't work for CRM2013 – however if we add the custom EnableRule to the existing command (rather than use a new button as James describes) then this technique works well in CRM2013 and CRM2015. So we can customise the command for the Add New or cream cracker and add a Custom JavaScript Enable Rule that always returns true in just the same way that you might use the EnableRule to dynamically show/hide the button but rather we just run our onchange code.

Perhaps in the future there will be more possibilities but for now that about sums up the possibilities for customising the sub grid command bar.

@ScottDurow

Business Rules &“SecLib::RetrievePrivilegeForUser failed - no roles are assigned to user”

$
0
0

When publishing your Ribbon Workbench solution you may receive the following error:

"SecLib::RetrievePrivilegeForUser failed - no roles are assigned to user."

The first step in diagnosing these issues is to try and export the same solution using the CRM solutions area and then immediately re-import to see what error is shown. This is exactly what the Ribbon Workbench does behind the scenes.

When doing this you might see:

Upon Downloading the Log File you'll see that the error occurs on a 'Process' and the same error message is shown as reported by the Ribbon Workbench. The User ID is also given which can be used in a URL similar to the following to find the user record causing the issue.

https://<orgname>.crm.dynamics.com/userdefined/edit.aspx?etc=8&id=%7b<User GUID>%7d

You will most likely discover that this user has been disabled or has no roles assigned – this could be that they have left the company or changed job role. You will need to find any Workflows or Dialogs that are assigned to them and re-assign to yourself before you can import the solution.

In most cases, you should not include Dialogs or Workflows in the solution that is loaded by the Ribbon Workbench since this only slows the download/upload publish process down. There is one exception to this – and that is Business Rules. Business Rules are associated with their particular entity and cannot be excluded from the solution. Oddly like Workflows and Dialogs they also are owned by a user but it is not shown in the user interface – nor is there an option to re-assign. There is a handy option on a user record that allows you to 'Reassign Records'

You would think that this would reassign any Business Rules but unfortunately you'll get the following error:

"Published workflow definition must have non null activation id."

The only way to reassign these Business Rules is to perform an advanced find for Processes of Type 'Definition' and Category 'Business Rule'

The results can then be reassigned to yourself using the 'Assign' button on the results grid.

@ScottDurow

Ribbon Workbench 2016 Beta

$
0
0

A couple of weeks ago I had both the privilege and a most enjoyable hour on CRM Audio chatting with George, Joel and Shawn about the Ribbon Workbench and SparkleXRM. You'll have heard me mention that I'd be posting details on how to get involved with the Beta version of the new Ribbon Workbench 2016 that's written using HTML and JavaScript rather than Silverlight – so here it is!

I've had a fruitful relationship with Silverlight over the years and it has been the enabler in many successful rich client Dynamics CRM customisations but things have moved on! In July 2015 the time had come to say goodbye in part because there was no Silverlight in Windows 10's Edge Browser. My main blocker for writing pure HTML and JavaScript Web Resources in the past had always been one a lack of productivity tooling, but that had moved on as well not least because of SparkleXRM, my framework for building rich user interface Dynamics CRM web resources. The Ribbon Workbench 2016 is written using SparkleXRM (although it comes pre-packaged in the solution) and if I'm honest I think one of my drivers originally for working so hard on that project was the inevitability of having to re-write the Ribbon Workbench in HTML one day. Without the framework it would have been a bridge-too-far, but as it happened I was pleasantly surprised as to how easy the conversion process went and I am really pleased with how it's turned out. Here are some highlights…

Drag and Drop Flyout Editing

Drag and Drop Flyout Editing

Delete Undo

Undo

Drag and Drop Command Editing

Drag Drop Command Editing

Can you help with Beta Testing?

You can download the beta version by signing up to beta test today!

Please report issues and bugs via UserVoice! Thank you!


Ribbon Workbench Version Compatibility

$
0
0

I'm pleased to announce that in addition to the managed solution that you can install inside Dynamics CRM, the Ribbon Workbench 2016 is alsoavailable in the XrmToolbox (if you hadn't already noticed!).

When you open the XrmToolbox you will see that there is the Ribbon Workbench available for download in the plugin store.

Keep checking out the store because tools are being added regularly by some great plugin authors.

Thank you to all those who are helping to beta-test, I have been really encouraged by your comments and suggestions. The re-write of the Ribbon Workbench (to remove its dependency on Silverlight) and the XrmToolbox version has been on my 'to-do' list for much longer than I would have liked and so I'm particularly pleased with this release.

The new Ribbon Workbench 2016 solution installs alongside the older version – so if you have an upgraded org you might get them all sitting there on your command bar. 

I'm keeping there on one of my organisations for posterity but you can safely uninstall older versions without losing any of your customisations.

Here is a version compatibility matrix for users of the older versions:

Name

Ribbon Workbench

Ribbon Workbench 2013

Ribbon Workbench 2016

Icon

Latest Version

1.0.1.9

2.0.1.3

3.0.16

Requires Silverlight?

Yes

Yes

 

XrmToolbox Version?

  

Yes

CRM 2011
(Inc. UR12+)

Supported

  

CRM 2013
(Inc. SP1+)

 

Supported

 

CRM 2015
(Inc. Update 1+)

 

Supported

Supported

CRM 2016
(Inc. Update 1+)

 

 

Supported

Supported

Smart Buttons in the Ribbon Workbench

$
0
0

Happy 2017! This new year promises to be really exciting in the world of Dynamics 365. The spring release is going to be a big one for developers and I'm really looking forwards to it.

In the meantime, I've released a new beta version of the Ribbon Workbench that includes the following features:

  1. Copy and Paste of Commands, Buttons & Enable/Disable Rules
  2. Free text JSON Clipboard – allowing you to see what is on the clipboard and potentially copy/paste between instances and even make text changes before pasting.
  3. Full support for Smart Buttons

You can grab the latest beta of the Ribbon Workbench that support smart buttons from https://www.develop1.net/public/rwb/ribbonworkbench.aspx#DOWNLOAD

Before I go into more detail about the JSON Clipboard, I wanted to tell you about Smart Buttons because I'm really excited about the possibilities that they may bring.

So what are Smart Buttons?

Smart Buttons are a concept I've been toying with since back in the Silverlight days of the Ribbon Workbench. They basically are buttons in the toolbox that add a predefined template of Ribbon Customisations that can be parameterised and contain references to prebuilt JavaScript web resources.

When you add a standard button using the Ribbon Workbench you get to set the label, image and then reference a command that can in turn reference some JavaScript that you create separately.

With a smart button, the JavaScript is already built for you and already installed in your Dynamics 365 organisation. Any solution that contains a smart button pre-build JavaScript must also contains a Smart Button manifest file that tells the Ribbon Workbench what's available and defines the templates it exposes.

A typical uses of Smart Buttons are:

Developers

  1. Install a Smart Button solution in Development Org (e.g. the Develop1 Smart Button Solution described later)
  2. Install Ribbon Workbench in Development Org
  3. Add Smart Button to Development Org using Ribbon Workbench
  4. Deploy Smart Button solution to Pre-Production/Production – The Ribbon Workbench would not need to be installed
  5. Deploy solution from Development (containing smart button configuration)

Lead Developers

  1. Create a standard way of performing certain actions from Ribbon Buttons based on common library code they have created.
  2. Create a smart button manifest webresource and include that in their solution as well.
  3. Instruct Developers to use Smart buttons in the Ribbon Workbench rather than adding ribbon customisations manually.

Third Party ISV's

  1. Create an ISV solution that allows functionality to be invoked in custom entities (I will be publishing a smart button manifest for my network view solution so you can add visualise buttons to any entity).
  2. Rather than publishing instructions on how to add buttons manually, create a smart button manifest that is picked up by the Ribbon Workbench
  3. When installed on the ISV customer's organisation, the Ribbon Workbench scans the organisation for any smart button manifest files and picks up the ISV's custom buttons that are available for use.

I have built a simple Smart Button solution as a preview of this feature that provides the following:

  • Run Report– Allows you to select a report and create a short cut on any record form.
  • Run Workflow– Allows you to select a workflow and create a short cut to run it on a record form or sub-grid. You can also specify a call-back function to call when it is completed so that you can refresh the form or perform some other action. This is one of the most requested items on the Ribbon Workbench's uservoice site.
  • Run Dialog– This is similar to the Run Workflow button but starts a Dialog instead. Useful for creating your own custom 'Close Opportunity' forms.    
  • Quick JS– Sometimes you want to run some simple JavaScript (such as setting a drop down value and saving the form) when you click a command bar button. Quick JS allows you to simply create a button and directly specify the JavaScript without creating a separate Webresource to hold the code.


You can download this preview Smart Button solution and give it a try from github: https://github.com/scottdurow/RibbonWorkbench/releases

Creating your own Smart Buttons!

In the next post I will describe the copy and paste JSON clipboard and how to use this to create a smart button manifest for your own solutions.

 

Ribbon Dependencies in Version 9 – isNaN is no more!

$
0
0

I recently blogged about the introduction of the script dependancies dialog in Version 9 where you can define the scripts that are needed by another. Although it does not solve the asynchronous loading issue for forms, it makes it simpler to add scripts to form since the dependencies will automatically be added for us.

Up until now, there has been a common pattern when adding script to Ribbon Commands where the dependancies were added with a function of 'isNaN'. It didn't have to be isNaN, but that is the most popular 'no operation' function call.

With the introduction of the script dependencies, you only need to include the reference to ClientCommands.js and the ClientCommon.js will be loaded automatically for you first before the command is called.

Awesome – we no longer need the isNaN approach that always felt like a 'hack'.

Viewing all 31 articles
Browse latest View live