http://www.microsoft.com/download/en/details.aspx?id=24004
Cheers,
I was working on a requirement to display a readonly field on a form and it should open a record if clicked. This can be achieved by adding a text field and then converting it to link button. It can be done by calling below function. Test Account is the link button added to account form.
google.com can be replaced by CRM record url.
function ConvertToLink(fldName) {
var btn = "<a href='javascript: void(0);' onclick=\"window.open(\'http://www.google.com\', \'windowname1\', \'width=600, height=650\'); return false;\" style='color:blue;text-decoration:underline !important'>Test Account</a>";
var ctrl = Xrm.Page.ui.controls.get(fldName)._control;
// Add the new button
ctrl.get_element().innerHTML += btn;
// Hide the textbox
ctrl.get_element().firstChild.style.display = 'none';
}
You can refer this for more details on similar customization.
Happy JS,
CRM 2011 allows creating multiple relationship between 2 entities. In our implementation, I created primary contact and secondary contact lookup attributes on account entity. It works fine when we create an account and then associate primary & secondary contact to it.
The problem occurs when I tried creating it from left navigation link of accounts from contact entity. It set both primary & secondary contact to current contact which is not desirable. One just need to set primary or secondary at any given point of time. In my case, I need a primary contact.
I did it using following lines of code.
var FORM_TYPE_CREATE = 1;
var formType = Xrm.Page.ui.getFormType();
if (formType == FORM_TYPE_CREATE) {
Xrm.Page.getAttribute('new_secondarycontact').setValue(null);
}
Hope it will be useful to you.
Happy Coding,
I was working on requirement where accounts and contacts having n:n relationship. N:N related contacts are being displayed company contacts. There is also active contact lookup field on account form i.e. account 1:n contact related.
I wanted to display only contacts those are related to current account in lookup view. Here is how I achieved this.
function customLookview() {
// generate new guid and specify here
var viewId = "{7595F4DA-6340-492A-BBA8-0E87A7CC532C}";
// Set the entity name
var entityName = "contact";
//Associated company contacts
var viewDisplayName = "Associated Company Contacts";
var accountId = Xrm.Page.data.entity.getId();
//fetch xml to get related contacts
var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>" +
"<entity name='contact'>" +
"<attribute name='fullname' />" +
"<attribute name='telephone1' />" +
"<attribute name='emailaddress1' />" +
"<attribute name='jobtitle' />" +
"<attribute name='fax' />" +
"<attribute name='address1_postalcode' />" +
"<attribute name='address1_line1' />" +
"<attribute name='address1_stateorprovince' />" +
"<attribute name='address1_country' />" +
"<attribute name='address1_city' />" +
"<attribute name='mobilephone' />" +
"<attribute name='contactid' />" +
"<order attribute='fullname' descending='false' />" +
"<link-entity name='new_contact_account' from='contactid' to='contactid' alias='aa'>" +
"<filter type='and'>" +
"<condition attribute='accountid' operator='eq' value='" + accountId + "' />" +
"</filter>" +
"</link-entity>" +
"</entity>" +
"</fetch>";
//grid xml for formatting view
var layoutXml = "<grid name='resultset' object='2' jump='fullname' select='1' icon='1' preview='1'>" +
"<row name='result' id='contactid'>" +
"<cell name='fullname' width='300' />" +
"<cell name='emailaddress1' width='150' />" +
"<cell name='parentcustomerid' width='150' />" +
"<cell name='telephone1' width='125' />" +
"</row>" +
"</grid>";
// specify the schemaname of the lookup control
var lookupControl = Xrm.Page.ui.controls.get('new_coborrowerid');
// set the parameters
lookupControl.addCustomView(viewId, entityName, viewDisplayName, fetchXml, layoutXml, true);
}
Thanks to Nishant for this post -
http://nishantrana.wordpress.com/2010/12/31/filtered-lookup-in-crm-2011/Happy Coding,
Below are the steps to add new Plugin assembly and plug-in steps –
1. Open the solution –> Go to Plug-in Assemblies –> Click Add Existing assemblies from grid –> It will display below popup, select assembly and click ok.-> Should see the plugin in Plugin assemblies grid
2. Open Sdk Message Processing from Solution –> Click on Add Existing –> It will open below popup –> select the steps for specific plugin and click ok.-> should see the Sdk plugin in grid
Happy Coding,