CRM 4: Adding tooltips to fields on forms

Posted by on Jul 14, 2009 in CRM 4.0, Customizations, JavaScript |

Tooltips are little help messages explaning a field or label (if you hover over a label you will notice a tooltip), I had a requirenment for adding a tooltip to a custom field with some custom help text.

After some digging through i found out the correct JScript property and method:

crmForm.all.my_custom_attribute_c.title = “Add a value here and it should get automatically populated..”;

End Result:

 

Read More

CRM4: Hiding tabs and sections

Posted by on Jun 17, 2009 in CRM 4.0, Customizations, JavaScript |

Hello all,

I am currently working on a small CRM project and one of the requirements was to hide a section and a tab onLoad.

// Hiding the Contract section

crmForm.all.contractid_c.parentElement.parentElement.style.display=’none';

// Hide the KB article tab (2nd Tab)

crmForm.all.tab1Tab.style.display=’none';

I’m sure you can use this in other ways (i.e:. onChange, onClick etc..).

Happy Coding!

Read More

Call/Request a workflow in CRM 4.0 using Javascript

Posted by on May 25, 2009 in CRM 4.0, Customizations, JavaScript |

  1. Add a button on Form’s Toolbar/Grid’s Menu Bar for the entity in ISV config file (export ISV config)
  2. Call launchOnDemandWorkflowForm (for button on Form) or launchOnDemandWorkflow (for button on grid) functions and pass the parameters sGrid, iObjType and workflowId.
  3. Save the config file and import it to CRM.

An example of this could be:

<Entity name="account">
<ToolBar ValidForCreate="0" ValidForUpdate="1">
<Button Icon="/_imgs/mybutton.jpg" JavaScript="launchOnDemandWorkflowForm('', '10029','{00000000-0000-0000-0000-000000-00000}');" PassParams="1" WinParams="" WinMode="0">
<Titles>
<Title LCID="1033" Text="Send Email" />
</Titles>
<ToolTips>
<ToolTip LCID="1033" Text="Send Welcome Email" />
</ToolTips>
</Button>
</Entity>

Or you can alternatively request it from the web service:

/* the function */
ExecuteWorkflow = function(entityId, workflowId)
{
var xml = "" +
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" +
GenerateAuthenticationHeader() +
" <soap:Body>" +
" <Execute xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" +
" <Request xsi:type=\"ExecuteWorkflowRequest\">" +
" <EntityId>" + entityId + "</EntityId>" +
" <WorkflowId>" + workflowId + "</WorkflowId>" +
" </Request>" +
" </Execute>" +
" </soap:Body>" +
"</soap:Envelope>" +
"";
var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xmlHttpRequest.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/Execute");
xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
xmlHttpRequest.send(xml);
var resultXml = xmlHttpRequest.responseXML;
return(resultXml.xml);
}

// call the workflow
var theWorkflowId = "3FD2DD58-4708-43D7-A21B-F0F90A0AA9F2"; //change to your workflow Id
ExecuteWorkflow(crmForm.ObjectId, theWorkflowId);

Read More

Add a Button to a Form

Posted by on May 23, 2009 in CRM 4.0, Customizations, JavaScript |

This post is to show how to add a Button to a MS CRM Form, not to the Navigation Pane nor to the Menu Bar, but to the actual Form itself.
In this post I will show a simple usage of the Button, to show its function. You can understand that more advanced functions can be triggered by the button, but that’s not the aim of this post.For this example I have used the default Contact Form. The Address Section is hidden onLoad and a Button is shown.

Button on Form

By Clicking on the Button the Section with the Address Details is shown again. In this example the Button Disappears, because it has no use anymore. (I could have added a function to hide the section again).

Button on Form2

To achieve the above I have created a new Section with a new Attribute (new_button).

Button on Form3

Next to that I placed the following Script in the onLoad of the Form:

Update: 9th March 2010 – updated code blocks – wordpress broke the code!

Read More

CRM 4.0: Notes Count on any Entity

Posted by on May 20, 2009 in CRM 4.0, Customizations, JavaScript |

NotesCount is a client side JScript customization, which enables CRM useres to recognize the amount of attached notes or attachments to any CRM record (e.g. contact, account, case, …) within the tab on top of the main form of the record.
Intention
NotesCount is intended to improve the UX of all Microsoft Dynamics CRM 4.0 users. By showing the amount of attached notes or files referenced to CRM records without opening the notes tab it will reduce the risk to miss important information.

screenshot 

More info & Download: http://notescount.codeplex.com/

Read More
%d bloggers like this: