Remove Click-To-Call Hyperlink / Remove hyperlink of phone number and email address field in CRM 2013/ CRM 2015
By editing form customization you can remove
hyperlinks for phone fields and email fields.
Export
Contact/ Lead/ Account entity. In customization xml locate form definition,
locate field you want to remove hyperlink.
Export Contact/ Lead/ Account
entity. In customization xml locate form definition, locate field you want to
remove hyperlink.
Then Change classid of field with calssid of
any varchar/ text fie
ld on form. (in above sa_preferredphone is text field. I updated
emailaddress1 classid with classid of sa_preferredphone.)
Import and then publish will remove hyperlink
of email address1
Note:
This will remove hyperlink on forms as you are modifying form definition, it
will enforce CRM validations like email and phone number format.
If you
want to remove validations too then you will have to update format of that
attribute in customizations. Changing format from email/ phone to text will
remove all validations and hyperlinks on that field.
Set CRM IFrame Url Dynamically to aspx page /
Post data to CRM IFrame aspx page / Get Response from aspx page in CRM IFrame –
CRM 2015 / CRM 2013/ 2011
CRM Js
// In following example on page load am binding iframe url
dynamically and calling aspx page. On save, posting data to aspx page to
perform some operation. On success am saving crm from data.
var dbWaiting;
function onLoad() { dbWaiting = true;
// Set IFrame URL dynamically to aspx page / service. var databaseRecordIDField =
Xrm.Page.getAttribute('sa_databaserecordid'); var o = document.getElementById('IFRAME_TemplateBody');
if (o != null) {
o.src = 'https://server.com/emailclient/template?id=' + databaseRecordIDField.getValue(); } if (o != null) { IFrame.setSrc(o.src); } else { var IFrame =
Xrm.Page.ui.controls.get("IFRAME_TemplateBody"); IFrame.setSrc('https://server.com/emailclient/template?id=' + databaseRecordIDField.getValue()); } // Add event listener to get response back from aspx page
/ service if (window.addEventListner) { window.parent.addEventListener("message", receiveMessage, false); window.addEventListener("message", receiveMessage, false);
if (dbWaiting == true) { ExecutionObj.getEventArgs().preventDefault(); var databaseRecordIDField =
Xrm.Page.getAttribute('sa_databaserecordid'); var o = document.getElementById('IFRAME_TemplateBody');
// Data/ Json object to pass to aspx page/ service var pass_data = { 'name':
Xrm.Page.getAttribute('sa_name').getValue(), 'id': Xrm.Page.getAttribute('sa_databaserecordid').getValue(), 'action': 'saveRequestedFromCRM', };
// Post
data to aspx page/ service, you will get response back in receiveMessage
if (o != null) { o.contentWindow.postMessage(JSON.stringify(pass_data), 'https://server.com/emailclient/template?id=' + databaseRecordIDField.getValue()); } else { Xrm.Page.ui.controls.get("IFRAME_TemplateBody").getObject().contentWindow.postMessage(JSON.stringify(pass_data),
'https://server.com/emailclient/template?id=' + databaseRecordIDField.getValue()); } } }
function
receiveMessage(event) {
dbWaiting = false; if (event.data === 'error') { alert('An error occurred, could not save.Please make sure the {{Body}} tag is
included. '); } else { // You can read response object in to event.data Xrm.Page.data.entity.save(); } }
Refresh or Reload CRM IFRAME / Pass data to CRM
IFRAME from CRM form – CRM 2015 / CRM 2013
// For Posting / Passing data to IFrame, you can call following
line on CRM form event. Following line will send/ post data to iframe and you
can access data in receiveMessage event on html
page in iframe.
<html> <head> <title></title> <scripttype="text/javascript"src="sa_jQuery"></script> <scripttype="text/javascript"src="sa_JSON"></script> <scripttype="text/javascript"src="sa_XrmServiceToolkit.js"></script> <scriptsrc="ClientGlobalContext.js.aspx"></script> <scripttype="text/javascript"> function receiveMessage(e) { // You can fetch data that you have posed in "e" //Refresh/ Reload data here