< Back
Remove-CrmRecordAssociation
Post
NAME Remove-CrmRecordAssociation
SYNOPSIS
Associates two records for N:N relationship.
SYNTAX
Remove-CrmRecordAssociation [-conn <CrmServiceClient>] [-CrmRecord1] <PSObject> [-CrmRecord2] <PSObject>
[-RelationshipName] <String> [<CommonParameters>]
Remove-CrmRecordAssociation [-conn <CrmServiceClient>] [-EntityLogicalName1] <String> [-Id1] <Guid>
[-EntityLogicalName2] <String> [-Id2] <Guid> [-RelationshipName] <String> [<CommonParameters>]
DESCRIPTION
The Remove-CrmRecordAssociation cmdlet lets you disassociate two records for N:N relationship by specifying
relationship logical name.
There are two ways to specify records.
1. Pass EntityLogicalName and record's Id for both records.
2. Get a record object by using Get-CrmRecord/Get-CrmRecords cmdlets, and pass it for both records.
You can specify relationship logical name for the disassociation.
PARAMETERS
-conn <CrmServiceClient>
A connection to your CRM organization. Use $conn = Get-CrmConnection <Parameters> to generate it.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-CrmRecord1 <PSObject>
A first record object which is obtained via Get-CrmRecord/Get-CrmRecords. When you pass CrmRecord, then you
don't use EntityLogicalName/Id.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-CrmRecord2 <PSObject>
A second record object which is obtained via Get-CrmRecord/Get-CrmRecords. When you pass CrmRecord, then you
don't use EntityLogicalName/Id.
Required? true
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-RelationshipName <String>
A N:N relationship logical name.
Required? true
Position? 5
Default value
Accept pipeline input? false
Accept wildcard characters? false
-EntityLogicalName1 <String>
A logicalname for first Entity. i.e.)account, contact, lead, etc..
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Id1 <Guid>
An Id (guid) of first record
Required? true
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-EntityLogicalName2 <String>
A logicalname for second Entity. i.e.)account, contact, lead, etc..
Required? true
Position? 3
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Id2 <Guid>
An Id (guid) of second record
Required? true
Position? 4
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
-------------------------- Example 1 --------------------------
Remove-CrmRecordAssociation -conn $conn -EntityLogicalName1 account -Id1 00005a70-6317-e511-80da-c4346bc43d94
-EntityLogicalName2 contact -Id2 66005a70-6317-e511-80da-c4346bc43d94 -RelationshipName new_accounts_contacts
This example associates an account and a contact records through new_accounts_contacts custom N:N relationship.
-------------------------- Example 2 --------------------------
Remove-CrmRecordAssociation account 00005a70-6317-e511-80da-c4346bc43d94 contact
66005a70-6317-e511-80da-c4346bc43d94 new_accounts_contacts
This example associates an account and a contact records through new_accounts_contacts custom N:N relationship by
omitting parameters names.
When omitting parameter names, you do not provide $conn, cmdlets automatically finds it.
-------------------------- Example 3 --------------------------
PS C:\\>$account = Get-CrmRecord account 00005a70-6317-e511-80da-c4346bc43d94 name
PS C:\\>$contact = Get-CrmRecord contact 66005a70-6317-e511-80da-c4346bc43d94 fullname
PS C:\\>Remove-CrmRecordAssociation -conn $conn -CrmRecord1 $account -CrmRecord2 $contact -RelationshipName
new_accounts_contacts
This example retrieves and stores an account and a contact records to variables, then pass them to
Remove-CrmRecordAssociation cmdlets.
-------------------------- Example 4 --------------------------
PS C:\\>$account = Get-CrmRecord account 00005a70-6317-e511-80da-c4346bc43d94 name
PS C:\\>$contact = Get-CrmRecord contact 66005a70-6317-e511-80da-c4346bc43d94 fullname
PS C:\\>Remove-CrmRecordAssociation $account $contact new_accounts_contacts
This example retrieves and stores an account and a contact records to variables, then pass them to
Remove-CrmRecordAssociation cmdlets.
RELATED LINKS
SYNOPSIS
Associates two records for N:N relationship.
SYNTAX
Remove-CrmRecordAssociation [-conn <CrmServiceClient>] [-CrmRecord1] <PSObject> [-CrmRecord2] <PSObject>
[-RelationshipName] <String> [<CommonParameters>]
Remove-CrmRecordAssociation [-conn <CrmServiceClient>] [-EntityLogicalName1] <String> [-Id1] <Guid>
[-EntityLogicalName2] <String> [-Id2] <Guid> [-RelationshipName] <String> [<CommonParameters>]
DESCRIPTION
The Remove-CrmRecordAssociation cmdlet lets you disassociate two records for N:N relationship by specifying
relationship logical name.
There are two ways to specify records.
1. Pass EntityLogicalName and record's Id for both records.
2. Get a record object by using Get-CrmRecord/Get-CrmRecords cmdlets, and pass it for both records.
You can specify relationship logical name for the disassociation.
PARAMETERS
-conn <CrmServiceClient>
A connection to your CRM organization. Use $conn = Get-CrmConnection <Parameters> to generate it.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-CrmRecord1 <PSObject>
A first record object which is obtained via Get-CrmRecord/Get-CrmRecords. When you pass CrmRecord, then you
don't use EntityLogicalName/Id.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-CrmRecord2 <PSObject>
A second record object which is obtained via Get-CrmRecord/Get-CrmRecords. When you pass CrmRecord, then you
don't use EntityLogicalName/Id.
Required? true
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-RelationshipName <String>
A N:N relationship logical name.
Required? true
Position? 5
Default value
Accept pipeline input? false
Accept wildcard characters? false
-EntityLogicalName1 <String>
A logicalname for first Entity. i.e.)account, contact, lead, etc..
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Id1 <Guid>
An Id (guid) of first record
Required? true
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-EntityLogicalName2 <String>
A logicalname for second Entity. i.e.)account, contact, lead, etc..
Required? true
Position? 3
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Id2 <Guid>
An Id (guid) of second record
Required? true
Position? 4
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
-------------------------- Example 1 --------------------------
Remove-CrmRecordAssociation -conn $conn -EntityLogicalName1 account -Id1 00005a70-6317-e511-80da-c4346bc43d94
-EntityLogicalName2 contact -Id2 66005a70-6317-e511-80da-c4346bc43d94 -RelationshipName new_accounts_contacts
This example associates an account and a contact records through new_accounts_contacts custom N:N relationship.
-------------------------- Example 2 --------------------------
Remove-CrmRecordAssociation account 00005a70-6317-e511-80da-c4346bc43d94 contact
66005a70-6317-e511-80da-c4346bc43d94 new_accounts_contacts
This example associates an account and a contact records through new_accounts_contacts custom N:N relationship by
omitting parameters names.
When omitting parameter names, you do not provide $conn, cmdlets automatically finds it.
-------------------------- Example 3 --------------------------
PS C:\\>$account = Get-CrmRecord account 00005a70-6317-e511-80da-c4346bc43d94 name
PS C:\\>$contact = Get-CrmRecord contact 66005a70-6317-e511-80da-c4346bc43d94 fullname
PS C:\\>Remove-CrmRecordAssociation -conn $conn -CrmRecord1 $account -CrmRecord2 $contact -RelationshipName
new_accounts_contacts
This example retrieves and stores an account and a contact records to variables, then pass them to
Remove-CrmRecordAssociation cmdlets.
-------------------------- Example 4 --------------------------
PS C:\\>$account = Get-CrmRecord account 00005a70-6317-e511-80da-c4346bc43d94 name
PS C:\\>$contact = Get-CrmRecord contact 66005a70-6317-e511-80da-c4346bc43d94 fullname
PS C:\\>Remove-CrmRecordAssociation $account $contact new_accounts_contacts
This example retrieves and stores an account and a contact records to variables, then pass them to
Remove-CrmRecordAssociation cmdlets.
RELATED LINKS