Monday, June 20, 2011

CRM 2011 - Windows Azure Installation Error

I went to install CRM 2011 for a customer last Friday on a brand new server only to get stuck at the Pre-Req screen with a "fatal error during installation" result for the Windows Azure platform AppFabric SDK 1.0.

I did a repair on .NET 4.0 and even did a full uninstall and re-install only to get the same result. I downloaded the WindowsAzureAppFabricSDK-x64.msi file directly from Microsoft's page (April Update) only to get a similar error. I looked in the Event Viewer and saw the following error:

Error 1026, .NET Runtime
Application: RelayConfigurationInstaller.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception
Exception Info: exception code e0434352, exception address 000007FEFCF2AA7D

It turns out it is a known issue that the AppFabric team is working on. See this thread from the MSDN forums.

To get past this error, you can either:

1) Download the previous build from here:
https://mercuryit.blob.core.windows.net/$root/WindowsAzureAppFabricSDK-x64.msi
You can also find this link in the thread in the MSDN forums.
Whenever they come up with a fix it is suggested to download and upgrade to the newer build.

2) Download v 2.0 of the AppFabric from here:
http://www.microsoft.com/download/en/details.aspx?id=17691
I have not personally tried this one, but see this thread for success stories.

Wednesday, June 15, 2011

Upgrading GP v9 Alt/Mod Reports to v10 or 2010

The upgrade from version 9 to version 10 asks, in so many words, if you want to transfer and upgrade the GP security from the old, not-so-great way of doing things to the new and much improved version. "No" is the appropriate answer there, but the drawback is that the settings for which modified reports are used are not pulled over, either. This can be a huge headache if there are a lot of modified reports as every user could have a completely different setting in each company; on top of that not all of the modified reports may even be used. A lot of times this is not by design - one user needed a report to be customized and thus is the only one with permission to the custom report, or someone was playing with the idea of changing a report, pulled it over in Report Writer to do so, but never actually made the change. Voila! You now have a long list of modified reports that aren't necessarily modified, and the permissions to the ones that actually are modified are not consistent.

I should created something to help with this a long time ago when we actually had a bunch of v9 upgrades left to do, but I recently ran into a situation where it was worth creating just for one customer.

Two things to note about this script: 1) it will only work with Modified Reports, and 2) you have to make a decision about how you want to pull in these permissions. You can have it just set up a single Alt/Mod Form/Report ID to where if anyone had permission in version 9 that everyone now has permission in version 10/2010 or you can break it up into how many times that report is given permission. For example, if ten users have permissions to report 1, five users have permissions to report 2, and eight users have permissions to report 3, you might create two Alt/Mod Form/Report IDs: one for six to ten users and another for one to five users. Run the script multiple times in the order of most min/max average users to least min/max average users, as in the previous example.

Even if you have to do some manual tweaking afterwards, you are much farther ahead than if you did not run it at all. Depending on your particular case, just running the query at the beginning comment section might be enough to help you manually create the settings.

If you do not like the result of any run of the script, you can simply delete the new Alt/Mod Form/Report ID from inside Dynamics GP.


/*
Restore the v9 DYNAMICS database to a new database called DYNAMICSv9
Populate the SY09400 table in the v10 DYNAMICS database to see the names of the reports
  Inside Dynamics GP, go to Maintenance >> Clear Data
  Click Display >> Physical Data
  Change Series to System
  Select Security Resource Descriptions, click Insert, OK and Yes
  Even though you chose Clear Data, it is actually adding it in
  Everyone else has to be out of GP to do the Clear Data or it will not run

SELECT
 CMPANYID,DSPLNAME,RESID, count(DISTINCT V9.USERID) C
FROM 
 DYNAMICSv9..SY02000 V9
LEFT JOIN DYNAMICS..SY09400 Descr
 ON V9.resid = Descr.SECURITYID
 AND V9.restype = Descr.SECRESTYPE
 AND V9.dictid = Descr.DICTID
WHERE 
 V9.DICTID = 0
 AND RESTYPE = 23
GROUP BY
 CMPANYID,DSPLNAME,RESID
ORDER BY
 CMPANYID,RESID


If you run this script and do not like the results, simply delete the created
  Alt/Modified Forms/Reports ID from inside Dynamics GP or manually update it

*/

-- SETTING UP VARIABLES

DECLARE @ALTMODFRMREP_ID CHAR(25)
DECLARE @ALTMODFRMREP_DESCRIPTION CHAR(50)
DECLARE @CREATEDATE DATETIME
DECLARE @USERID CHAR(15)
DECLARE @MAXAVERAGE INT
DECLARE @MINAVERAGE INT


-- CHANGE THESE VARIABLES AS NEEDED
SET @ALTMODFRMREP_ID =            'DEFAULTUSERYC'                -- ID: THIS MUST BE ALL CAPS (15 CHARS)
SET @ALTMODFRMREP_DESCRIPTION =    'Default YourCompany User'    -- DESCRIPTION: DOES NOT HAVE TO BE CAPS (50 CHARS)
SET @CREATEDATE =                '6/9/2011'                    -- USE TODAY'S DATE
SET @USERID =                    'sa'                        -- CAN LEAVE 'sa'

                                                            -- RUN THE SQL QUERY FOUND IN THE COMMENTS ABOVE TO SEE THE 
                                                            --     AVERAGES TO USE IN THE NEXT TWO VARIABLES
                                                            --   THESE WILL DEPEND ON HOW MANY COMPANIES YOU HAVE
                                                            --   OR HOW MANY SETS OF ALT/MOD SETTINGS THERE ARE.
                                                            --   SORRY - NO SCRIPT TO HELP YOU MAKE THAT DECISION
SET @MINAVERAGE =                1                            -- MIN NUMBER OF AVERAGE OCCURRENCES OF USERS USING THE REPORT IN V9
SET @MAXAVERAGE =                1000                            -- MAX NUMBER OF AVERAGE OCCURRENCES OF USERS USING THE REPORT IN V9


-- CREATING THE ALT/MOD FORM/REPORT ID
INSERT INTO SY09200 (SECMODALTID,SECMODALTDESC,CRUSRID,CREATDDT,MDFUSRID,MODIFDT)
VALUES (@ALTMODFRMREP_ID,@ALTMODFRMREP_DESCRIPTION,@USERID,@CREATEDATE,@USERID,@CREATEDATE)

-- COPYING THE SMARTLISTS, ETC. FROM DEFAULTUSER
INSERT INTO SY10800 (SECMODALTID,DICTID,SECURITYID,SECRESTYPE,ALTDICID,Modified)
    SELECT @ALTMODFRMREP_ID,DICTID,SECURITYID,SECRESTYPE,ALTDICID,Modified
    FROM SY10800 WHERE SECMODALTID = 'DEFAULTUSER'

-- UPDATING THE REPORTS ALREADY MARKED AS MODIFIED OR ALTERNATE AS THE V9 MODIFIED OR ALTERNATE REPORTS
UPDATE SY10800
    SET ALTDICID = V9.ALTDICID,
        Modified = 1
    FROM SY10800 V10 INNER JOIN 
        (SELECT DICTID,RESID,RESTYPE,ALTDICID
        FROM DYNAMICSv9..SY02000 V9                            -- v9 database
        WHERE DICTID = 0 AND RESTYPE = 23
            AND EXISTS (
            SELECT DICTID,SECURITYID,SECRESTYPE FROM SY10800 WHERE SECMODALTID = @ALTMODFRMREP_ID
                AND SY10800.SECRESTYPE = V9.RESTYPE AND SY10800.SECURITYID = V9.RESID AND SY10800.DICTID = V9.DICTID
        )
        GROUP BY DICTID,RESID,RESTYPE,ALTDICID
        HAVING COUNT(distinct USERID) BETWEEN @MINAVERAGE AND @MAXAVERAGE
        ) V9 ON V10.DICTID = V9.DICTID AND V10.SECRESTYPE = V9.RESTYPE AND V10.SECURITYID = V9.RESID
    WHERE V10.SECMODALTID = @ALTMODFRMREP_ID

-- ADDING THE REPORTS FROM V9
INSERT INTO SY10800 (SECMODALTID,DICTID,SECURITYID,SECRESTYPE,ALTDICID,Modified)
    SELECT @ALTMODFRMREP_ID,DICTID,RESID,RESTYPE,ALTDICID,1
    FROM DYNAMICSv9..SY02000 V9                                -- v9 database
    WHERE DICTID = 0 AND RESTYPE = 23
        AND NOT EXISTS (
        SELECT DICTID,SECURITYID,SECRESTYPE FROM SY10800 WHERE SECMODALTID = @ALTMODFRMREP_ID
            AND SY10800.SECRESTYPE = V9.RESTYPE AND SY10800.SECURITYID = V9.RESID AND SY10800.DICTID = V9.DICTID
    )
    GROUP BY DICTID,RESID,RESTYPE,ALTDICID
    HAVING COUNT(distinct USERID) BETWEEN @MINAVERAGE AND @MAXAVERAGE

-- SETTING UP THE USERS TO USE THE REPORTS - THESE PARTS ARE OPTIONAL
--   UPDATING EXISTING PERMISSIONS
UPDATE SY10550
    SET SECMODALTID = @ALTMODFRMREP_ID
    FROM DYNAMICSv9..SY02000 V9                                -- v9 database
    INNER JOIN SY10550 V10 ON V9.USERID = V10.USERID AND V9.CMPANYID = V10.CMPANYID
    WHERE EXISTS (
        SELECT DICTID,RESID,RESTYPE
            FROM DYNAMICSv9..SY02000 V9b                    -- v9 database
            WHERE DICTID = 0 AND RESTYPE = 23
                AND V9.DICTID = V9b.DICTID
                AND V9.RESTYPE = V9b.RESTYPE
                AND V9.RESID = V9b.RESID
            GROUP BY DICTID,RESID,RESTYPE
            HAVING COUNT(distinct USERID) BETWEEN @MINAVERAGE AND @MAXAVERAGE 
        )
    AND EXISTS (
        SELECT USERID,CMPANYID
        FROM SY10550 V10
        WHERE V9.USERID = V10.USERID
            AND V9.CMPANYID = V10.CMPANYID
        )
        
--   ADDING NEW ONES IF APPLICABLE
INSERT INTO SY10550 (USERID,CMPANYID,SECMODALTID)
    SELECT USERID,CMPANYID,@ALTMODFRMREP_ID
    FROM DYNAMICSv9..SY02000 V9                                -- v9 database
    WHERE EXISTS (
        SELECT DICTID,RESID,RESTYPE
            FROM DYNAMICSv9..SY02000 V9b                    -- v9 database
            WHERE DICTID = 0 AND RESTYPE = 23
                AND V9.DICTID = V9b.DICTID
                AND V9.RESTYPE = V9b.RESTYPE
                AND V9.RESID = V9b.RESID
            GROUP BY DICTID,RESID,RESTYPE
            HAVING COUNT(distinct USERID) BETWEEN @MINAVERAGE AND @MAXAVERAGE 
        )
    AND NOT EXISTS (
        SELECT USERID,CMPANYID
        FROM SY10550 V10
        WHERE V9.USERID = V10.USERID
            AND V9.CMPANYID = V10.CMPANYID
        )
    GROUP BY USERID,CMPANYID



/*
-- SEVERAL LOOKUPS TO HELP FIND THE DATA - ALL OF THESE ARE IN THE DYNAMICS DATABASE
select * from DYNAMICSv9..SY02000 -- THIS IS IN THE V9 DYNAMICS DATABASE
select * from sy10800
SELECT * FROM SY09200
SELECT * FROM SY10550
SELECT INTERID,CMPNYNAM,CMPANYID FROM SY01500
*/