THis script will set the default date of a form, this script is important because it sets the default date only for the Create form and not the update form. Otherwise the onload event will always set the date to the current date, even if its been updated. Credit to Sonomoa Partners.
var CRM_FORM_TYPE_CREATE = 1;
var CRM_FORM_TYPE_UPDATE = 2;
switch (crmForm.FormType)
{
case CRM_FORM_TYPE_CREATE:
crmForm.all.new_openddate.DataValue = new Date();
break;
case CRM_FORM_TYPE_UPDATE:
// do nothing
break;
}
I posted this question to the CRM Forums here and got some good feedback from Rhett Clinton.
if(crmForm.all.new_salesstageid.DataValue != null && crmForm.all.new_salesstageid.DataValue[0].name != "1")
crmForm.SetFieldReqLevel("new_projectmanagerid", 1);
else
crmForm.SetFieldReqLevel("new_projectmanagerid", 0);
And here is an example that works with multipe options
if(crmForm.all.new_salesstageid.DataValue != null) {
switch(crmForm.all.new_salesstageid.DataValue[0].name) {
case "1":
case "2":
crmForm.SetFieldReqLevel("new_projectmanagerid", 1);
break;
default:
crmForm.SetFieldReqLevel("new_projectmanagerid", 0);
break;
}
}
else
{
crmForm.SetFieldReqLevel("new_projectmanagerid", 0);
}
Great way to pull report parameters by Customer Effective here.
Great code I have not tried yet but I am certain I will need it by ANDRIY A33IK BUTENKO
This is a great piece of code I put together by merging two sets of code. Basically the following creates an IFRAME and formats the IFRAME in a professional manner.
// Builds a string for the source attribute of an IFrame
// Credit is given to Michael Hohne and Andrew Zimmer for the following code. For additional information, please
// refer to his stunnware site: http://www.stunnware.com/crm2/topic.aspx?id=JS27
//for formatting the IFRAME: http://blogs.inetium.com/blogs/azimmer/archive/2010/01/14/crm-displaying-related-entity-in-iframe-slightly-improved.aspx
function GetFrameSource(tabSet, roleOrd) {
if (crmForm.ObjectId != null) {
var roleOrdParamMissing = (typeof(roleOrd) == "undefined") || (roleOrd == null);
var oId = crmForm.ObjectId;
var oType = crmForm.ObjectTypeCode;
var security = crmFormSubmit.crmFormSubmitSecurity.value;
var url = "areas.aspx?oId=" + oId + "&oType=" + oType + "&security=" + security + "&tabSet=" + tabSet;
if (!roleOrdParamMissing) {
url += "&roleOrd=" + roleOrd;
}
return url;
}
else {
return "about:blank";
}
}
// Waits for the content window of the IFrame to be ready
function FixStylingInFrameSource(iframeID) {
// Check the content window's ready state
if (document.getElementById(iframeID).contentWindow.document.readyState
!= "complete") {
// Re-run this function in 10 ticks
window.setTimeout(function() { FixStylingInFrameSource(iframeID) }, 10);
}
// Content window is ready
else {
// Change the background color
document.getElementById(iframeID).contentWindow.document.body.style.backgroundColor = "#eef0f6";
// Remove the left border
document.getElementById(iframeID).contentWindow.document.body.all(0).style.borderLeftStyle = "none";
// Remove padding
document.getElementById(iframeID).contentWindow.document.body.all(0).all(0).all(0).all(0).style.padding = "0px";
// Make the cell the full width of the IFRAME
document.getElementById(iframeID).contentWindow.document.body.all(0).style.width = "102%"
// Show the IFrame
document.getElementById(iframeID).style.display = "block";
}
}
crmForm.all.IFRAME_organizaton_programs.src = GetFrameSource("new_account_organizationswithprograms");
if(crmForm.FormType != 1)
{
FixStylingInFrameSource('IFRAME_organizaton_programs');
}
Found a couple of solutions posted in the MS forums on this post, I had the best luck with the following:
To start update new_OpportunityID and new_ContactID with your fields, this example concatenates the Opportunity ID and Contact ID lookup fields.
var lookupItemOppID = new Array; lookupItemOppID = crmForm.all.new_OpportunityID.DataValue; var vOpportunityID= (lookupItemOppID[0] != null) ? lookupItemOppID[0].name : ""; var lookupItemConID = new Array; lookupItemConID = crmForm.all.new_ContactID.DataValue; var vContactID= (lookupItemConID[0] != null) ? lookupItemConID[0].name : ""; CrmForm.all.new_name.DataValue = vOpportunityID + " - " + vContactID;
This will concatenate two normal fields
crmForm.new_fullname.DataValue = crmForm.new_firstname.DataValue + " " + crmForm.new_lastname.DataValue;
This will concatenate a lookup field and a normal text field
if(crmForm.all.new_abreviationid.DataValue!=null) var nameval=crmForm.all.new_abreviationid.DataValue[0].name; crmForm.all.new_uasi.DataValue=nameval+","+crmForm.all.new_name.DataValue;
Then once you have the field completed you will want to force the change to the database. This will be necessary when a user changes one of the values that creates the concatentated field. It will show the change on the form, however it will not force the change to the database.
//force the result to the database crmForm.all.DesiredField.ForceSubmit = true
Great article on creating a CRM 4.0 test/training organization from your production organizationhttp://www.wipfli.com/BlogPost_MCRM_Blog_8_12_09.aspx
Security and Authentication in Microsoft Dynamics CRM: Connectivity and Firewall Port Requirements in On-Premise Deployments
This is a great white paper that has come into use for an enterprise solution I am working with on a client site. This document covers Connectivity and Firewall Port Requirements in On-Premise Deployments for Dynamics CRM 4.0.
Overview
Many data centers include firewalls between the end-users and the servers and other integrated systems that support an implementation of Microsoft Dynamics CRM 4.0. This document provides guidance on the connectivity requirements between Microsoft Dynamics CRM 4.0 and other systems to assist readers with proper firewall configuration in customer environments.
Made the mistake of leaving the “CRM for Outlook” button my web form before turning users loose into a UAT preparation enviornment. Here is an article on removing the link from the Microsoft Support Site @ http://support.microsoft.com/kb/2004601
This is interesting. Looks like others have been searcing perhaps?
Note This is a “FAST PUBLISH” article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use (http://go.microsoft.com/fwlink/?LinkId=151500) for other considerations.
Always a good one to remember.
crmForm.new_fullname.DataValue = crmForm.new_firstname.DataValue + " " + crmForm.new_lastname.DataValue

Categories
Tag Cloud
Blog RSS
Comments RSS
Last 50 Posts
Back
Void « Default
Life
Earth
Wind
Water
Fire
Light 