Although it seems like this was asked some time ago (and I believe that OP has already found its solution!) I stumbled upon this, looking for a similar answer recently. Further research was required to find out what I needed, so for this reason I will add it here also for everyone who comes across this.
Initially, if you are looking for it, this property is deprecated. Presumably because it was unreliable, but there were several reasons why we needed CallerOrigin in MSCRM 4.0. On the other hand, there are ways to get around this and obsolete:
Preventing endless loops (more than 2 plugins)
It is for this reason that I was looking for CallerOrigin and how I came across this question. I just wanted the plugin to work if it came from the user in the form, and not from another plugin (i.e.Asyc process / webservice). In my case, the difference is that it is "more than two plugins", it is very important because I can not use InputParameters to solve the problem. My example looked like the following:
Update plugin for parent object. If the Status parameter on the parent object was set to Approved, I later wanted to set the status on all child objects to Approved.
Update plugin for child object. If a set of parameters called "Status" on a child has been set to "approved" and all other children of the same parent set this parameter to "Approved". I also needed to update the status on parent and approved.
This causes an endless cycle if you are not protecting yourself from it. You also cannot use InputParameters to solve it. One of the main solutions is to use a depth check:
context.PluginExecutionContext.Depth
If it is more than 1, it was called by another plugin / workflow. Note. If you have a workflow that starts the initial update, you can be careful what value you check.
Preventing synchronization with a standalone client
We were given various properties to help us distinguish them. Use them instead:
context.PluginExecutionContext.IsExecutingOffline context.PluginExecutionContext.IsOfflinePlayback
The response is different depending on what happened.
Okay, so this is the only scenario when we really need CallerOrigin. The only way I think you can do this is by checking the type of the PluginExecutionContext itself. I know that for async this is type:
Microsoft.Crm.Asynchronous.AsyncExecutionContext
and for plugins it looks like this:
Microsoft.Crm.Extensibility.PipelineExecutionContext
Not sure what it is when you come from an external source, unfortunately, I don’t have the code yet to check and understand this. Outside of all this, you probably have to check:
PluginExecutionContext.ParentContext
The only other method I came across to detect where the update came from was using a special flag in the form. So you can create an OptionSet called "OriginOfChange" (or something similar) with parameters
- CRM Form (Javascript onsave)
- Workflow
- Plugin
- and etc.
Then, what ever updates, the object sets this field during the update. Thus, you can check the input parameters each time to find out where the update came from.
This last method is most likely the safest to use if you need to respond differently depending on the source.