Zoeken in deze blog

maandag 25 mei 2009

Pagina full-screen

window.moveTo(0,0);
window.resizeTo(screen.availWidth, screen.availHeight);

donderdag 7 mei 2009

dinsdag 5 mei 2009

IFRAME N:N

if(crmForm.FormType != 1)
{
function OnCrmPageLoad()
{
/* Create a ne N2NViewer and give it the IFRAME (container) id */
var n2nViewer = new N2NViewer('IFRAME_account_association');
/* Set the role order - use iedevtoolber for exact parameters */
n2nViewer.RoleOrder = 1;
/* assing the relationship name */
n2nViewer.TabsetId = "gi_account_account";
/* Do the trick... */
n2nViewer.Load();
}
function N2NViewer(iframeId)
{
if (!document.all[iframeId])
{
alert(iframeId + " is missing!");
return;
}
var viewer = this;
var _locAssocObj = null;
viewer.IFRAME = document.all[iframeId];
viewer.RoleOrder;
viewer.TabsetId;
viewer.Load = function()
{
/* Construct a valid N2N IFRAME url */
viewer.IFRAME.src = "areas.aspx?oId=" + crmForm.ObjectId + "&oType=" + crmForm.ObjectTypeCode + "&security=" + crmFormSubmit.crmFormSubmitSecurity.value + "&roleOrd=" + viewer.RoleOrder + "&tabSet=" + viewer.TabsetId;
viewer.IFRAME.onreadystatechange = viewer.StateChanged;
}
viewer.StateChanged = function()
{
if (viewer.IFRAME.readyState != 'complete')
{
return;
}
var iframeDoc = viewer.IFRAME.contentWindow.document;
/* Reomve scrolling space */
iframeDoc.body.scroll = "no";
/* Remove crmGrid Default padding */
iframeDoc.body.childNodes[0].rows[0].cells[0].style.padding = 0;
/* Save MS locAssocObj */
_locAssocObj = locAssocObj;
/* Override MS locAssocObj */
locAssocObj = viewer.locAssocObj;
}
viewer.locAssocObj = function(iType , sSubType, sAssociationName, iRoleOrdinal)
{
/* Open the Dialog */
_locAssocObj(iType , sSubType, sAssociationName, iRoleOrdinal);
/* Refresh only if our iframe contains the correnct tabset name */
if (sAssociationName == viewer.TabsetId)
{
viewer.IFRAME.contentWindow.document.all.crmGrid.Refresh();
}
}
}
//Entry Point
OnCrmPageLoad();
}

Verwijderen van de button “Bestaande ……toevoegen”

//Hiden button
HideAssociatedViewButtons('cov_contact_cov_outlooksynchronisatie', ['Bestaande Outlook synchronisatie toevoegen aan deze record']);

function HideAssociatedViewButtons(loadAreaId, buttonTitles)
{
var navElement = document.getElementById('nav_' + loadAreaId);
if (navElement != null)
{
navElement.onclick = function LoadAreaOverride() {
// Call the original CRM method to launch the navigation link and create area iFrame
loadArea(loadAreaId);
HideViewButtons(document.getElementById(loadAreaId + 'Frame'), buttonTitles);
}
}
}

function HideViewButtons(Iframe, buttonTitles)
{
if (Iframe != null ) {
Iframe.onreadystatechange = function HideTitledButtons()
{
if (Iframe.readyState == 'complete')
{
var iFrame = frames[window.event.srcElement.id];
var liElements = iFrame.document.getElementsByTagName('li');

for (var j = 0; j < buttonTitles.length; j++)
{
for (var i = 0; i < liElements.length; i++)
{
if (liElements[i].getAttribute('title') == buttonTitles[j])
{
liElements[i].style.display = 'none';
break;
}
}
}
}
}
}
}

Let op: het blauwe gedeelte is de aanverwante entiteit. Het rode gedeelte is de titel van de knop. Deze kun je o.a. achterhalen met de IE-Developer toolbar.

maandag 4 mei 2009

Twee lookup-fields koppelen

In de OnLoad:

//FILTEREN VAN CONTACTPERSONEN O.B.V. KLANTID
ContactpersonFilter = function()
{
if(crmForm.all.cov_bedrijfid.DataValue != null)
{
crmForm.all.customerid.lookupbrowse = 1;
crmForm.all.customerid.additionalparams = "search=<fetch mapping='logical'><entity name='contact'><all-attributes /><filter type='and'><condition attribute='parentcustomerid' operator='eq' value='" + crmForm.all.cov_bedrijfid.DataValue[0].id + "'/></filter></entity></fetch>";
}
}
ContactpersonFilter()

In de OnChange:

//LEEGMAKEN CONTACTPERSOON BIJ WIJZIGEN BEDRIJFSID
crmForm.all.customerid.DataValue = null;

//FILTEREN VAN CONTACTPERSONEN O.B.V. KLANTID
ContactpersonFilter();

IFRAME 1:N

if(crmForm.FormType != 1)
{
function OnCrmPageLoad()
{
/* Create a N2NViewer and give it the IFRAME (container) id */
var n2nViewer = new N2NViewer('IFRAME_Test');
/* assing the relationship name */
n2nViewer.TabsetId = "new_account_new_test";
/* Do the trick... */
n2nViewer.Load();
}
function N2NViewer(iframeId)
{
if (!document.all[iframeId])
{
alert(iframeId + " is missing!");
return;
}
var viewer = this;
var _locAssocObj = null;
viewer.IFRAME = document.all[iframeId];
viewer.RoleOrder;
viewer.TabsetId;
viewer.Load = function()
{
/* Construct a valid IFRAME url */
viewer.IFRAME.src = "areas.aspx?oId=" + crmForm.ObjectId + "&oType=" + crmForm.ObjectTypeCode + "&security=" + crmFormSubmit.crmFormSubmitSecurity.value + "&tabSet=" + viewer.TabsetId;
viewer.IFRAME.onreadystatechange = viewer.StateChanged;
}
viewer.StateChanged = function()
{
if (viewer.IFRAME.readyState != 'complete')
{
return;
}
var iframeDoc = viewer.IFRAME.contentWindow.document;
/* Remove scrolling space */
iframeDoc.body.scroll = "no";
/* Remove crmGrid Default padding */
iframeDoc.body.childNodes[0].rows[0].cells[0].style.padding = 0;
/* Save MS locAssocObj */
_locAssocObj = locAssocObj;
/* Override MS locAssocObj */
locAssocObj = viewer.locAssocObj;
}
viewer.locAssocObj = function(iType , sSubType, sAssociationName, iRoleOrdinal)
{
/* Open the Dialog */
_locAssocObj(iType , sSubType, sAssociationName, iRoleOrdinal);
}
}
crmForm.all.IFRAME_Test.setAttribute("isArea",1);

//Entry Point
OnCrmPageLoad();
}