Zoeken in deze blog
dinsdag 14 december 2010
SQL: make reporting labels multilangual
maandag 13 december 2010
SQL - Pass Multi-value parameter from master to subreport
donderdag 9 december 2010
SQL Server: "All Values" option in Queried parameter
WHERE (accountid = @CRM_Accountid) AND (statecode = @CRM_Opp_Statt) OR
(accountid = @CRM_Accountid) AND (@CRM_Opp_Statt = - 1)
For Text variables:
Use a (list) dataset, similar to this:
The dataset where you use the parameter should look something like this:
dinsdag 7 december 2010
SQL Server: "All Values" option in Non-queried parameter
SELECT statecodename, statecode
FROM FilteredOpportunity AS CRMAF_FilteredOpportunity
WHERE (accountid = @CRM_Accountid) AND (statecode = @CRM_Opp_Statt) OR
(accountid = @CRM_Accountid) AND (@CRM_Opp_Statt = - 1)
Next step is to add the option "All" to your Non-queried parameter:
Works like a charm!
Original post: http://timothychenallen.blogspot.com/2007/06/sql-server-all-values-parameters-in.html
maandag 29 november 2010
maandag 8 november 2010
Importing two or more entities from a Single File (2011)
http://blogs.msdn.com/b/crm/archive/2010/11/04/importing-two-or-more-entities-from-a-single-file.aspx
donderdag 21 oktober 2010
Uitvragen aantal veld (2011)
{
var locAttr = Xrm.Page.data.entity.attributes.get("numberofemployees");
alert(locAttr.getValue());
}
dinsdag 19 oktober 2010
Eigenschappen van een Lookup uitvragen (2011)
{
var LookupItem = Xrm.Page.data.entity.attributes.get("primarycontactid");
if (LookupItem.getValue() != null)
{
// The GUID of the lookup
alert(LookupItem.getValue()[0].id);
// The text value of the lookup
alert(LookupItem.getValue()[0].name);
// The entity type name
alert(LookupItem.getValue()[0].typename;
// The entity type code of the lookup 1=account, 2=contact
alert(LookupItem.getValue()[0].type);
}
}
maandag 4 oktober 2010
2011 – Hide Areas of a Form
// Hide the Ribbon Toolbar and move the form Content area to the top of the window.
window.top.document.getElementById(“crmTopBar”).style.display = “none”;
window.top.document.getElementById(“crmContentPanel”).style.top = “0px”; // Move Form Content area up to top of window, initial style.top is 135px
// Hide Left Hand Nav bar / pane
document.getElementById(“crmNavBar”).parentElement.style.display = “none”;
document.getElementById(“tdAreas”).parentElement.parentElement.parentElement.parentElement.colSpan = 2;
// Hide the Breadcrumb and Record Set Toolbar
document.getElementById(“recordSetToolBar”).parentElement.style.display = “none”;
// Hide the Form Footer Bar
document.getElementById(“crmFormFooter”).parentElement.style.display = “none”;
Original Post by Rhett Clinton
donderdag 9 september 2010
Collapsable Form Sections
function getElementsByCondition(condition, container) {
container = container || document;
var all = container.all || container.getElementsByTagName('*');
var arr = [];
for (var k = 0; k < all.length; k++) {
var elm = all[k];
if (condition(elm, k))
arr[arr.length] = elm;
}
return arr;
}
function attachCollapsableToSections() {
var sections = getElementsByCondition(function (elm) { if (elm.className.indexOf("ms-crm-Form-Section") != -1) return true; }, null);
for (var i = 0; i < sections.length; i++) {
sections[i].innerHTML = '<img alt="Expanded, click to collapse" src="/_imgs/navup.gif" style="cursor:hand;"/>' + sections[i].innerHTML;
sections[i].childNodes[0].attachEvent('onclick', toggleVisibility);
}
}
function toggleVisibility(e) {
var sectionContainer = e.srcElement.parentNode.parentNode.parentNode;
var elements = getElementsByCondition(function (elm) { if (elm.vAlign == "top") return true; }, sectionContainer);
for (var i = 0; i < elements.length; i++) {
if (elements[i].style.display == "none") {
elements[i].style.display = "";
e.srcElement.src = e.srcElement.src.replace("navdown", "navup");
}
else {
elements[i].style.display = "none";
e.srcElement.src = e.srcElement.src.replace("navup", "navdown");
}
}
}
attachCollapsableToSections();
dinsdag 7 september 2010
Custom Warning
/*============== addNotification function =============
Adds a warning message on the top of the entity form using
the same visual style as Microsoft CRM
Params: message to be shown to the user
=======================================================*/
addNotification = function(message) {
var notificationHTML = '<DIV class="Notification"><TABLE cellSpacing="0" cellPadding="0"><TBODY><TR><TD vAlign="top"><IMG class="ms-crm-Lookup-Item" alt="" src="/_imgs/error/notif_icn_crit16.png" /></TD><TD><SPAN>' + message + '</SPAN></TD></TR></TBODY></TABLE></DIV>';
var notificationsArea = document.getElementById('Notifications');
if (notificationsArea == null) return;
notificationsArea.innerHTML += notificationHTML;
notificationsArea.style.display = 'block';
}
/*============= END addNotification function ===========*/
//Example of utilizations
addNotification('Some warning message that you want to show to the user ');
Een sectie open- of dichtklappen
function OnCrmPageLoad()
{
/* false - collapsed, true - expanded */
//First Tab, Second Section, Expanded
ConvertSection(0,1,false);
//First Tab, Third Section, Collapsed
ConvertSection(0,2,false);
}
function ConvertSection( tabIndex , sectionIndex , state ) {
var sec = document.getElementById( "tab" + tabIndex );
var td = sec.childNodes[0].rows[ sectionIndex ].cells[0].childNodes[0].rows[0].cells[0];
var secHTML = td.innerHTML;
state = (typeof(state) == "undefined")? false:!state;
var src = (state == false)? "/_imgs/tree/dashPlus.gif":"/_imgs/tree/dashMinus.gif";
td.innerHTML = "<NOBR style='VERTICAL-ALIGN: middle;cursor:hand' onclick='excoSection(this)'><IMG src='" + src + "' align='middle' /> " + td.innerHTML + "</NOBR>";
td.childNodes[0].childNodes[0].state = state;
excoSection(td.childNodes[0]);
}
/* Toggle SectionState */
function excoSection( sec ) {
sec = sec.childNodes[0];
sec.state = !sec.state;
sec.src = (sec.state)? "/_imgs/tree/dashMinus.gif":"/_imgs/tree/dashPlus.gif";
var display = (sec.state)? "inline" :"none";
var tblsec = sec.parentElement.parentElement.parentElement.parentElement;
for( var i =1 ; i < tblsec.rows.length ; i++ )
tblsec.rows[i].style.display = display;
}
//Expose the toggling function at the window level
this.excoSection = excoSection;
OnCrmPageLoad();
Optie uit de NavBar hiden
{
document.getElementById('navWriteInProducts').style.display="none";
}
Alle velden op een form op read-only zetten
for(var index = 0; index <>
if(crmForm.all[index].Disabled != null)
crmForm.all[index].Disabled = true;
Items uit een picklist hiden
//Onzichtbaar maken picklist items
crmForm.all.CFPOrderstatus.DeleteOption(2);
crmForm.all.CFPOrderstatus.DeleteOption(5);
Opmaak vast telefoonnummer wanneer land = Nederland
PhonenumberFormat = function()
{
if(crmForm.all.cov_landid_ba.DataValue != null)
{
LookupItem = crmForm.all.cov_landid_ba.DataValue;
if(LookupItem[0].name == 'Nederland')
{
var formFld = event.srcElement;var TelNo = "";
if(formFld.DataValue != null)
{
TelNo = formFld.DataValue.replace(/[^[0-9]/g, "");
}
else
{
return;
}
if(TelNo.substr(0,2) == "31")
{
var TelNo = "0" + TelNo.substr(2);
}
if(TelNo.substr(0,4) == "0031")
{
var TelNo = "0" + TelNo.substr(4);
}
if(TelNo.length > 9)
{
switch (TelNo.substr(0,3))
{
case "010":
case "013":
case "015":
case "020":
case "023":
case "024":
case "026":
case "030":
case "033":
case "035":
case "036":
case "038":
case "040":
case "043":
case "045":
case "046":
case "050":
case "053":
case "055":
case "058":
case "070":
case "071":
case "072":
case "073":
case "074":
case "075":
case "076":
case "077":
case "078":
case "079":
case "085":
case "088":
formFld.DataValue = "(+31)" + " " + TelNo.substr(1,2) + " " + TelNo.substr(3,3) + " " + TelNo.substr(6,2) + " " + TelNo.substr(8,2);
break;
default:formFld.DataValue = "(+31)" + " " + TelNo.substr(1,3) + " " + TelNo.substr(4,2) + " " + TelNo.substr(6,2) + " " + TelNo.substr(8,TelNo.length-8);
break;
}
}
}
}
}
maandag 6 september 2010
Selectievakje (bit-veld) reageert niet op scripting
crmForm.all.cov_adverteerder.onclick = function()
{
crmForm.all.cov_adverteerder.FireOnChange();
}
Veld in hoofdletters
{
crmForm.all.address1_city.DataValue = crmForm.all.address1_city.DataValue.toUpperCase();
}
Eigenschappen van een lookup field uitvragen
function HandleOnChangeLookup()
{
if(crmForm.all.primarycontactid.DataValue != null)
{
var lookupItem = new Array;
lookupItem = crmForm.all.primarycontactid.DataValue;
// The text value of the lookup.
alert(lookupItem[0].name);
// The GUID of the lookup.
alert(lookupItem[0].id);
// The entity type name.
alert(lookupItem[0].typename);
// The entity type code of the lookup: 1=account, 2= contact.
alert(lookupItem[0].type);
}
}
donderdag 26 augustus 2010
Hiden van een sectie
crmForm.all.department_c.parentElement.parentElement.parentElement.style.display = 'none';
Sectie tonen:
crmForm.all.department_c.parentElement.parentElement.parentElement.style.display = 'block';
Beperken selectiemogelijkheden in een lookup
crmForm.all.regardingobjectid.lookuptypeIcons = "/_imgs/ico_16_1.gif:/_imgs/ico_16_2.gif";
crmForm.all.regardingobjectid.defaulttype = "2";
woensdag 25 augustus 2010
Standaard waarde in een lookup
lookupItem[0] = new LookupControlItem ("{3415DFD3-E170-DC11-A99F-0003FFB35B1C}", 4001, "Klachtenafhandeling");
crmForm.all.serviceid.DataValue = lookupItem;
Veld read-only maken
crmForm.all.new_textfield.readOnly = true;
Disabled:
crmForm.all.new_textfield.Disabled = true;
Waarde van een lookup wegschrijven in een tekstveld
{
LookupItem = crmForm.all.parentcustomerid.DataValue;
crmForm.all.new_companyname.DataValue = LookupItem[0].name;
}
Vaste datum in datumveld
Let op: de maanden lopen van 0 t/m 11 in JavaScript!
Lookup automatisch openen
{
if(crmForm.all.productid.DataValue == null)
{
crmForm.all.productid.click();
}
}
Mappings tussen CRM en Outlook
http://blogs.msdn.com/crm/archive/2006/07/03/655714.aspx
Veld hiden/tonen
crmForm.all.new_datetocontact_c.style.display = 'none';
crmForm.all.new_datetocontact_d.style.display = 'none';
//Veld tonen
crmForm.all.new_datetocontact_c.style.display = 'block';
crmForm.all.new_datetocontact_d.style.display = 'block';
Hiden van een menu-optie
if(document.getElementById("_MIcloseOrder2") != null)
{
document.getElementById("_MIcloseOrder2").style.display="none";
}
Button uit de grid verwijderen
if(document.getElementById('_MBLookupAddress') != null)
{
document.getElementById('_MBLookupAddress').style.display="none";
}
Aanpassen omschrijving van een NavBar item
var NavBarItem = document.all.navExistingProducts;
NavBarItem.getElementsByTagName("nobr")[0].innerHTML = "Producten";
E-mail bijhouden in CRM geeft foutmelding
Tekstveld converteren naar nummeriek veld
Veld wel/niet tonen o.b.v. picklist-waarde
{
crmForm.all.new_datetocontact_c.style.visibility = 'hidden';
crmForm.all.new_datetocontact_d.style.visibility = 'hidden';
crmForm.SetFieldReqLevel("new_datetocontact", 0);
crmForm.all.new_datetocontact.DataValue = null;
}
else
{
crmForm.all.new_datetocontact_c.style.visibility = 'visible';
crmForm.all.new_datetocontact_d.style.visibility = 'visible';
crmForm.all.new_datetocontact.SetFocus ();
crmForm.SetFieldReqLevel("new_datetocontact", 1);
}
E-mail opties
- Bij de optie Direct e-mail verzenden wordt het adres uitgesloten;
- Bij de optie e-mail bij snelle campagnes wordt het adres niet uitgesloten!
- Bij de optie e-mail verzenden in de werkbalk wordt het adres niet uitgesloten.
- Bij de optie Direct e-mail verzenden wordt het adres uitgesloten;
- Bij de optie e-mail bij snelle campagnes wordt het adres uitgesloten;
- Bij de optie e-mail verzenden in de werkbalk wordt het adres uitgesloten;
Bulk Delete Launcher
http://mscrmtools.blogspot.com/2009/07/new-tool-bulk-delete-launcher.html