Bench Update with Offline Tools

I’ve updated Woodswork Bench. Along with some visual stuff, it now also hosts my offline tools:

bench

  • Simplicity; built for Microsoft Dynamics CRM 2011 this tool provides Guid Mining, and URL Building services.
  • Determination; a light weight IronPython scripting tool specifically setup for Microsoft Dynamics 2011, however it suitable for use with any .Net assemblies and MSCRM version.

Check it out here.

Announcing Bench

I am happy to announce today the release of Woodswork Bench. Woodswork Bench is my latest personal project which provides a number of tools for the Microsoft Dynamics CRM community.

bench

Bench is a website which contains a collection of web based tools for working with Microsoft Dynamics CRM. These tools provide easy solutions to common MSCRM challenges. The initial release includes the following functionality:

  • Build URLs to open MSCRM forms.
  • Build URLs to open MSCRM views.
  • Finds the Guids hidden in MSCRM URLs.
  • Encoding and decoding of text.

Check it out here http://bench.woodswork.co.uk/.

I’m a relationship, I’m not a many to many, I’m not a lookup, what am I?

CRM has a two types of relationships:

  • One to many: a lookup on one entity, a grid on the other.
  • Many to many: a grid on both entities.

You are looking at a lookup. 90% of the lookups you see are simple, you can select one record of one entity type.

However, there are special system field lookups, namely the activity party. These muddy the waters a little. Some activity party lookups allow multiple record selections, some link to entities of multiple types. Which means you can have an activity party lookup with multiple records of multiple entity types. I suppose you could call this a “one to many (records) of many (entities)”.

For example on an email; the To field can be populated with multiple account and contact records. Whilst the From field can only have one record, but that can be a system user or queue. The To and From are both examples of activity party lookups.

To tell the difference programmatically you can use a RetrieveAttributeRequest. AttributeType shows if its an activity party, whilst Targets allows you see what record types are allowed in the lookup.

The following code shows how to do this for a couple of different fields.


RetrieveAttributeRequest attributeRequest = new RetrieveAttributeRequest
{
EntityLogicalName = "email",
LogicalName = "to",
RetrieveAsIfPublished = true
};

RetrieveAttributeResponse result = Service.Execute(attributeRequest) as RetrieveAttributeResponse;

Trace.WriteLine("Email - To");
Trace.WriteLine("AttributeMetadata.AttributeType: " + result.AttributeMetadata.AttributeType);
Trace.WriteLine("LookupAttributeMetadata.Targets: " + ((LookupAttributeMetadata)result.AttributeMetadata).Targets.CollectionToString(", "));

attributeRequest = new RetrieveAttributeRequest
{
EntityLogicalName = "email",
LogicalName = "from",
RetrieveAsIfPublished = true
};

result = Service.Execute(attributeRequest) as RetrieveAttributeResponse;

Trace.WriteLine("Email - From");
Trace.WriteLine("AttributeMetadata.AttributeType: " + result.AttributeMetadata.AttributeType);
Trace.WriteLine("LookupAttributeMetadata.Targets: " + ((LookupAttributeMetadata)result.AttributeMetadata).Targets.CollectionToString(", "));

attributeRequest = new RetrieveAttributeRequest
{
EntityLogicalName = "account",
LogicalName = "parentaccountid",
RetrieveAsIfPublished = true
};

result = Service.Execute(attributeRequest) as RetrieveAttributeResponse;

Which outputs:

Email – To
AttributeMetadata.AttributeType: PartyList
LookupAttributeMetadata.Targets: account, contact, lead, queue, systemuser

Email – From
AttributeMetadata.AttributeType: PartyList
LookupAttributeMetadata.Targets: queue, systemuser

Account – Parent Account Id
AttributeMetadata.AttributeType: Lookup
LookupAttributeMetadata.Targets: account

Originally posted on StackExchange here.

Using the CRM Audit Log to Rollback Records

Argh! Someone has done something and something is ruined! Fortunately someone only changed records in CRM, and even better audit logging was enabled. You can now use the web service SDK to analyse changes that have occurred, you can then use this information to perform the opposite action and roll back changes.

Continue reading

CRM 2015 Building Action Links (or how a URL can change records in CRM)

I was looking for an easy way to allow a user to perform an action in CRM by opening a hyper link. The idea being the URL can be embedded in an email, SMS, or anything else, and simply opening the URL allows the user to perform an action in CRM (without having to actually use the full CRM interface).

I cobbled together this proof of concept which chains together a couple of components to create an “Action Link”.

aciton url process

Continue reading

CRM 2013 Adding an On Change Event to a Grid View

Occasionally I’ve been asked how to add an on change event to a grid view, similar to an on load or save event, which will allow a developer to add some code to the page. As far as I know there is no “out of the box” supported way to do this, however I had a bit of brain wave this week and realised its possible with a ribbon (command) button (without using any unsupported customisations).

Capture

Continue reading