Can I have a confirmation box in a synchronous (or asynchronous) plug-in.
I need some confirmation for an import:
3 new products will be created
2 new departments will be created
(Click OK to Proceed)
Currently there is a staging entity for periodic price list imports from excel;
the plug-in is registered ‘On Create’ of this entity and creates or updates products and price list items (and creates, but does not update, departments, accounts, and classifications)
The user does not want to have to perform multiple imports every time the supplier releases a new price list; is there a better way to handle the whole situation?
I don’t think you can have a message box (or any other UI interaction in a plug in. Sometimes, a plugin will be invoked by a service or a workflow with no users logged in at all. What would happen to the output window in such case?
As far my understanding goes, if you wish to communicate with the user, you need to rely on JS. The nice coding of .NET is, in CRM, reserved for server operations.
In case the number of operations to perform is large (or likely to grow larger and larger, as in your case), I’d go with the following approach.
Since the process is supposed to be invoked upon user interaction, I’d go with JavaScript, and implement an appropriate onSomeEvent method that creates a single instance of an auxiliary entity Hazaa (or perhaps ProducLineSetter*, to be more explicit on what it does).
Then, I’d deploy a plugin that responds to Create message and does all the magic for me. That includes creating/configuring all the required entities (prices, products and what not).
I love C#, so to keep my answer moderate I feel that I also need to add that the second step could be also resolved by a number of calls in JavaScript too. In such case, for the love of god, place it in a separate JS file and add it as a web resource. 🙂