Monday, July 11, 2011

SQL Data BAse Restore Error - System.Data.SqlClient.SqlError: The database was backed up on a server running version 10.50.1600. That version is incompatible with this server, which is running version 10.00.2531. Either restore the database on a server that supports the backup, or use a backup that is compatible with this server. (Microsoft.SqlServer.Smo)

To Resolve This Error >>>

  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.

Thursday, July 7, 2011

crm 2011 - Delete system jobs using SQL

Run This SQL Script >>>>

IF EXISTS (SELECT name from sys.indexes
                  WHERE name = N'CRM_AsyncOperation_CleanupCompleted')
      DROP Index AsyncOperationBase.CRM_AsyncOperation_CleanupCompleted
GO
CREATE NONCLUSTERED INDEX CRM_AsyncOperation_CleanupCompleted
ON [dbo].[AsyncOperationBase] ([StatusCode],[StateCode],[OperationType])
GO

declare @DeleteRowCount int
Select @DeleteRowCount = 2000
declare @DeletedAsyncRowsTable table (AsyncOperationId uniqueidentifier not null primary key)
declare @continue int, @rowCount int
select @continue = 1
while (@continue = 1)
begin     
begin tran     
insert into @DeletedAsyncRowsTable(AsyncOperationId)
      Select top (@DeleteRowCount) AsyncOperationId from AsyncOperationBase
      where OperationType in (1, 9, 12, 25, 27, 10) --AND StateCode = 3 --AND StatusCode in (30, 32)    
       Select @rowCount = 0
      Select @rowCount = count(*) from @DeletedAsyncRowsTable
      select @continue = case when @rowCount <= 0 then 0 else 1 end     
        if (@continue = 1)        begin
            delete WorkflowLogBase from WorkflowLogBase W, @DeletedAsyncRowsTable d
            where W.AsyncOperationId = d.AsyncOperationId            
 delete BulkDeleteFailureBase From BulkDeleteFailureBase B, @DeletedAsyncRowsTable d
            where B.AsyncOperationId = d.AsyncOperationId
 delete WorkflowWaitSubscriptionBase from WorkflowWaitSubscriptionBase WS, @DeletedAsyncRowsTable d
 where WS.AsyncOperationId = d.AsyncOperationID
            delete AsyncOperationBase From AsyncOperationBase A, @DeletedAsyncRowsTable d
            where A.AsyncOperationId = d.AsyncOperationId            
            delete @DeletedAsyncRowsTable     
end      
commit
end
--Drop the Index on AsyncOperationBase
DROP INDEX AsyncOperationBase.CRM_AsyncOperation_CleanupCompleted






--Statuscode
--0    Waiting For Resources
--10    Waiting
--20    In Progress
--21    Pausing
--22    Canceling
--30    Succeeded
--31    Failed
--32    Canceled


--Statecode
--0    Ready
--1    Suspended
--2    Locked
--3    Completed

Refer >> http://support.microsoft.com/kb/968520

Wednesday, July 6, 2011

Create New User To Windows Server Machine

Go >>>>
Administrative Tools > Active Directory Users and Computers > your server > Users > New User

Create New User

Enable Remote connection >>>>>>>

Administrative Tools > User Accounts > Give User access to this Computer

Monday, June 27, 2011

CRM 2011 - Get and Set Lookup Values Using Java Script

SET VALUES>>
function SetLookupValue(fieldName, id, name, entityType) {
if(fieldName != null) {
var lookupValue = new Array();
lookupValue[0] = new Object();
lookupValue[0].id = id;
lookupValue[0].name = name;
lookupValue[0].entityType = entityType;

Xrm.Page.getAttribute(fieldName).setValue(lookupValue);
}
}
// USE
SetLookupValue("new_blogid", "{FD140AAF-4DF4-11DD-BD17-0019B9312238}", "CRM Stuff", "new_blog");


================================================
GET VALUES>>
var lookUpObjectValue = Xrm.Page.getAttribute("yourlookupattributename");


    if (lookUpObjectValue != null)
  {
         var lookuptextvalue = lookUpObjectValue[0].name;


         var lookupid = lookUpObjectValue[0].id;
}

Friday, June 24, 2011

CRM 2011 Change Status Reason Using Work Flow

Update Not Visible Status Reason
To change the status reason, the step you add must be "Change status"
instead of "Update record".

Thursday, June 23, 2011

CRM 2011 Error - the caller not authenticate by service(System.ServiceModel Access Denid)

To Resolve : Change Code for connectivity will be :



public
static IOrganizationService
Service()
{

ClientCredentials Credentials = new ClientCredentials
();
Credentials.Windows.ClientCredential.UserName =
""
;
Credentials.Windows.ClientCredential.Password =
""
;



//This URL needs to be updated to match the servername and Organization for the environment.

Uri OrganizationUri = new Uri("http:////XRMServices/2011/Organization.svc"
);

Uri HomeRealmUri = null
;



//OrganizationServiceProxy serviceProxy;

using (OrganizationServiceProxy serviceProxy = new OrganizationServiceProxy(OrganizationUri, HomeRealmUri, Credentials, null
))
{

IOrganizationService service = (IOrganizationService
)serviceProxy;

return
service;
}
}


CRM 2011 Error - crm 2011 Object of type 'Microsoft.Xrm.Sdk.Entity' cannot be converted to type

Add .EnableProxyTypes(); to call service


        using (OrganizationServiceProxy serviceProxy = GetProxy())
        {
            serviceProxy.EnableProxyTypes();
   
          IOrganizationService service =(IOrganizationService)serviceProxy;
           
return
service.Retrieve(entityName, id, columSet);   
     }