< Back

Set-CrmActivityRecordToCloseState

Sat Jan 18, 2020 4:05 pm

NAME Set-CrmActivityRecordToCloseState



SYNOPSIS

Close an activity record.





SYNTAX

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

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



Set-CrmActivityRecordToCloseState [-conn <CrmServiceClient>] [-ActivityEntityType] <String> [-ActivityId] <Guid>

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





DESCRIPTION

The Set-CrmActivityRecordToCloseState cmdlet lets you close an activity record.



There are two ways to specify a record.

1. Pass ActivityEntityType 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 ActivityEntityType/ActivityId



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-StateCode <String>

A State code name. You can use (Get-CrmEntityOptionSet <EntityLogicalName> statecode).Items to get StateCode

strings.



Required? true

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



-StatusCode <String>

A Status code name. You can use (Get-CrmEntityOptionSet <EntityLogicalName> statuscode).Items to get StateCode

strings.



Required? true

Position? 4

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ActivityEntityType <String>

A logicalname for an Activity Entity to close. i.e.)phonecall, email, task, etc..



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ActivityId <Guid>

An Id (guid) of the activity 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-CrmActivityRecordToCloseState -conn $conn -ActivityEntityType task -ActivityId

a0025a70-6317-e511-80da-c4346bc43d94 -StateCode Completed -StatusCode Completed



This example closes a task record as Completed/Completed.







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



Set-CrmActivityRecordToCloseState task a0025a70-6317-e511-80da-c4346bc43d94 Open "In Progress"



This example closes a task record as InProgress/Open.

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







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



PS C:\\>$task = Get-CrmRecord task a0025a70-6317-e511-80da-c4346bc43d94 subject



PS C:\\>Set-CrmActivityRecordToCloseState $task Open "Not Started"



This example retrieves and store a task record, then pass it to Set-CrmActivityRecordToCloseState









RELATED LINKS