Saturday, November 22, 2014

Angular JS Partial Dynamics Loading Links

Question in a StackOverlow with examples : http://stackoverflow.com/questions/23770096/how-to-easily-render-partial-html-from-a-string-in-angular-js
Fiddler with the example for the solution above, partial loading example with timers : http://jsfiddle.net/8Bf8m/29/

Controller and Controller loading Documentation:
https://docs.angularjs.org/guide/controller

Creating a Visualization App Using the Google Charts API and AngularJS, at SitePoint:

Monday, September 29, 2014

Restoring CRM DB from SQL Server Enterprise edition to SQL Server Standard Edition resulted in Error : contains a partition function 'AuditPFN'

When moving a database from a development environment to a production Environment, We backed up the database and restored it on the production database server which is a Sql Server Standard Edition.

I Got an error when restoring CRM 2013 Database Backup saying the AuditPFN is used in the database and it needs to be removed when using a standard edition server.


The AuditPFN means that a table can be spanned over multiple partitions, something that the Enterprise edition can do and the standard edition can not.  

I hope there will not be any more surprises like this. I must say I was surprised to see the speed of moving the backup file which was some 10's of GB over the network, so doing multiple attempts was not a scary scenario.

the Error Message : 

TITLE: Microsoft SQL Server Management Studio
------------------------------

Restore of database 'AAAAA_MSCRM' failed. (Microsoft.SqlServer.Management.RelationalEngineTasks)

------------------------------
ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.SmoExtended)

------------------------------

Database 'AAAAA_MSCRM' cannot be started in this edition of SQL Server because it contains a partition function 'AuditPFN'. Only Enterprise edition of SQL Server supports partitioning.
Database 'AAAAA_MSCRM' cannot be started because some of the database functionality is not available in the current edition of SQL Server. (Microsoft SQL Server, Error: 905....


OK, I search the internet and found thess posts:




The MS KB is a global solution but ALTAI just checked the database and found that the AuditPFN is used in just one table so they checked the installation  of CRM on a Standard Edition server. They built the script for that table and view, dropped them on the standard server and re created the table on the enterprise edition. After that, their processed continued.

I am working on a CRM 2013 version, so I will try the ALTAI route first. I will have a CRM database in standard edition to compare the databases.

What I did:
I backed up the database and restored to a new Database.
I started with the check written by ALTAI to find the tables with partitioning option. It was just AuditBase.
Then I reverse engineered all the indexes and constrains, the table and the view, and then removed the AuditPFN options.

Afterwards I re-inserted all the records from the original database after checking there was no change.

The scripts I built is this:

USE [Organization_Backup]
GO

/****** Object:  Table [dbo].[AuditBase]    Script Date: 09/30/2014 03:48:44 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[AuditBase](
[AttributeMask] [nvarchar](max) NULL,
[TransactionId] [uniqueidentifier] NOT NULL,
[Action] [int] NULL,
[ObjectId] [uniqueidentifier] NOT NULL,
[ObjectIdName] [nvarchar](1) NULL,
[UserId] [uniqueidentifier] NOT NULL,
[ChangeData] [nvarchar](max) NULL,
[CreatedOn] [datetime] NOT NULL,
[Operation] [int] NOT NULL,
[AuditId] [uniqueidentifier] NOT NULL,
[CallingUserId] [uniqueidentifier] NULL,
[ObjectTypeCode] [int] NULL
)

GO

ALTER TABLE [dbo].[AuditBase] ADD  DEFAULT (newsequentialid()) FOR [AuditId]
GO

GO

/****** Object:  Index [cndx_PrimaryKey_Audit]    Script Date: 09/30/2014 03:49:12 ******/
CREATE UNIQUE CLUSTERED INDEX [cndx_PrimaryKey_Audit] ON [dbo].[AuditBase] 
(
[CreatedOn] DESC,
[AuditId] DESC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON)
GO


/****** Object:  Index [fndx_ObjectTypeCode]    Script Date: 09/30/2014 03:51:23 ******/
CREATE NONCLUSTERED INDEX [fndx_ObjectTypeCode] ON [dbo].[AuditBase] 
(
[ObjectTypeCode] ASC
)
WHERE ([ObjectTypeCode] IS NOT NULL)
WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON)
GO



/****** Object:  Index [ndx_ObjectId]    Script Date: 09/30/2014 03:51:40 ******/
CREATE NONCLUSTERED INDEX [ndx_ObjectId] ON [dbo].[AuditBase] 
(
[ObjectId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON)
GO



/****** Object:  Index [ndx_PrimaryKey_Audit]    Script Date: 09/30/2014 03:51:54 ******/
CREATE NONCLUSTERED INDEX [ndx_PrimaryKey_Audit] ON [dbo].[AuditBase] 
(
[AuditId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON)
GO



/****** Object:  Index [ndx_PrimaryKey_Audit_Primary]    Script Date: 09/30/2014 03:52:19 ******/
CREATE UNIQUE NONCLUSTERED INDEX [ndx_PrimaryKey_Audit_Primary] ON [dbo].[AuditBase] 
(
[CreatedOn] DESC,
[AuditId] DESC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
GO



/****** Object:  Index [ndx_UserId]    Script Date: 09/30/2014 03:52:33 ******/
CREATE NONCLUSTERED INDEX [ndx_UserId] ON [dbo].[AuditBase] 
(
[UserId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON)
GO













GO




--
-- base view for Audit
--
create view [dbo].[Audit]
 (
    -- logical attributes
    [UserIdName],
    [CallingUserIdName],

    -- physical attributes
    [AttributeMask],
    [TransactionId],
    [Action],
    [ObjectId],
    [UserId],
    [ChangeData],
    [CreatedOn],
    [Operation],
    [AuditId],
    [CallingUserId],
    [ObjectTypeCode],
    [ObjectIdName]
) with view_metadata as
select
    -- logical attributes
    [lk_audit_userid].[FullName],
    [lk_audit_callinguserid].[FullName],

    -- physical attribute
    [AuditBase].[AttributeMask],
    [AuditBase].[TransactionId],
    [AuditBase].[Action],
    [AuditBase].[ObjectId],
    [AuditBase].[UserId],
    [AuditBase].[ChangeData],
    [AuditBase].[CreatedOn],
    [AuditBase].[Operation],
    [AuditBase].[AuditId],
    [AuditBase].[CallingUserId],
    [AuditBase].[ObjectTypeCode],
    [AuditBase].[ObjectIdName]
from [AuditBase] 
    left join [SystemUserBase] [lk_audit_callinguserid] with(nolock) on ([AuditBase].[CallingUserId] = [lk_audit_callinguserid].[SystemUserId])
    left join [SystemUserBase] [lk_audit_userid] with(nolock) on ([AuditBase].[UserId] = [lk_audit_userid].[SystemUserId])

GO


GO

/****** Object: PartitionScheme [AuditPScheme] Script Date: 02/17/2011 12:59:16 ******/

DROP PARTITION SCHEME [AuditPScheme]

GO

DROP PARTITION FUNCTION AuditPFN;

GO

Wednesday, August 13, 2014

Create a Link to a Document in sharepoint

We had a scenario that resembles the following:
Files of type Word Document  will be created automatically in Sharepoint for an Incident and its associated tasks.
We wanted to separate the files for each task but let the user open the documents integration list for the incident and see all the files from all the tasks.
First, We created a folder for the incident and mapped the same folder to all the sub-tasks.
We thought that using Sharepoint authorization and sharing we can let each task user see just the files which are relevant to him/her.

After some reasoning I thought that it would be possible to create a seperate folder for each task and put a link (shortcut) on the incident folder.

In order to check how it will look, I wanted to do it manually first. I found this article by Colin Phillips that shows how to add a shortcut to the user interface.
http://mmman.itgroove.net/2013/02/add-link-to-a-document-to-a-document-library/
Basically, you need to enable Content Types selection for the document list and select the "Link to Document" content type.
After doing so, the "New Document" option changed and does not display the selection of office files but just lets you upload a file.

AppStart Theme

https://wrapbootstrap.com/theme/appstart-responsive-admin-theme-WB0P4TG24

Sharepoint Installation - Intructions

Installing and Configuring SharePoint 2013 by Randy Rampel from EMC (Part 4)
http://consultingblogs.emc.com/randyrempel/archive/2013/03/17/installing-and-configuring-sharepoint-2013-part-4-of-4.aspx

Saturday, July 26, 2014

CRM 2013 : Working with Identity Foundation on WIndows XP

Identity Foundation is not supported on Windows XP. However, in a project to upgrade CRM 4.0 to CRM 2013, I was asked to deploy a windows form application that works with the CRM on an XP machine.

I Need to check the Outlook client too.

I looked around remembering to see some solutions and here is what I found :
Developing on CRM 2011 with Windows XP by dorrekens
http://mkonrad.blogspot.co.il/2010/11/crm-2011-filenotfoundexception-when.html 
http://blogs.mscrm-addons.com/post/2011/09/12/WindowsXP-and-WIF-(WindowsIdentityFoundation).aspx