Here’s a script to return you a quick list of the company ids (which are also the database name) and the company names for the companies defined in the DYNAMICS database
SELECT INTERID,CMPNYNAM FROM SY01500
ORDER BY CMPNYNAM
It's been said that laziness is a good trait to have in IT staff -Laziness in the sense that you don't like repetitive tasks...so you automate them -Laziness in that you don't want to keep reinventing the wheel when that 'once every two years' problem shows up...so you blog it. That's what this site is for me, to store those 'holy crap, that was hard to figure out' things so that I can find them again.
Here’s a script to return you a quick list of the company ids (which are also the database name) and the company names for the companies defined in the DYNAMICS database
SELECT INTERID,CMPNYNAM FROM SY01500
ORDER BY CMPNYNAM
Working as a GP Consultant, I occasionally run into a situation where a client doesn’t remember their System Password for GP. You know, the one that let’s you add users, change company information, the admin level tasks in GP.
The only supported solution is to contact MBS Support, who will walk you thru a process to gather information to send them.
There’s an easier way. Run the following script in SQL to reset the system password to blank. You can then go back into Setup and set it to whatever you want.
update DYNAMICS.dbo.SY02400
set PASSWORD = 0x00202020202020202020202020202020
WHERE DMYPWDID = 1
In Dynamics GP, administrators have the ability to control what companies users can access. This also controls what users see when the click the drop-down company field during login.
The menu instructions for this post are for GP 9.0. Newer versions provide the same functionality, although menu layout may be slightly different.
To change User Access for a user, click Tools / Setup / System / User Access. Clicking a username will display all of the available databases on the right and you can click the checkbox to allow or disallow access to specific companies for that user.
Every once in a while, especially have migrating to a new server or merging companies, you’ll get an error message “The user could not be added to one or more database”
A typical reason for this is that on the SQL side of the installation, the GP user already exists as a SQL user on the database, but GP doesn’t know about it. When you click the checkbox, GP tries to add that user to the database users. Since the object already exists, SQL kicks back an error that GP doesn’t know how to deal with.
To resolve the error, open SQL Management Studio and connect to your GP SQL instance. Then, run the following script, replacing <dbname> with the Database name of the company you’re trying to add the user to and replacing <username> with the user’s SQL login id. Our example is for company “Jim’s Bike Shop” that has a database name of JBS and the user id being jfallon.
USE <dbname>
DROP USER <userid>
So for our example, the code would be
USE JBS
DROP USER jfallon
Go back into GP and you should now be able to add the user to the company.
Over time, log files on SQL databases can become bloated. This procedure will provide scripts to shrink a log file back to manageable sizes.
1) Perform a complete backup of the database
2) Perform a backup of the transaction log file
3) Run following script to shrink the log file
USE [DB_NAME]
DBCC SHRINKFILE (N'DB_Logical_Name' , 100, TRUNCATEONLY)
BACKUP LOG DB_NAME WITH TRUNCATE_ONLY
4) Check the size of the log file. If it has not shrunk, there may be some data causing it to fail the move. Use the following script to create a sample table and fill it with data which _should_ free up the stuck data.
/* Create the table */
USE [DB_NAME]
DROP TABLE MyTable
CREATE TABLE MyTable (MyField VARCHAR(10), PK INT )
INSERT Mytable (PK) VALUES (1)
/* Fill the table */
SET NOCOUNT ON
DECLARE @Index INT
SELECT @Index = 0
WHILE (@Index < 20000)
BEGIN
UPDATE MyTable SET MyField = MyField WHERE PK = 1
SELECT @Index = @Index + 1
END
SET NOCOUNT OFF
5) After running the script rerun the shrink script. The transaction log should now shrink.
USE [DB_NAME]
DBCC SHRINKFILE (N'DB_Logical_Name' , 100, TRUNCATEONLY)
BACKUP LOG DB_NAME WITH TRUNCATE_ONLY
6) If it still hasn't shrunk, delete data from the MyTable table and rerun the fill script. Try the shrink again.
/* Diagnostics */
DBCC LOGINFO
This tip came from Rob Bamforth on his blog at http://robbamforth.wordpress.com/2009/11/16/sql-how-to-shrink-un-shrinkable-database-log-database-log-wont-shrink/
Sometimes the problem is not an inflated logfile or dbfile, but the data itself. In that case, cleaning out old data will help regain that valuable disk space.
A way to gain a little space without purging data is to reindex the database. Indexes, like many other things in SQL grow over time and a reindex will shrink them back down to their fighting weight.
To shrink the indexes, use the following script…
USE MyDatabase GO This script will take some time to process. After it is completed, you’ll need to shrink the actual file to regain that lost space.
Notes from the CRM 2011 Partner Roadshow in Chicago. Disclaimer that this page is likely to contain errors, if for no other reason than my poor fingers can barely keep up. Plus, Reuben likes to jump around a lot which makes it fun to organize :-)
@ReubenK: Working towards a simplified licensing model for online services – BPOS, CRM, Exchange. MS has to centralize billing first.
Demo of CRM web page loaded as a Web Resource in a managed solution that maps band show locations onto a Bing map…in ~20 lines of code
Again, these solutions can be packaged and pushed up to the marketplace as managed or unmanaged code to generate revenue or mindshare.
@ReubenK – “Integration is not a commodity play” It is highly specialized and has not yet become ‘productized’.
Microsoft working hard for industry specific certifications (FDA)
We have setup a custom attribute called Toll Free that we use to track 800 numbers.
In trying to setup a relationship map between the Lead and Account entity, I received the well known error:
“This attribute map is invalid. The selected attributes should be of the same type. The length of the target attribute should be equal to or greater than the length of the source attribute and the formats should match. The target attribute should not be used in another mapping.”
In looking, I noticed that we have the attribute set to a max of 25 characters in the lead and the default 100 characters in the account. Oh, well there’s the problem. I edited the attribute in the Account and shortened it. Problem solved, right?
Nope, same error. After checking all the other relationships to make sure it wasn’t used elsewhere, I was about to tear out some hair. Then I stumbled on Ronald Lemmen’s article about the error. His article didn’t solve the problem, but in the comments, someone had the solution.
When an attribute is created, a second database field called MaxLengthCRMAttribute set to 2x the value of the length of the attribute. Here’s the key, when you shrink the length, it doesn’t shrink the max length. However, when you increase the length, it does.
So I edited the Lead attribute that had been created, set it to 100, published then set it back to 25 and published again. After that, I was able to add the relationship because the max length field values now matched.