< Back

Remove-ProvDyn365EntityAssociation

Sun Jan 19, 2020 5:39 pm

NAME Remove-ProvDyn365EntityAssociation



SYNOPSIS

Deletes a relationship between two entityies in Dynamics365/ProvanceITSM.





SYNTAX

Remove-ProvDyn365EntityAssociation -AuthContext <object> -PrimaryEntityId <Guid> -PrimaryEntityName <string>

-RelatedEntityId <Guid> -RelationshipName <string> [-APIVersion <string>] [<CommonParameters>]



Remove-ProvDyn365EntityAssociation -AuthContext <object> -PrimaryEntityId <Guid> -PrimaryEntityName <string>

-PropertyName <string> [-APIVersion <string>] [<CommonParameters>]





DESCRIPTION

This cmdlet removes a relationship in a Dynamics365/ProvanceITSM instance via the WEB API. Primary and related

entity name, primary entity id and the relationshipname are required





PARAMETERS

-AuthContext <object>

The Authentication context generated by Get-ProvAzureAuthContext



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-PrimaryEntityName <string>

The logical name of the primary (source) entity in Dynamics365/ProvanceITSM you want to remove the

relationship from. This value is case sensitive !



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-PrimaryEntityId <Guid>

The id of the primary (source) entity in Dynamics365/ProvanceITSM you want to remove the relationship from.



Required? true

Position? named

Default value 00000000-0000-0000-0000-000000000000

Accept pipeline input? false

Accept wildcard characters? false



-RelationshipName <string>

The logical name of the relationship between the primary and the related entity. Use Dynamics 365

Customization page to find possible relationships. This value is case sensitive !



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-RelatedEntityId <Guid>

The id of the related (target) entity in Dynamics365/ProvanceITSM you want to remove the relationship from.



Required? true

Position? named

Default value 00000000-0000-0000-0000-000000000000

Accept pipeline input? false

Accept wildcard characters? false



-PropertyName <string>



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-APIVersion <string>

The Web-API Version used to query. Default is 'v9.0'".



Required? false

Position? named

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



---------- EXAMPLE 1 ----------



Unlink a contact from an account





Remove-ProvDyn365EntityAssociation -AuthContext $token -PrimaryEntityName account -PrimaryEntityId $ra.accountid

-RelationshipName contact_customer_accounts -RelatedEntityId $rc.contactid







In this example we have retrieves account and contact before and stored them in variables. $ra is the related

account and $rc is the related contact.

To retrieve those values, you would run the following commands before:

$ra = Get-ProvDyn365Entity -AuthContext $token -EntityName account -FilterSection "contains(name,'Contoso')"

-selectsection name

$rc = Get-ProvDyn365Entity -AuthContext $token -EntityName contact -FilterSection "contains(fullname,'John

Smith')" -SelectSection fullname



Explanaition of parameters and values:

-relationshipName 'contact_customer_accounts'

This is the logical name of the relationship between the account and the contact. Use Dynamics 365 Customization

page to find possible relationships.

-PrimaryEntityName 'account'

This is the logical name of the primary (source) entity

-PrimaryEntityId $ra.accountid

This is the id or the source entity you want to remove the relationip from. To get the id of an entity use

Get-ProvDyn365Entity.

-RelatedEntityId $rc.contactid

This is the id or the target entity you want to remove the relationip from. To get the id of an entity use

Get-ProvDyn365Entity.



For easier reading of the command you could also use parameter splatting and create a parameter hashtable

$removeContactFromAccount = @{

'AuthContext' = $token

'RelationshipName' = 'contact_customer_accounts'

'PrimaryEntityName' = 'account'

'PrimaryEntityId' = $($ra.accountid)

'RelatedEntityId' = $($rc.contactid)

}

Remove-ProvDyn365EntityAssociation @removeContactFromAccount



The $token object is generated by the cmdlet Provance.AzureAuthcontext which can be found in the Provance.Azure

Module.





RELATED LINKS

Provance Technologies Inc. (http://provance.com)

Help (http://help.provance.com)