Visualise the Dynamics CRM database - linq

I an new to both Dynamics CRM (Hosted) and LINQ, so please forgive my ignorance with this question...
I need to access some data stored in the CRM, but have no idea how to get at it. Normally I would open my SQL Management software and look around for the data, but I cant do that with the Hosted CRM data.
So.... My question is, is there anyway to visualise the 'database' to find the data I need to recal ???
Thanks in advance.

If you want manipulate the data of a CRM 2011 instance is necessary to follow some rules.
For CRUD and business operations you need use the CRM 2011 web services (also in combination with LINQ)
Is also possible (if you can connect to the DB) to read the data from Filtered Views, a Filtered View is a view mapped on a standard CRM entity (for example to read the data from the entity Account you can use the view FilteredAccount)
Read or modify the data directly from the tables is not supported.
If you want to know the structure of the entities you can use the Customization area inside CRM, or install the Metadata Browser (a solution available inside the CRM 2011 SDK) to see the attributes and the relationships.
A good starting point is always the CRM 2011 SDK, you can download here:
http://www.microsoft.com/en-us/download/details.aspx?id=24004
Inside you will find many examples (if you want to use LINQ check the early-bound ones) and the assemblies and tools for development.

Download the SDK and import the Metadata Browser managed solution (\sdk\tools\metadatabrowser\metadatabrowser_2_0_0_0_managed.zip) into your CRM Live instance.
You could also try downloading the database schema for the out-of-the-box database setup. Not really optimal but it might work for you.
You could also install a local version of Dynamics CRM (say in a virtual machine) for testing (either via MSDN or the free trial download.) This will give you SQL access to the database.
I recommend going with the Metadata Browser, which will probably get you the information that you need. Since the Metadata Browser is a managed solution you can install and remove it without impacting the Default Solution or any other solution in the organization.

Actually it turns out it is possible to work with the Dynamics CRM Online 'database' in much the same way as you can with any number of SQL Manager tools.
Linqpad4 - allows you to work with a number of environments and write your queries in VB, C# and even SQL.
It looks like a great tool, and has already helped me greatly, it certainly makes the Dynamics / LINQ scenario much easier to explore and learn about.
LinqPad4 can be downloaded here: [http://www.linqpad.net/]
and the driver(s) for Dynamics CRM can be downloaded here: [http://archive.msdn.microsoft.com/crmlinqpad]
I strongly recommend it.

Related

Am I "Allowed" to add a default constraint directly to DB in Dynamics 365?

Wondering if anyone can help a total newbie to Dynamics 365. Have started working on an existing implementation of Dynamics 365 (on premise) and am told by current developers that under no circumstances can I amend a column in a table for one of our entities directly on the DB. I am simply wanting to default an INT column to value 1.
They tell me "Dynamics is a black box and you will be breaking the law if you amend directly". This can't be true can it?
Thanks for any advice you can offer.
Building on what Josh said, it is true that the Dynamics SQL database is a black box. Everything must be done through the API with the exception of creating custom indexes on tables and reading from the "Filtered" views.
(And with the new T-SQL endpoint in preview for the online product, you're able to run SQL select queries against an online org.)
The reason for this that all events in Dynamics go through the "platform" via messages. For example, you might have plugin or workflow automation that triggers on the Update of an Account. When the platform receives the "Update" message for an Account, it searches for subscribers to that event and runs any subscribed processes. If you write a change directly to an Account record in SQL, you deprive the platform of the opportunity to run its processes for that event.
And it is good to note that Microsoft uses the same event framework for internal events. So, if you say, "Well, I have no custom plugins or workflows running on the Update message for Accounts so I can edit Accounts directly in SQL." By doing so you'd still risk breaking an internal Microsoft process that triggers on that event.
In a nutshell the platform's need to process ALL events is why direct updates to the database are unsupported. If you do them, Microsoft will refuse to support your system.
Another consideration is that if you ever want to move to the Dynamics Online, writing to the database isn't even possible, so you'd have to redo any automation that relied on that. This is another reason why everyone generally accepts the need to customize their system in the supported way.
Do people occasionally do unsupported things, with good justification? Yes, perhaps most commonly in making unsupported changes to the UI. Even so, writing directly to the database is among the highest offenses to be avoided.
Back to your scenario... it can be jarring to discover that the SQL database is off limits for any direct writing or schema changes. Fortunately Dynamics provides many other automation "hooks" including client-side JavaScript, Business Rules, Power Automate Flows, workflows, and plugins (synchronous and asynchronous).
To set a default value in the UI, the options include a Business Rule and JavaScript. To set a default value in the database, a synchronous workflow or plugin would do the trick.
The Developer Guide is a good place to start.
This would be considered an “unsupported” customization by Microsoft. If it breaks something in the logic of the app, Microsoft won’t help you fix it. If you ever move to Online instead of On-premise, you won’t have this ability. The current developers are battle-hardened and are trying to help you. This is a very bad idea - better would be to create a plug-in on Create of that entity that sets up default values for null fields. This way your logic is in the app with all the other custom logic and is supported.

How to copy the entire DB in CRM Dynamics?

It seems to me as a wise idea to test run my workflow on a local server before deploying in at the customer's. To be entirely sure, I'd like to copy all the data from their DB to my test organization (I have full access rights). The problem is that I can't see any straightforward way to export the whole shabang to a XML Spreadsheet.
What's the best way to export/import everything from/to a DB? The source and the target servers are not the same.
Of course I've got the option of backing up the clients DB and restore it, would the brown stuff hit the fan, but it'll far more professional if I won't have to.
The client's DB is in the cloud, which makes me suspect that perhaps I won't be able to access it at all and as far I can see, there's no way to back-up the data there. Am I missing it or is it that bad?
I fully agree that would be sensible. Usually we have a number development and test servers for all our work, generally we do not exactly mirror the data in the client database however.
We create a representative sample of data in our dev servers and then just move across the Crm solution for deployment.
As far as I know there is not straight forward way to get all the data, if you really want to do this I would suggest taking a back up of their database and importing to yours.
(As a side note, not all clients are happy for copies of their database - especially if its a live system - to be taken off site. Personally if it is a live database I wouldn’t put that risk on yourself, if the data gets lost or leaked you might suffer the consequences).
James raises good points about the business aspects of your request, however to get hold of the record-level data there are few options. The easiest by far is a wholesale export and import of the underlying SQL database. (For the record, the alternative is to do a data migration from live into a different db but this is no small task so I won't even entertain that any further here).
You mention that the client is using CRM Online ("...client's DB is in the cloud..."). You can raise a (free) support request with CRM Online Support who will provide you with a copy of the YourOrg_MSCRM database which can then be reimported into an on-premise deployment.
If you wish to simply have a test instance that has a copy of the Microsoft CRM Online organization, Microsoft does provide a means to do that. Depending on how many professional user licenses that the customer has, this may be free, but could be an extra cost and both instances would count against the storage limit for Microsoft CRM Online. You can see full details here - https://community.dynamics.com/crm/b/crmteamblog/archive/2014/03/20/introducing-sandbox-instances-in-crm-online.aspx . You can see steps on how to setup a sandbox instance here - https://technet.microsoft.com/en-us/library/dn467371.aspx "Add an instance to your subscription". This is something that I have used with one of our Microsoft CRM customers as it was a very good way to help validate the Scribe Online migration and customization changes we were making before moving those into production. The nice thing about doing it this way is that everything is still contained in the same Office 365 tenant and you can limit which users have access to the Sandbox organization, which is important for customers in knowing that their data is safe and not on some unknown server or machine.

BizTalk CRM Dynamics 4 to Dynamics 2011

My client is doing an upgrade from CRM Dynamics 4 to 2011 and it uses BizTalk 2009 as its ESB, they are currently using the 'Microsoft BizTalk Server Adapter for Microsoft Dynamics CRM 4.0' for the Integration, my question is does anyone know what breaking changes are involved from a BizTalk point of view when this upgrade takes places?
Am I looking at a whole new set of contracts in CRM 11 e.g. WCF meaning code changes, mappings, schemas and moving away from the Adapter (4.) to pure WCF transport communication?
At this moment in time I'm trying to gauge the complexity and migration levels for one service...
Cheers
I have some first hand experience integrating BizTalk with CRM Online 2011.
The major difference is the change from the pre-defined CRM types, allowing compile-time type safety, to an un-typed Wcf interface. A couple of (ugly) solutions to this problem have been documented around the web, but this blog post by Richard Seroter defines a BizTalk-only solution.
We used a third-party supplied adapter, developed by Roedl in Germany. This uses the Wcf Adapter Framework, in a similar manner to the WCF-SQL adapter, to provide a set of compile-time strong-typed schemas. This made it simple to map to and from the CRM types to our legacy system data types.
One disclaimer, we found that performance was "sufficient", without being outstanding. If you need to move a LOT of data back and forth, consider using the bespoke solution, but if lower development cost is your prime motivation, it is worth considering.
The scope of this project as described will be huge especially considering the limitations of the BizTalk Server Adapter. Have they considered using Scribe? You might want to do a simple proof of concept project for them with the free evaluation version. Scribe downloads

Workflow Foundation 4 Instance Store for Oracle

We are strongly considering using Workflow Foundation 4 in our products, however must support both SQL Server and Oracle. Does anyone know an Oracle Instance Store provider for Workflow Foundation 4?
I know I could use SQL Server Express for it, but some of our customers use Oracle, and don't want to have an SQL Server, even free, to manage.
Tks
If you do not mind using a commercial product then DevExpress has a very good solution. 16 database systems are supported along with re hosted designer and custom activities. Read more in this post XAF Workflow persistence storage
An updated devart link on the subject. It works well for me, for the persistance and the tracking participant also.
http://www.devart.com/blogs/dotconnect/?p=5566
AFAIK there is no publicly available version of the instance that works with Oracle. I have seen the question a number of times however so I can only encourage someone to publish one of those I suspect have been created privately on CodePlex.
Use this dll. We are using it and works well. Still need to check tracking and load testing.
http://www.devart.com/forums/viewtopic.php?t=21044&start=0&postdays=0&postorder=asc&highlight=&sid=a5e672c431dafecb1e675b6fbecc5183

Is there a way to get data from Oracle to a form stored on SharePoint 2007?

I need the document or form to be automatically updated when the data in the Oracle database is updated. If not possible, could anyone give me guidance to a solution similar to this?
Thanks for the help.
Oracle supports triggers in Java, so you could execute some code when data is changed in the DB. Sharepoint 2007 does support WebServices, so you could create a client which calls the web service to update the form.
But that sounds more simple than it is. The documentation for the web services in Sharepoint ... uh ... could be better. Many installations of Sharepoint insist on domain logins, so you would need to figure out a way to run Oracle with a Windows Domain logon.
In the end, it's probably more simple to create an email when the data changes in Oracle and have someone manually update the form.
That said, you paid a lot of money to Microsoft for Sharepoint, so they are obliged to tell you which API to use and they can probably even provide an example in, say C#. If all else fails, you can run a little server in C# which updates the form and which listens to data packets sent by a Java trigger in Oracle.
[EDIT] [Here is a blog post]2 to get you started with Java, Apache Axis and Sharepoint. Post a comment if you have any updates. LuUnfortunately, I'm no longer working at a company which uses Sharepoint.

Resources