Using the MS CRM Onload event to retrieve online, live company information
Companies House Field
The job I did was to create a Companies House field for the Account record by Customising the Account Entity.
To do this Go to Customization > Customize Entities > Accounts > Attributes and create a new Attribute called "Companies House No" (new_companieshouseno). And then add this field to the standard Account form. Under the Entity:Account click on "Forms and Views" and edit "Form" and use the tools to plop your new field onto the Form.
Fill the IFRAME properties as per shown in the picture leaving the URL as "about:blank" (we'll be filling in the correct url using the Onload event next!).
The Onload Event
To edit the Onload event you need to click on Form Properties, select Onload and click "Edit".
- Retrieved the value of the Companies House No field.
- Appended it to a MINT url.
- Passed the url to the IFRAME
The IFRAME then loads the MINT Company Information page when the Account opens and if a Company Number is not passed it defaults to a MINT search page.
The script I use is as follows:
var CRM_FORM_TYPE_UPDATE = 2;
// Only attempt to retrieve the MINT information on Update and when Online
if (IsOnline())
{
if (crmForm.FormType == CRM_FORM_TYPE_UPDATE)
{
// put the Companies House number into a variable
var CompanyNo=crmForm.all.new_companieshouseno.DataValue;
// append the variable to the MINT url, note the url contains xxxxxx for username and password, obviously i'm not going reveal my mint account details ;o)
var URL='https://mintuk.bvdep.com/Search.DirectCompanyName.serv?product=Mint&tpl=reportframe&stack=1&Kick=1&user=xxxxxx&pw=xxxxxx&&companyId=' + CompanyNo;
// pass the URL to the IFRAME
crmForm.all.IFRAME_Mint_Info.src=URL;
}}
And the result is as follows (note I have also a dedicated TAB for my MINT stuff):
0 Comments:
Post a Comment
<< Home