< Back

Set-CrmRecordOwner

Sat Jan 18, 2020 4:06 pm

NAME Set-CrmRecordOwner



SYNOPSIS

Assign an user as a CRM record's owner





SYNTAX

Set-CrmRecordOwner [-conn <CrmServiceClient>] [-CrmRecord] <PSObject> [-PrincipalId] <Guid> [[-AssignToTeam]

<SwitchParameter>] [<CommonParameters>]



Set-CrmRecordOwner [-conn <CrmServiceClient>] [-EntityLogicalName] <String> [-Id] <Guid> [-PrincipalId] <Guid>

[[-AssignToTeam] <SwitchParameter>] [<CommonParameters>]





DESCRIPTION

The Set-CrmRecordOwner cmdlet lets you assign a user to a record's owner.



There are two ways to specify a record.

1. Pass EntityLogicalName and record's Id.

2. Get a record object by using Get-CrmRecord/Get-CrmRecords cmdlets, then pass it.





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



-CrmRecord <PSObject>

A 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? true (ByValue)

Accept wildcard characters? false



-PrincipalId <Guid>

An Id (guid) of SystemUser or team to be assigned as owner.



Required? true

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



-AssignToTeam [<SwitchParameter>]

Switch indicating the PrincipalId Supplied is for a CRM Ownership Team and NOT a CRM User



Required? false

Position? 4

Default value

Accept pipeline input? false

Accept wildcard characters? false



-EntityLogicalName <String>

A logicalname for an Entity to set an owner. i.e.)accout, contact, lead, etc..



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Id <Guid>

An Id (guid) of the record



Required? true

Position? 2

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 --------------------------



Set-CrmRecordOwner -conn $conn -EntityLogicalName contact -Id e1d47674-4017-e511-80db-c4346bc42d18 -PrincipalId

f9d40920-7a43-4f51-9749-0549c4caf67d



This example assigns a contact record to an User.







-------------------------- Example 2 --------------------------



Set-CrmRecordOwner -conn $conn -EntityLogicalName contact -Id e1d47674-4017-e511-80db-c4346bc42d18 -PrincipalId

f0d40920-7a43-4f51-9749-0549c4caf673 -AssignToTeam



This example assigns a contact record to a Team.







-------------------------- Example 3 --------------------------



Set-CrmRecordOwner contact e1d47674-4017-e511-80db-c4346bc42d18 f9d40920-7a43-4f51-9749-0549c4caf67d



This example assigns a contact record to an User by ommiting parameter names.

When omitting parameter names, you do not provide $conn, cmdlets automatically finds it.







-------------------------- Example 4 --------------------------



PS C:\\>$contact = Get-CrmRecord contact e1d47674-4017-e511-80db-c4346bc42d18 fullname

PS C:\\>Set-CrmRecordOwner $contact f9d40920-7a43-4f51-9749-0549c4caf67d



This example retrieves and store a contact record, then pass it to Set-CrmRecordOwner.









RELATED LINKS