I've tried this but the step to close my salesorder record did not work because i get an error in my visual studio by defining the CloseOrder Entity. It says that the Entity CloseOrder did not exist.
In this case my workaround is an easy thing: I created a new active statuscode and implemented a jscript that protected all available fields when the new status occurs.
I used the following code:
var request = new FulfillSalesOrderRequest
{
OrderClose = new OrderClose
{
SalesOrderId = new EntityReference
{
LogicalName = "salesorder",
Id = salesorder.Id
}
},
Status = new OptionSetValue(124490018)
};
service.Execute(request);
Did somebody knew the mistake to close my salesorder record?