0

I need to run a particular action in Dynamics 365 for every record that gets created in a entity. i'm able to do it via script component(in C#).

The problem is script component opens CRM connection, executes a action and closes the connection for every record from my input. Input to script component is a single column(result from fetchXML) containing the GUID's of record on which i need to run the action.

The way i'm doing now is to add the GUID of record in Input0_ProcessInputRow() method to a list and execute the respective action in a batch of 10 records in PostExecute().

I understand PostExecute() is usually used for cleanup things.

I'm looking for a better/clean way to do this?

Ramu
  • 343
  • 1
  • 6
  • 21
  • The only other approach I can think of is to set the component as asynchronous and then you can invoke the call in the OnProcessCurrentRow (name approximate) method. Pseudo logic ~ `Add GUID to list, if list size >= 10, CallCRM() + list.Clear()` and you'd need to have the CallCRM() method in the PostExecute to take care of the last 0-9 stragglers – billinkc Nov 23 '20 at 19:28
  • @billinkc that sounds reasonable, but i'm still need to call CallCRM() in PostExecute. It does a good job of taking load of executing all the records at one go, just 0-9 to take care of. Looking to avoid any logic/function call at PostExecute – Ramu Nov 23 '20 at 20:00
  • Correct, that or you can only ever process "batch size" source rows. The only thing the above approach would gain you is that you would get data trickling in during the whole ETL instead of large scale activity at the end. Pushing one knob down results in another one popping up but maybe it's a net gain for the operation. Hard to say without knowing concrete details. – billinkc Nov 23 '20 at 21:01

0 Answers0