CRM 2011: Is that plugin step firing at all?

Here’s a quick and easy tip from our Microsoft PFE, Daren Turner. Let’s say you have a plugin step and that for some reason you’re not able to determine if it’s actually firing off or not. How can you confirm this, without changing code? Easy.

Using the plugin registration tool, go to the plugin step you’re working with and set it to run asynchronously.

async

 

Now, when (and if) it executes, you should be able to see it in the System Jobs grid, and if it was successful or not. There’s a limitation to this, though: You can only do this with Post-Operation steps, because by setting it to asynchronous, you’re in fact turning it into a workflow of sorts.

I hope this helps you out in debugging tricky plugins. Have fun!

 

 

Advertisements
Tagged , , , ,

CRM 2011: Who is really running that child process?

We have recently modified a process where the workflow has to check for a particular time range (done through a custom activity) and if the time at the moment is within the range being checked, the process waits for 30 minutes. At the end of those 30 minutes, it submits itself as a child workflow.

This worked as expected, but we ran into an issue: The remainder of the process needs the user identity to correctly process the entity information. When the process runs normally without the wait timeout, there are no issues. But when it falls in the timeout, and then submits itself as the child workflow, the user identity is changed to that of the workflow owner.

That means that if the owner of the process is, say, your local friendly IT guy, that’s who CRM thinks is running the process, and thus any user-based validations will fail.

The solution for this was to have code in the custom activity that looks for the creator of the entity, and then use that as the user ID needed to execute the user identity-related code. How? We created a function for retrieving the entity owner, and we pass the primary entity ID, as follows:

GetEntityOwner(WorkflowContext.PrimaryEntityId)

This is the code that returns the owner information, and we take it from there:

private Guid GetEntityOwner(Guid entityId)
{
    var myEntity = OrganizationService.Retrieve("new_myentity", entityId, new ColumnSet("createdby"));
    var ownerReference = myEntity.GetAttributeValue<EntityReference>("createdby");
 
    return ownerReference.Id;
}

That fixed the problem and now we get the correct owner for the process to finish successfully.

Have fun!

Tagged , , , , , , ,

USD: How to use a toolbar for quick in-form navigation

One of the nice features in the UI for CRM 2011 is the left-hand side navigation. It allows you to move quickly through your form, based on the tabs you’ve defined. Unfortunately there is no such thing in CRM 2013. There are a few hacks out there that mess with the page CSS to get pseudo-toolbars working, all unsupported.

If you’re using the Unified Service Desk, there’s a solution for this by using the Toolbar controls.

The first step is to create an Action Call record for every tab you wish to navigate to. You configure the action call in the following manner:

action calls

  • Name – The name for this action call. It’s basically free-format, so try to write in something that’s easy to identify and makes sense.
  • Order – This is optional and can be left blank.
  • Hosted Control – The control that will hold the form we’re working with.
  • Action – This must be set to RunXrmCommand.
  • Data – Here you will write the Xrm code needed for navigating to the tab as follows:
Xrm.Page.ui.tabs.get("YOUR_TAB_NAME").setFocus();
Xrm.Page.ui.tabs.get("YOUR_TAB_NAME").setDisplayState("expanded");

The first line sets the focus onto the tab, and the second line makes sure it’s expanded in case you’ve set it to be collapsed by default.

Now that your action call is set up properly, let’s create the button for the toolbar. You don’t have a toolbar, you say? No problem. Here’s how you create one. Go to Toolbars in the Unified Service Desk settings and create a new one:
new toolbar

  • Name – This can be anything, so make it meaningful!
  • Title – Optional. If typed in, it will show a title for the toolbar on its left-hand side.

Save the record. Now we need to associate the toolbar with the hosted control it will reside in. To do so, click on the menu to the right of the toolbar name, and select Hosted Controls:

hostedcontrols

On the next screen, just add the appropriate hosted control to the sub-grid, and save.

attach_toolbar_to_control

Now we can add our action. Once saved, click on the plus sign above the sub-grid to add an existing record. Search for it, and add a new button record:

toolbar button

  • Name – The name for this button. It can be anything.
  • Image – If you have an image for the button, you put the web resource name here.
  • Button Text – This is the actual text shown on screen. Keep it brief.
  • Tooltip – Any additional description you want on hover, you can input here.
  • Order – The order in which the button will be displayed on the toolbar.
  • Show Tab – The hosted control that will be showing this toolbar.

Once you save the record, you can click the plus sign to either create a new action call, or add an existing action call. In our case, just add the action call we created above and save the toolbar. That’s all you need! Remember that if you’re using a configuration file, you need to add all these elements — the toolbar and the action call — to the configuration, otherwise it won’t run properly.

Hopefully this will make life way easier for your users and will allow them to quickly zero in on the information they need. Have fun!

Tagged , , , ,

USD: More information about handling popups

A quick post to let you know about a couple of new things I found about today while working with popping up tabs inside sessions. First, to get an entity record to pop up in a new tab from a flyout menu, you have to use the Popup option in the Route Type fields when defining the navigation rule, otherwise the new entity will appear in the current tab:

pop-up_pop-up

 

In addition to this, if you’re working with Configuration entities, make sure you add all the related elements needed for the pop-up into the appropriate configuration files. That means you have to include the Entity, Hosted Control, and Navigation Rule entity records. Failing to do this will prevent the pop-up action to execute successfully, again opening the window inside the tab you’re currently in.

Have fun!

Tagged , , , ,

USD: Pop-up route tabs from web resources

This one eluded me for a while, but we finally found the answer, thanks to our fantastic Microsoft FSE, Daren Turner, who writes for the MSDN blog Dynamics CRM In The Field.

We needed to fire a new route tab from a web resource. A route tab is one that “lives” under a session tab. To give you an example, in our case the session is based on the Contact, and the route tab we wanted to open is for an account related to that contact.

To get this working, the first thing you need to do is to create a Hosted Control for the entity, if you don’t already have it. Here’s a sample of a hosted control:

hosted-control

Once the hosted control is defined, you need to create the Navigation Rule to handle the pop-up routing. This is where I spun my wheels, but first let me show you how it’s supposed to be created:

nav rule

You see Route Type? There’s an option there for Popup. Don’t select that one, even though it would seem to be the appropriate one. Use In Place as shown above. That will allow the USD to handle the routing inside the session. Also, both the Target Tab  and the Show Tab values should point to the previously created hosted control.

One more thing: You need to define an Entity Type if it doesn’t already exists. This is very straightforward and just requires one value, which is the entity logical name.

That’s it!

Now I got my pop-ups inside my sessions and I couldn’t be happier. Have fun!

Tagged , , , ,

USD: Keeping the Session Navigator open by default

Here’s an easy tip: If you want the Session Navigator (that’s the navigation area on the left-hand side of the screen) to remain open by default, just head to the Custom Panel hosted control, and look for this line:

<Expander Grid.Column="0" Style="{DynamicResource StretchExpanderStyle}"
ExpandDirection="Left" x:Name="ExpanderSessionDetails"
IsExpanded="false" BorderBrush="White" >

And change isExpanded from “false” to “true”. That’s it! Now your Session Navigator will open by default.

Tagged , , , , , ,

The Unified Service Desk, a.k.a. how to desktop-ify CRM 2013

This is the start of what could be a long, interesting adventure.

We all know that the navigation style in CRM 2013 is, well…rather awkward. When you have hundreds of users that are accustomed to the more direct and efficient navigation in CRM 2011, there’s a point where you have to start evaluating alternatives and ways to make it easier for your users. Even though there will always be some shock caused by the UI and appearance changes, anything that can soften the blow is quite welcome.

Enter the Unified Service Desk!

In our particular case, users were accustomed to using the tabbed browser environment. The heavy-yet-organized use of tabs in the USD seems to be a good alternative to consider. The UI, although some might find it “dated”, is definitely better for keyboard-and-mouse interactions than the touch-optimized design of CRM 2013. In addition, it’s a fully-supported way of tweaking CRM, and that should give us (and management!) some peace of mind.

In the following weeks I will be working with the USD and will be posting any interesting tidbits and findings on how to implement your current solution through the USD. I will try to show as much as possible, but bear in mind that since I work in a financial institution, the possibilty of screenshots might be a bit limited.

Nevertheless, I will try to be as clear as possible without getting boring. Hopefully.

Enjoy the trip!