< Back

Set-CrmRecordState

Sat Jan 18, 2020 4:06 pm

NAME Set-CrmRecordState



SYNOPSIS

Sets Status/State for a CRM record.





SYNTAX

Set-CrmRecordState [-conn <CrmServiceClient>] [-CrmRecord] <PSObject> [-StateCode] <String> [-StatusCode] <String>

[<CommonParameters>]



Set-CrmRecordState [-conn <CrmServiceClient>] [-EntityLogicalName] <String> [-Id] <Guid> [-StateCode] <String>

[-StatusCode] <String> [<CommonParameters>]





DESCRIPTION

The Set-CrmRecordState cmdlet lets you set Status/State for a CRM record.



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



-StateCode <String>

StateCode value for a record. You can retrieve values by using Get-CrmEntityOptionSet <EntityLogicalName>

statecode | % {$_.Items}



Required? true

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



-StatusCode <String>

StatusCode value for a record. You can retrieve values by using Get-CrmEntityOptionSet <EntityLogicalName>

statuscode | % {$_.Items}



Required? true

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.)account, 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-CrmRecordState -conn $conn -EntityLogicalName account -Id 1bf8d93d-1f18-e511-80da-c4346bc43d94 -StateCode

Inactive -StatusCode Inactive



This example sets disabled state for an account record.







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



Set-CrmRecordState account 1bf8d93d-1f18-e511-80da-c4346bc43d94 Inactive Inactive



This example sets disabled state for an account record by omitting parameter names.

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







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



PS C:\\>$contact = Get-CrmRecord contact 81f8d93d-1f18-e511-80da-c4346bc43d94 fullname



PS C:\\>Set-CrmRecordState $contact Inactive Inactive



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









RELATED LINKS





CommonParameters : True

WorkflowCommonParameters : False

details : @{name=Set-CrmSolutionVersionNumber; noun=; verb=}

Syntax : @{syntaxItem=System.Object[]}

parameters : @{parameter=System.Object[]}

inputTypes : @{inputType=}

returnValues : @{returnValue=}

aliases : None



remarks : None

alertSet :

description :

examples :

Synopsis :

Set-CrmSolutionVersionNumber [-SolutionName] <string> [-VersionNumber] <string> [-conn

<CrmServiceClient>] [<CommonParameters>]



ModuleName : Microsoft.Xrm.Data.Powershell

nonTerminatingErrors :

xmlns:command : http://schemas.microsoft.com/maml/dev/command/2004/10

xmlns:dev : http://schemas.microsoft.com/maml/dev/2004/10

xmlns:maml : http://schemas.microsoft.com/maml/2004/10

Name : Set-CrmSolutionVersionNumber

Category : Function

Component :

Role :

Functionality :