Wednesday, November 9, 2011

CRM 2011 - how to set 'Filter On' filter to value 'All' for Activities

Add this Script Library and  add ChangeFilterLoad to Form Load

function ChangeFilterLoad() {
    if (document.getElementById('navActivities') != null) {
        document.getElementById('navActivities').onclick = function () {
            loadArea('areaActivities');
            ChangeFilter();

        }
    }


}


function ChangeFilter() {
    //Activity scheduledend options
    var ActivityOptions =
{
    All: "All",
    Overdue: "Overdue",
    Today: "Today",
    Tomorrow: "Tomorrow",
    Next7Days: "NextXDays;7",
    Next30Days: "NextXDays;30",
    Next90Days: "NextXDays;90",
    Next6Months: "NextXMonths;6"
}

    //Activity History actualend options
    var HistoryOptions =
{
    All: "All",
    Today: "Today",
    Yesterday: "Yesterday",
    Last7Days: "LastXDays;7",
    Last30Days: "LastXDays;30",
    Last90Days: "LastXDays;90",
    Last6Months: "LastXMonths;6",
    Last12Months: "LastXMonths;12"
}




    sArea = "areaActivities";
    //create the iframe object
    var iframe = document.getElementById(sArea + "Frame");
iframe.onreadystatechange = function()
{
if( iframe.readyState == "complete")
{
    var picklist, option;
    //reference to the iframe document
    var iframeDoc = iframe.contentWindow.document;
    switch (sArea) {
        case "areaActivities":
            picklist = (iframeDoc.getElementById('crmGrid_Contact_ActivityPointers_scheduledend'));//This is the drop daown id attact to contact form
            /* change to suit your needs */
            option = ActivityOptions.All;
            break;
        default: return;
    }
    picklist.value = option;
    picklist.FireOnChange();
}
}
}

Monday, November 7, 2011

Backup SQL Server 2008 R2 Restore on SQL 2008

  1. Install an instance of SQL 2008 R2 on one machine and SQL 2008 on another
  2. Open SQL Server Management Studio R2
  3. Select your source Database
  4. Select Tasks>Generate Scripts.
  5. Select 'Script entire database and all database objects', press 'Next'
  6. Select 'Save to File' and click on the 'Advanced' button
  7. Select 'Script for Server Version' and select the version you want: 200/2005/2008
  8. Select 'Type of data to Script' and select Schema/Data/both 
  9. Click 'OK',Next and do it!
  10. Copy the resulting file to the target machine with SQL 2008 [or whatever]
  11. Log onto your SQL Management Studio and open the copied .sql file... be aware that there may be limitations on the file size.

    There may also be issues with the order that the .SQL file inserts the data into the target database and if there are FK constraints in place, this could be an issue.... simply re-order the insert lists.

  12. Once the .sql file is organised, parse it [just to sure], and then execute. 
Refer : http://social.msdn.microsoft.com/Forums/en/sqldatabaseengine/thread/4daae3e5-15ab-4929-a122-e1bab420310e