Tuesday 30 October 2012

Sample: Work with Attributes

Sample: Work with Attributes:

'via Blog this'

Monday 8 October 2012

CRM Masthead Customization for Multiple Organizations


CRM Masthead Customization for Multiple Organizations

A few weeks ago, a blog was posted by David Sutton called CRM Masthead Customization, and it was explaining how to customize the masthead in CRM. However if you have multiple Organizations in your CRM environment, the masthead will be added to all Organizations, rather than having a unique masthead for each Organization.

Sebastiaan Klaver from Herke ICT Group came up with a solution to this, so that you can have different mastheads for each Organization in your CRM environment.

Sebastiaans method is described below:
To customize the header for MSCRM I used this blog post:
http://www.magnetism.co.nz/blog/10-05-10/CRM_Masthead_Customization.aspx

But i wanted to go further and have a custom masthead logo for each organization in my MSCRM enterprise environment.

To accomplish this you have to complete the following steps:

Create the new header images.
Locate the header definitions in the MSCRM CSS file.
In my environment it was located under e:\inetpub\wwwroot\_common\styles\global-dynamic-styles.css.aspx
There are 2 places that you will need to edit the CSS file; 1 for the background image and 1 for the logo.

  • Background-image is defined under “TABLE.ms-crm-MastHead” 
  • Logo-image is defined under “TD.ms-crm-MastHead-Logo”

To change the CRM logo for each organization, I added an if statement to check the URL, and lookup the organization name which is always displayed in the URL.

Add another else if statement for each MSCRM-organization for both the TABLE and TD.
(In my environment I only changed the logo, but you can do the same for the background.)

Example:

TD.ms-crm-MastHead-Logo 

height: 58px; 
background-repeat: no-repeat; 
padding: 0px 15px; 
<% if (CrmStyles.IsRightToLeft) { %> 
background-position: top right; 
background-image: url(/_imgs/masthead_rtl.jpg); 
<% } else if (Request.Url.AbsoluteUri.Contains("orgname")) { %> 
background-position: top left;
background-image: url(/_imgs/masthead_orgname.jpg); 
<% } else { %> 
background-position: top left; 
background-image: url(/_imgs/masthead.jpg); 
<% } %> 


The code in bold and italics will need to be added where it is shown above, where orgname will be the name of the Organization, and where it has /_imgs/masthead_orgname.jpg will be new location of the masthead logo.
To change the background as well, do the same for the background image in TABLE.ms-crm-MastHead, and specify the background image location.
The header image will change after pressing CRTL+F5 in CRM.
The header image in the sign in page (if using IFD) will also change.
Of course this solution is not officially supported by Microsoft, but I think it’s a good way to play around and give MSCRM a more personal flavor ;-)

Monday 17 September 2012

rpi-update

https://raw.github.com/Hexxeh/rpi-update/master/rpi-update

#!/bin/bash
set -o nounset
set -o errexit

UPDATE=${UPDATE:-1}
UPDATE_URI="https://github.com/Hexxeh/rpi-update/raw/master/rpi-update"

ROOT_PATH=${ROOT_PATH:-"/"}
BOOT_PATH=${BOOT_PATH:-"/boot"}
SKIP_KERNEL=${SKIP_KERNEL:-0}
FW_REPO="git://github.com/Hexxeh/rpi-firmware.git"
FW_REPOLOCAL="${ROOT_PATH}/root/.rpi-firmware"
FW_PATH="${BOOT_PATH}"
FW_MODPATH="${ROOT_PATH}/lib/modules"
FW_RAM=${1:-0}
GITCMD="git --git-dir=\"${FW_REPOLOCAL}/.git\" --work-tree=\"${FW_REPOLOCAL}\""

function detect_split() {
 if [[ -f "$FW_PATH/start.elf" && ${FW_RAM} -eq 0 ]]; then
  echo "Autodetecting memory split"
  FW_RAM=240
  for R in 128 192 224 240
  do
   if [[ -f "$FW_PATH/arm${R}_start.elf" ]]
   then
          if diff "$FW_PATH/arm${R}_start.elf" "$FW_PATH/start.elf" >/dev/null
          then
            FW_RAM=$R
            break
          fi
   fi
  done
 fi
 FW_GPU=$((256-FW_RAM))
}

function update_self() {
 echo "Performing self-update"
 _tempFileName="$0.tmp"

 if ! wget --quiet --output-document="${_tempFileName}" "${UPDATE_URI}"; then
  echo "Failed to download update for rpi-update!"
  echo "Make sure you have ca-certificates installed and that the time is set correctly"
  exit 1
 fi

 OCTAL_MODE=$(stat -c '%a' "$0")
 if ! chmod ${OCTAL_MODE} "${_tempFileName}" ; then
    echo "Failed: Error while trying to set mode on ${_tempFileName}"
  exit 1
 fi

 cat > /tmp/updateScript.sh << EOF
 #!/bin/bash
 if mv "${_tempFileName}" "$0"; then
  rm -- "\$0"
  exec env UPDATE=0 /bin/bash "$0" "$FW_RAM"
 else
  echo "Failed!"
 fi
EOF

 exec /bin/bash /tmp/updateScript.sh
}

function update_modules {
 if [[ ${SKIP_KERNEL} -eq 0 ]]; then
  cp -R "${FW_REPOLOCAL}/modules/"* "${FW_MODPATH}/"
  find "${FW_REPOLOCAL}/modules" -mindepth 1 -maxdepth 1 -type d | while read DIR; do
   depmod -b "${ROOT_PATH}" -a $(basename "${DIR}")
  done
 fi
}

function update_sdk {
 if [[ -f /etc/init.d/vcfiled ]]; then
  /etc/init.d/vcfiled stop
 fi

 ELFOUTPUT=$(readelf -a "${ROOT_PATH}/bin/bash")
 if [ "${ELFOUTPUT}" != "${ELFOUTPUT/VFP_args/}" ]; then
  echo "Using HardFP libraries"
  cp -R "${FW_REPOLOCAL}/vc/hardfp/"* "${ROOT_PATH}/"
 else
  echo "Using SoftFP libraries"
  cp -R "${FW_REPOLOCAL}/vc/softfp/"* "${ROOT_PATH}/"
 fi
 cp -R "${FW_REPOLOCAL}/vc/sdk/"* "${ROOT_PATH}/"

 if [[ -f /etc/init.d/vcfiled ]]; then
  /etc/init.d/vcfiled start
 fi
}

function set_split {
 cp "${FW_PATH}/arm${FW_RAM}_start.elf" "${FW_PATH}/start.elf"
}

function update_firmware {
 cp "${FW_REPOLOCAL}/"*.elf "${FW_PATH}/"
 cp "${FW_REPOLOCAL}/"*.bin "${FW_PATH}/"
 if [[ ${SKIP_KERNEL} -eq 0 ]]; then
  cp "${FW_REPOLOCAL}/"*.img "${FW_PATH}/"
 else
  echo "Skipping kernel/modules updated as requested"
 fi
}

function finalise {
 ldconfig -r "${ROOT_PATH}"
 eval ${GITCMD} rev-parse master > "${FW_PATH}/.firmware_revision"
 sync
}

function download_repo {
 echo "Setting up firmware (this will take a few minutes)"
 mkdir -p "${FW_REPOLOCAL}"
 git clone "${FW_REPO}" "${FW_REPOLOCAL}" --depth=1 --quiet
 RETVAL=$?
 if [[ ${RETVAL} -ne 0 ]]; then
  echo "Failed to download new firmware files"
  exit 1
 fi
}

function update_repo {
 echo "Updating firmware (this will take a few minutes)"
 eval ${GITCMD} fetch --quiet
 RETVAL=$?
 if [[ ${RETVAL} -ne 0 ]]; then
  echo "Failed to download updated firmware files"
  exit 1
 fi
 eval ${GITCMD} merge origin/master -m "automerge" --quiet
 RETVAL=$?
 if [[ ${RETVAL} -ne 0 ]]; then
  echo "Failed to download updated firmware files"
  exit 1
 fi
}

function do_backup {
 cp -a "${FW_PATH}" "${FW_PATH}.bak"
 cp -a "${FW_MODPATH}" "${FW_MODPATH}.bak"
}

function do_update {
 update_firmware
 update_modules
 update_sdk
 set_split
 finalise
 echo "If no errors appeared, your firmware was successfully $1"
 if [[ "${ROOT_PATH}" == "/" ]]; then
  echo "A reboot is needed to activate the new firmware"
 fi
}

if [[ ${EUID} -ne 0 ]]; then
 echo "This tool must be run as root"
 exit 1
fi

if [[ ${UPDATE} -ne 0 ]]; then
 echo "Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS"
 update_self
fi

if [[ ( "${ROOT_PATH}" == "/"  &&  "${BOOT_PATH}" != "/boot" ) ]] ||
[[ ( "${BOOT_PATH}" == "/boot"  &&  "${ROOT_PATH}" != "/" ) ]]; then
 echo "You need to specify both ROOT_PATH and BOOT_PATH, or neither"
 exit 1
fi

if [[ ! -d "${FW_PATH}" ]]; then
 echo "${FW_PATH} doesn't exist"
 exit 1
fi
if [[ ! -f "${FW_PATH}/start.elf" ]]; then
 echo "${FW_PATH}/start.elf doesn't exist."
 exit 1
fi
if [[ ! -d "${FW_MODPATH}" ]]; then
 echo "${FW_MODPATH} doesn't exist"
 exit 1
fi

command -v git >/dev/null 2>&1 || {
 echo "This tool requires you have Git installed, please install it first"
 echo "In Debian, try: sudo apt-get install git-core"
 echo "In Arch, try: pacman -S git"
 exit 1
}

command -v readelf >/dev/null 2>&1 || {
 echo "This tool requires you have readelf installed, please install it first"
 echo "In Debian, try: sudo apt-get install binutils"
 echo "In Arch, try: pacman -S binutils"
 exit 1
}

detect_split
if [[ ${FW_RAM} -ne 240 ]] &&[[ ${FW_RAM} -ne 224 ]] && [[ ${FW_RAM} -ne 192 ]] && [[ ${FW_RAM} -ne 128 ]]; then
 echo "RAM value must be one of: 240, 224, 192, 128"
 exit 1
fi
echo "Using ARM/GPU memory split of ${FW_RAM}MB/${FW_GPU}MB"

if [[ -f "${FW_REPOLOCAL}/.git/config" ]]; then
 update_repo
 if [[ -f "${FW_PATH}/.firmware_revision" ]] && [[ $(cat "${FW_PATH}/.firmware_revision") == $(eval ${GITCMD} rev-parse master) ]]; then
  echo "Your firmware is already up to date"
  set_split
  finalise
 else
  do_update "updated"
 fi
else
 echo "We're running for the first time"
 download_repo
 do_backup
 do_update "setup"
fi

Raspberry pi - Update


CODE: SELECT ALL
sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update && sudo chmod +x /usr/bin/rpi-update
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install git-core
sudo rpi-update
sudo reboot

Monday 10 September 2012

Unmanage CRM 2011 solution

-- Update the "managed" flag in the database
-- List the managed solutions
select isvisible,IsManaged,Description,UniqueName,* from Solution
where IsManaged = 1 and IsVisible = 1

-- 
begin transaction
update Solution
set IsManaged = 0
where UniqueName = <solution name to change>
commit transaction

Friday 7 September 2012

Load an external JavaScript file CRM 2011/4


            try {
                var docs = document.getElementById('eb.script.201200906');
                if (docs == null) {
                    var script = document.createElement('script');
                    script.id = 'eb.script.201200906';
                    script.language = 'javascript';
                    script.src = '/ISV/EB/ScriptFile.js';
                    document.getElementsByTagName('head')[0].appendChild(script);
                    var f = function () {
                        if (event.srcElement.readyState == 'loaded' || event.srcElement.readyState == 'complete')
                            ScriptStart();  // Entry function
                    }
                    script.attachEvent('onreadystatechange', f);
                }
            }
            catch (err) { }

Wednesday 5 September 2012

CRM 2011: Accessing hidden mappings opportunity/quote/order/invoice


declare @maPID AS NVARCHAR(50)
declare @maPORT as int ; set @maPORT = 5555
-- -------------------------------------------------------
SET @maPID = (SELECT EntityMapId FROM EntityMapBase
WHERE TargetEntityName='quotedetail' AND SourceEntityName='opportunityproduct')

print 'http://' + @@Servername + ':' + 
 cast(@maPORT as nvarchar(30)) + '/Tools/SystemCustomization/Relationships/Mappings/mappingList.aspx?mappingId=' + @mapid
-- -------------------------------------------------------
SET @maPID = (SELECT EntityMapId FROM EntityMapBase
WHERE TargetEntityName='salesorderdetail' AND SourceEntityName='quotedetail')

print 'http://' + @@Servername + ':' + 
 cast(@maPORT as nvarchar(30)) + '/Tools/SystemCustomization/Relationships/Mappings/mappingList.aspx?mappingId=' + @mapid
-- -------------------------------------------------------
SET @maPID = (SELECT EntityMapId FROM EntityMapBase
WHERE TargetEntityName='invoicedetail' AND SourceEntityName='salesorderdetail')

print 'http://' + @@Servername + ':' + 
 cast(@maPORT as nvarchar(30)) + '/Tools/SystemCustomization/Relationships/Mappings/mappingList.aspx?mappingId=' + @mapid

Friday 25 May 2012

http://mscrmuk.blogspot.com.au/2012/04/crm-email-router-errors-with-adfs.html
  1. Use regedit to go to the HKLM\System\CurrentControlSet\Services\MSCRMEmail key
  2. Add a Multi-string (REG_MULTI_SZ) value 'DependOnService'
  3. Set the value to adfssrv (or add this value if there were already a dependency)