Question

I want to create a record of an entity, but I need to pass a list of guids to the pre create plugin. I don't want to create fields or related entities to do this. Can I use the Shared Variables to do it?

In other words is it possible to set shared variables before initiating the action that will trigger the plugins that will consume them?

EDIT:

I can be creating this type of records from different points that integrate with crm, silverlight, external pages or even plugins of other entities. My current problem can be solved with a field on the entity, but this way if I had to send parameters to control the execution of the plugin for two or more independent actions I would need one field for each action or instead use only one field using a complex format/parse pattern to parameterize each different action. Using fields to accomplish this feature looks a bit excessive.

If the shared variables could be set before the call of the action that will trigger the plugin that would solve the problem and I wouldn't have to create fields in the crm database, because the data I want to pass to the plugin it will only be needed at that time, like a parameter in a function, no need to persist them in the database.

But if it is not possible I will have to stick with the fields :(

Was it helpful?

Solution

Not if they vary by entity/execution of the plugin.

Options:

  1. Set them in the plugin configuration if they don't change but need to be updated without a recompile.
  2. Apply them as a delimited string in a single field on the entity if they vary per record.

What's the reason for not wanting to use 2?

OTHER TIPS

Nope. The easiest solution that I can think of is to add a BAT (big-ass text) field to the entity and populate it with a comma-delimited list of GUIDs, then access that field in your Create plugin. You could even clear it out if you don't want that extra data in your system.

Edit after your edit: General comment about your thinking process: you are probably overthinking it. :) Using a single field, you could pass in any kind of "command" using a json or xml formatted string. As I said above, in the pre-create plugin, after you have extracted this "argument" field, you can clear out that field in the Target entity image and that data will never be persisted to the database. Technically it achieves the exact result you want with the only side effect being one extra "argument" field that is always NULL in the database. Don't fight simplicity so hard! :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top