RE: How to get data from cancel salesorder step
Hi,
When we select calcel sales order from UI, New Order Close Entity record will be created by the system.
To fix your issue. please register plugin step as shown below.

Select Pre-operation/Post-Operation based on requirement in execution pipeline.
Use below code to get record ID (Order ID)
using Microsoft.Crm.Sdk.Messages;
using Microsoft.Xrm.Sdk;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.Crm.Sdk.Samples
{
public class CancleSalesOrder : IPlugin
{
public void Execute(IServiceProvider serviceProvider)
{
//Extract the tracing service for use in debugging sandboxed plug-ins.
ITracingService tracingService =
(ITracingService)serviceProvider.GetService(typeof(ITracingService));
// Obtain the execution context from the service provider.
IPluginExecutionContext context = (IPluginExecutionContext)
serviceProvider.GetService(typeof(IPluginExecutionContext));
// Obtain the organization service reference.
IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
{
//Order Close
Entity orderClose = context.InputParameters["Target"] as Entity;
if (orderClose.Attributes.Contains("salesorderid") && orderClose["salesorderid"] != null)
{
EntityReference salesOrder = orderClose.GetAttributeValue("salesorderid");
//To Get Order ID
Guid orderId = salesOrder.Id;
}
}
}
}
}
You could also get additional fields from context Target Entity

If found helpful, Please mark my answer verified.