<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>crm.atechnisch.nl &#187; related entity</title>
	<atom:link href="http://crm.atechnisch.nl/tag/related-entity/feed/" rel="self" type="application/rss+xml" />
	<link>http://crm.atechnisch.nl</link>
	<description>How to improve Microsoft Dynamics CRM</description>
	<lastBuildDate>Wed, 25 Nov 2009 08:12:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Mandatory Related Entities</title>
		<link>http://crm.atechnisch.nl/2008/01/mandatory-related-entities/</link>
		<comments>http://crm.atechnisch.nl/2008/01/mandatory-related-entities/#comments</comments>
		<pubDate>Fri, 25 Jan 2008 15:08:03 +0000</pubDate>
		<dc:creator>Huib Aarts</dc:creator>
				<category><![CDATA[Client Side Scripting]]></category>
		<category><![CDATA[MS CRM 3.0 Application]]></category>
		<category><![CDATA[MS CRM 3.0 Customizations]]></category>
		<category><![CDATA[MS CRM 4.0 Application]]></category>
		<category><![CDATA[MS CRM 4.0 Customizations]]></category>
		<category><![CDATA[disable save and close]]></category>
		<category><![CDATA[related entity]]></category>

		<guid isPermaLink="false">http://crm.atechnisch.nl/2008/01/25/mandatory-related-entities/</guid>
		<description><![CDATA[In line with the previous post we had a situation with a related entity in an iFrame on the form.
Before the form is saved the first time the iFrame will not show up.
It should not be possible to use the &#8220;Save and Close&#8221; before the form has been saved for the first time to make [...]]]></description>
			<content:encoded><![CDATA[<p>In line with the previous post we had a situation with a related entity in an iFrame on the form.<br />
Before the form is saved the first time the iFrame will not show up.<br />
It should not be possible to use the &#8220;Save and Close&#8221; before the form has been saved for the first time to make sure the users are always confronted with the iFrame.<br />
The &#8220;Save and Close&#8221; button will only be available if the iFrame is shown.<br />
To do this we have to <strong>disable the close from the &#8220;Save and Close&#8221;</strong> commando if the form is saved for the first time.</p>
<pre class="brush: css;">
if (crmForm.FormType==1)
{
if (event.Mode == 2)
{
alert (&quot;You have to save the Form before the iFrame will show up&quot;);
event.returnValue = false;
crmForm.Save();
}
}
//crmForm.FormType == 1 means the form is new.
//event.Mode == 2 refers to the &quot;Save and Close&quot; button
</pre>
<p>Another possibility is to <strong>hide the &#8220;Save and Close&#8221; button</strong> if the form has not been saved:</p>
<pre class="brush: css;">
if (crmForm.FormType==1)
{
document.all._MBcrmFormSaveAndClose.style.display='none';
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://crm.atechnisch.nl/2008/01/mandatory-related-entities/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Related Entity in iFrame</title>
		<link>http://crm.atechnisch.nl/2008/01/related-entity-in-iframe/</link>
		<comments>http://crm.atechnisch.nl/2008/01/related-entity-in-iframe/#comments</comments>
		<pubDate>Wed, 16 Jan 2008 10:36:01 +0000</pubDate>
		<dc:creator>Huib Aarts</dc:creator>
				<category><![CDATA[Client Side Scripting]]></category>
		<category><![CDATA[MS CRM 4.0 Customizations]]></category>
		<category><![CDATA[iFrame]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[related entity]]></category>

		<guid isPermaLink="false">http://crm.atechnisch.nl/2008/01/16/related-entity-in-iframe/</guid>
		<description><![CDATA[Related entities are not displayed directly on the form, but only via the navigation pane.
For the user this means an extra click, and more important, when they look at the form, they are not sure if a related record is present. One way to solve this is to show the associated view of the related [...]]]></description>
			<content:encoded><![CDATA[<p align="left">Related entities are not displayed directly on the form, but only via the navigation pane.<br />
For the user this means an extra click, and more important, when they look at the form, they are not sure if a related record is present. One way to solve this is to show the associated view of the related entity in an iFrame on the form. Related entities are not available as long as the entity has not been saved. Before the entity is saved the entity can not be shown in the iFrame.<br />
For this the script has to check if the related entity is available. This can be done by checking if the form has been saved. When the associated view of the related entity normally is shown in an iFrame the borders are the same as the borders of the normal associated view. This will cost you a lot of precious screen space. Via additional javascript lines the borders can be hidden.<br />
In MS CRM 4.0 you can have multiple organization on one server, this means we have to put the organization name in the link of the iFrame.<br />
The javascript code has to be placed in the onload of the entity</p>
<pre class="brush: css;">
//first check if the user is online. If the user is online, than the organization name should be used in the link. Otherwise (if offline) the organisation name should not be used in the link.
if (IsOnline())
{
var org = &quot;/&quot; + ORG_UNIQUE_NAME;
}
else
{
var org = &quot;&quot;;
}

//the first part is to hide the borders
var frameName = 'IFRAME_Name';
var objFrame = document.getElementById(frameName);
var objWindow = document.frames[frameName];
objFrame.allowTransparency=true;
objFrame.onreadystatechange = function () {
if (objWindow.document.readyState=='complete') {
objWindow.document.body.style.backgroundColor='transparent';
if (objWindow.document.getElementsByTagName('BODY')[0]!=null) {
objWindow.document.getElementsByTagName('BODY')[0].style.padding='0px';
}
if (objWindow.document.getElementsByTagName('TABLE')[0]!=null) {
objWindow.document.getElementsByTagName('TABLE')[0].cellPadding='0';
objWindow.document.getElementsByTagName('TABLE')[0].style.border='0px';
}
}
}

//setting the contents of the iframe
var navFrame2;
navFrame2 =
document.all.nav_new_new_entity_new_relatedentity;
var navWindow = document.frames['IFRAME_Name_d'];

//and checking if the entity has been saved, nor quick create, nor bulk edit
if (crmForm.FormType==1 || crmForm.FormType==5 || crmForm.FormType==6)
{
document.all.IFRAME_Name.src=&quot;about:blank&quot;;
}
else
{
if (navFrame2 != null)
{
document.all.IFRAME_Name.src= org + &quot;/userdefined/areas.aspx?oId=&quot; +
crmForm.ObjectId +&quot;&amp;amp;oType=&quot;+crmForm.ObjectTypeCode+&quot;&amp;amp;security=852023&amp;amp;tabSet=new_new_entity_new_relatedentity&quot;;
navFrame2.name = navFrame2.id;
}
else{
alert(&quot;Page Not Found&quot;);
}
}
</pre>
<p align="left"><strong>//PS Make sure the Security Setting &#8220;Restrict cross-frame scripting&#8221; is <span style="color: #ff0000;">NOT</span> enabled on the iFrame Properties form (the checkbox should be empty)  <br />
//AND you have to change the userdefined for system entities, but who is using does&#8230;</strong> (in the link of the parent entity you can find the solution e.g. something like &#8216;document.all.IFRAME_Name.src= org + &#8220;/sfa/opps/ &#8216; etc).</p>
]]></content:encoded>
			<wfw:commentRss>http://crm.atechnisch.nl/2008/01/related-entity-in-iframe/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
