Submit a ticket

(Developers only) Changing the implementation logic of passing the products from Dynamics to Oneflow.

If you want to, you can replace the implementation of how we take products/discounts from Dynamics and pass them to Oneflow with your own.

Note: This is an advanced tutorial addressed to people who are experienced Dynamics CRM Developers. 

So, in order to replace the implementation we’ll need to register a plugin step for a ‘of_GetProductsPayload' message: 

It should be synchronous and should execute on PostOperation. 

When the Execute method of your plug-in is called, you’ll get the following input and output parameters: 

Param NameDirectionData typeDescription
errorMessageOutputstringError details if an exception occurred

indicates whether an error occurred during the oob’s operation


JSON string, contains the agreementId in oneflow and opportunityId of the opportunity in Dynamics to take the products from.

resultOutputstringresulting JSON string of products to add to the oneflow contract.


requestData format:

{requestData: "{"opportunityId":"E01D4725-8E1D-EA11-A811-000D3AB409EA","agreementId":1107536}"}

result format:

{"agreementId":1107552,"payload":{"items":[{"name":"Greatest Product ever","price":15.0000,"quantity":2},{"description":"Discount for Greatest Product ever","discount":"5.0000","name":"Discount","price":0,"quantity":1},{"description":"Glasses","name":"Glasses","price":15.0000,"quantity":1},{"description":"","name":"Tax","price":10.0000,"quantity":1},{"description":"","discount":"3.9500","name":"Discount for the whole order","price":0,"quantity":1}]}}

The payload field contains a JSON that’s passed to Oneflow API directly. 

You can read more about the object in Oneflow API docs at

Alright, so now, if you want to have your own implementation of products, you just need to replace the original result json with your own, like so:

  1.         string requestData = (string)context.ExecutionContext.InputParameters["requestData"];
  2.         string result = (string)context.ExecutionContext.OutputParameters["result"];
  3.         bool isError = (bool)context.ExecutionContext.OutputParameters["isError"];
  4.         string errorMessage = (string)context.ExecutionContext.OutputParameters["errorMessage"];
  6.         object oldResultParsed = JSON.Deserialize(result);
  7.         // parse old result and process if needed
  8.         // ... 
  9.         // ... 
  10.         // ...
  11.         // create your own json
  12.         object myResult = .....;
  13.         string myResultJson = JSON.Serialize(myResult);
  14.         context.ExecutionContext.OutputParameters["result"] = myResultJson;

That's it! 

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.