Hello together,
I'm developing in MSCRM for a couple months now and I'm facing requirements that involve Data, like Queues and certain structures beeing created in custom Entities.
For us this is a manual Step after each deployment of the Solutions and obviously is error-prone. So my idea was to Export the Records from the Development instance, convert to some Xml/JSON/..., Source Control and deploy them with the normal solution deployment to have a consistent state after the deployment and across the instances.
So I stumbled accross this Issue of Microsoft.Xrm.Data.Powershell and the solution worked as Long as I'm not saving the record to disk:
--------------------------------------------------------------------------
#This works: $c = Get-CrmRecord -conn $srcConn $logicalname $id $fields New-CrmRecord -conn $destConn $c #But I'm struggling to import $n after saving $c to disk:
Export-Clixml "$($_)/$($logicalname)/$($id).xml" -InputObject $c -Depth 10 $n = Import-Clixml "$($_)/$($logicalname)/$($id).xml" #$j = ConvertTo-Json -InputObject $c -Depth 10 #$n = ConvertFrom-Json -InputObject $j #$s = Convert-String -InputObject $c #$n = ConvertFrom-StringData $s New-CrmRecord -conn $destConn $n
------------------------------------------------------------------
I always get Messages from OrgService, that it cannot deserialize the object:
The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter schemas.microsoft.com/.../Services:request. The InnerException message was 'Error in line 1 position 8374. Element 'schemas.datacontract.org/.../System.Collections.Generic:value' contains data from a type that maps to the name 'System.Management.Automation:PSObject'. The deserializer has no knowledge of any type that maps to this name. Consider changing the implementation of the ResolveName method on your DataContractResolver to return a non-null value for name 'PSObject' and namespace 'System.Management.Automation'.'. Please see InnerException for more details.
I guess my conversion changes the object itself (which is most obvious for Convert-String), but I have no idea how to solve this.
So my question is: Has anybody solved something similar and can help me with this issue?
(I dont care about the Format as long as you are able to hack the Attribute-Values on disk, like switching from true to false.)
Thanks in advance!
Best,
Marius
*This post is locked for comments