CRM – Business Process flows and JavaScript

Microsoft describe the logic for business process flows here. As I’ve been working with business process flows recently I thought I would do a quick post explaining how to access all of the parts of a business process flow. You use “Xrm.Page.ui.process” to access the business process flows. Then “getActiveProcess” returns an object containing the…

Open Quick Create or Entity Forms From JavaScript

Recently I needed to have some ribbon buttons that would trigger opening both standard and quick create forms. The snippets below show the required syntax. To open a main form for an entity use …… var parameters = { }; parameters[“aField”] = aVariable; parameters[“bfield”] = bVariable; etc etc etc…. Xrm.Utility.openEntityForm(“anyEntityName”, null, parameters); To open a…

JavaScript – Get Activity Party List

Following on from an earlier post that explained how to set an activity party list, here is some JavaScript to show how to get an activity party list. getParty(“to”); function getParty(fieldName) { var party = Xrm.Page.getAttribute(fieldName); var members = party.getValue(); for (var i = 0; i < members.length; i++) { // Contact if (members[i].type ==…

JavaScript – Set Activity Party

I seem to have a theme of JavaScript posts this week! Maybe because I’m having “fun” doing some coding ….. anyway here is a simple snippet you might find useful. This function can be used to set an activity party field. Such as “to” or “from” on a phone call. Simply pass in the field…

JavaScript – Set optionset values by name

A simple but hopefully useful JavaScript function. Pass the name of an option set (pick list) and text value to set the value based on the text. For example; SetOptionSet(“new_country”, “England”); // *** FUNCTION: SetOptionSet // *** PARAMS: // *** fieldName = The name of the optionset field // *** setText = The text to…

Javascript – Birthday

This is hopefully a useful javascript snippet. Sometimes capturing a contacts date of birth is important often this is because certain products are age specific. For example you might not be able to take a life insurance product above a certain age or some products might mean you need to be 18+ to purchase. In these circumstances the operator actually…

Javascript – Get Value for ANY control

Here is a simple but hopefully useful javascript function ….. The syntax differs slightly on code needed to grab the text value of a field depending on its type. Here is a little function I have often used to make your code easier to read and removes the need to worry about the type of fields.…