$conn = Get-CrmConnection -InteractiveMode
$conn.BypassPluginExecution = $true
- $conn = Get-CrmConnection -InteractiveMode: This command initiates an interactive session to prompt the user for login credentials and establish a connection to Dynamics CRM. Upon successful connection, the connection object is stored in the $conn variable.
- $conn.BypassPluginExecution = $true: This line sets the BypassPluginExecution property of the $conn object to $true, indicating that plugin execution should be bypassed for operations performed through this connection.
$crmConnection = Get-CrmConnection -InteractiveMode
$crmConnection.BypassPluginExecution = $true
# Define CRM connection details
$crmUrl = "https://allam.crm8.dynamics.com/"
$accessToken = $crmConnection.CurrentAccessToken
$headers = @{
"Authorization" = "Bearer $accessToken"
"OData-MaxVersion" = "4.0"
"OData-Version" = "4.0"
"Accept" = "application/json"
"Content-Type" = "application/json; charset=utf-8"
}
# Specify the unique identifier (GUID) of the plugin step you want to disable
$pluginStepId = "63b5066c-cecf-ee11-904d-6045bdad183f"
# Construct the URL to update the plugin step's status
$pluginStepUrl = "$crmUrl/api/data/v9.0/sdkmessageprocessingsteps($pluginStepId)"
# Define the payload to update the plugin step's status to disabled
$statusUpdatePayload = @{
statecode = 1 # Set state code to 'Disabled'
statuscode = 2 # Set status code to 'Disabled'
} | ConvertTo-Json
# Send HTTP PATCH request to update the plugin step's status
Invoke-RestMethod -Uri $pluginStepUrl -Headers $headers -Method Patch -Body $statusUpdatePayload
$crmConnection = Get-CrmConnection -InteractiveMode
$crmConnection.BypassPluginExecution = $true
# Define CRM connection details
$crmUrl = "https://allam.crm8.dynamics.com/"
$accessToken = $crmConnection.CurrentAccessToken
$headers = @{
"Authorization" = "Bearer $accessToken"
"OData-MaxVersion" = "4.0"
"OData-Version" = "4.0"
"Accept" = "application/json"
"Content-Type" = "application/json; charset=utf-8"
}
# Specify the unique identifier (GUID) of the plugin step you want to disable
$pluginStepId = "63b5066c-cecf-ee11-904d-6045bdad183f"
# Construct the URL to update the plugin step's status
$pluginStepUrl = "$crmUrl/api/data/v9.0/sdkmessageprocessingsteps($pluginStepId)"
# Define the payload to update the plugin step's status to disabled
$statusUpdatePayload = @{
statecode = 0 # Set state code to enabled
statuscode = 1 # Set status code to enabled
} | ConvertTo-Json
# Send HTTP PATCH request to update the plugin step's status
Invoke-RestMethod -Uri $pluginStepUrl -Headers $headers -Method Patch -Body $statusUpdatePayload