DavidJennaway
Fri Dec 14 09:50:00 PST 2007
There is a supported way to do this via the CRM web service. See
http://blogs.msdn.com/crm/archive/2007/12/14/crm-blog-automating-local-data-query-creation.aspx for a description of how to do this
And I've posted a console app to do this here:
http://www.codeplex.com/mscrmlocaldatagroup
--
David Jennaway - Microsoft Dynamics CRM MVP
Web:
http://www.excitation.co.uk
Blog:
http://mscrmuk.blogspot.com/
"Chris Brown" wrote:
> Hi Pablo,
>
> So I first had to create the Data Rules on my own client, then I was able to
> find out what the FetchXML and LayoutXML was for each Data Rule.
>
> Here are the steps that have to be completed on each client that you want to
> have the Data Rule(s).
> 1. Open up the Synch Queries(Local Data), Go To CRM, Local Data.
> 2. Select New
> 3. Select the Appropriate Type (i.e., Contacts, Accounts, Emails, etc.) If
> you don't put the appropriate Type, then you will get at error on the client
> side when you try to re-open the rule.
> 4. Click Save As, and name it the exact name you want it called. This must
> match the Where Name in the SQL query below or else the query wont fine it
> and update the Rule on the Client.
>
> Then just run the SQL Script and it will automatically update the Data Rules.
>
> Here is an example of the script that I run on the SQL Server.
>
> UPDATE [DeltaValve_MSCRM].[dbo].[UserQuery]
> SET [FetchXml] = '<fetch version="1.0" output-format="xml-platform"
> mapping="logical" distinct="true"><entity name="task"><attribute
> name="activityid"/><link-entity name="dv_project" from="dv_projectid"
> to="regardingobjectid" alias="aa"><filter type="and"><condition
> attribute="ownerid"
> operator="eq-userid"/></filter></link-entity></entity></fetch>',
> [LayoutXml] = '<grid name="resultset" object="4212" jump="subject"
> select="1" preview="1" icon="1"><row name="result" id="activityid"><cell
> name="subject" desc="Subject" width="250" /><cell name="statecode"
> width="100" /><cell name="prioritycode" width="100" /><cell
> name="scheduledend" width="100" /><cell name="createdby" width="100" /><cell
> name="regardingobjectid" width="100" /></row></grid>',
> [Description] = 'Synchronize Tasks that pertain to my Projects'
> WHERE Name = 'Tasks that Pertain to my Projects'
>
> UPDATE [DeltaValve_MSCRM].[dbo].[UserQuery]
> SET [FetchXml] = '<fetch version="1.0" output-format="xml-platform"
> mapping="logical" distinct="true"><entity name="phonecall"><attribute
> name="activityid"/><link-entity name="dv_project" from="dv_projectid"
> to="regardingobjectid" alias="aa"><filter type="and"><condition
> attribute="ownerid"
> operator="eq-userid"/></filter></link-entity></entity></fetch>',
> [LayoutXml] = '<grid name="resultset" object="4210" jump="subject"
> select="1" preview="1" icon="1"><row name="result" id="activityid"><cell
> name="subject" desc="Subject" width="250" /><cell name="statecode"
> width="100" /><cell name="prioritycode" width="100" /><cell
> name="scheduledend" width="100" /><cell name="createdby" width="100" /><cell
> name="regardingobjectid" width="100" /></row></grid>',
> [Description] = 'Synchronize Phone Calls that pertain to my Projects'
> WHERE Name Like 'Phone Calls that pertain to my Projects'
>
> Thanks,
>
> Chris
>
>
> "Pablo Gómez" wrote:
>
> > Hi Chris,
> >
> > Thanks for your reply... Can you give me the SQL Script ???? I saw that it
> > is not simply, but I will try it... We are 150 users that are not in the same
> > place, so...
> >
> > :-)
> > Pablo
> >
> > --
> > Pablo Gómez
> >
> >
> > "Chris Brown" wrote:
> >
> > > I found a work around which is not prefered, but works. Basically I created
> > > all the rules that I wanted for everyone else and found out what the XML code
> > > was for each rule. Then I had to manually create a blank of each rule on the
> > > users machine and named the rules the same as mine, then I ran a SQL script
> > > that did a update of all the rules in the system that matched my rules and
> > > updated the XML code for each one. This made it a little easier, since I
> > > didn't have to manually add all the filters for each rule on each machine
> > > since the XML automatically populated the filter.
> > >
> > > If I find a better way, I will let you know.
> > >
> > > Thanks,
> > >
> > > Chris
> > >
> > > "Pablo Gómez" wrote:
> > >
> > > > Hi Chirs,
> > > >
> > > > I have the same question... Could you find a solution for your issue???
> > > >
> > > > Thanks!
> > > > Pablo
> > > >
> > > >
> > > >
> > > > --
> > > > Pablo Gómez
> > > >
> > > >
> > > > "Chris Brown" wrote:
> > > >
> > > > > Hello,
> > > > >
> > > > > I have created about 4 customer queries in my Local Data CRM
> > > > > Synchronization. i would like to push these out to all of the users on the
> > > > > CRM System. Is there anyway to add these Queries to the default queries for
> > > > > all of my users?
> > > > >
> > > > > Thanks,
> > > > >
> > > > > Chris