Microsoft.Xrm.DevOps.Data
Microsoft.Xrm.DevOps.Data copied to clipboard
m2m data
a fetch with a link-entity generates a schema and data that excludes the rest of the attributes in the fetch, as below.
When I duplicate the fetch in the collection, one without, then another with the link-entity reference then it generates the schema correctly as below:
My fetch collection:
Not sure if its an issue, or intended?
When including a link-entity with an attribute, the library assumes you're specifically adding the relationship between two different entities. If you also want to include some records from the first entity (or second entity), they should be setup as separate fetches.
thanks for confirming. This is the approach i've taken and it works great to deploy portal config between environments.
What is your intent with that fetch? To include those attributes for all adx_entitypermission records as well as all relationships it has with adx_webroles?
I've seen this question come up before and I've struggled with the best solution.
I am trying to duplicate the exact schema as below, which is from the default Custom Portal export schema. In this standard export template there are a handfull of these relationships thats needed.
The result below shows the correct relationship between adx_entitypermission and the potential list of adx_webroles.
I would think this approach of stacking the fetch works great, just need to document it.
It should be straightforward to add. I'll add it to the list - I'll also grab attributes from the destination record at the same time if they're provided. Someone could then stack three fetches in a single call.
I am struggling with this as well when it comes to applying this to portal records. Trying something far more simple just trying to fetch the adx_webrole_contact records filtered by a contactid.
Get-CrmDataPackage -Conn $Conn -Fetches @( "<fetch><entity name='adx_webrole_contact'><all-attributes/><filter><condition attribute='contactid' operator='eq' value='<GUIDGOESHERE>' /></filter></entity></fetch>")
-DisablePluginsGlobally $false | Export-CrmDataPackage -ZipPath "$env:USERPROFILE\Desktop\DynamicsData.zip" -Verbose;
So I tried a test without the filter and it just fails:
PS C:\WINDOWS\system32\WindowsPowerShell\v1.0> Get-CrmDataPackage -Conn $Conn -Fetches @( "<fetch><entity name='adx_webrole_contact'><all-attributes/></entity></fetch>")
-DisablePluginsGlobally $false | Export-CrmDataPackage -ZipPath "$env:USERPROFILE\Desktop\DynamicsData.zip" -Verbose;
Get-CrmDataPackage : Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
At line:1 char:1
- Get-CrmDataPackage -Conn $Conn -Fetches @( `
-
+ CategoryInfo : NotSpecified: (:) [Get-CrmDataPackage], Exception + FullyQualifiedErrorId : System.Exception,Microsoft.Xrm.DevOps.Data.PowerShell.Cmdlets.GetCrmDataPackage
This would be a great addition to any portal administrators bag of goodies if this could be figured out.
You should swap it around, dont query the relationship directly, example below returns Entity Permissions and M2M to WebRoles.
You should swap it around, dont query the relationship directly, example below returns Entity Permissions and M2M to WebRoles.
Maybe you can help directly with what I am trying to do here...
The command below should create a package that has the portal admin contact record and an adx_webrole_contact record that "makes" the record an admin. When imported into the next environment the portaladmin and admin role would be good to go.
If you could solve this for me that would be truly legendary...🗡️😄👍🛡️
Get-CrmDataPackage -Conn $Conn -Fetches @( `
"<fetch><entity name='contact'><all-attributes/><filter><condition attribute='adx_identity_username' operator='eq' value='[email protected]' /></filter></entity></fetch>", `
"<fetch><entity name='adx_webrole_contact'><all-attributes/><filter><condition attribute='contactid' operator='eq' value='<GUID_OF_RECORD_ABOVE>' /></filter></entity></fetch>") `
-DisablePluginsGlobally $false | Export-CrmDataPackage -ZipPath "$env:USERPROFILE\Desktop\DynamicsData.zip" -Verbose;
Note: I am not looking for a dynamic GUID here, I just omitted for security purposes. The guid of the record would be hardcoded. Note: If there was a way to make it dynamic then that would be over the top.