Hello,
I have a custom C# console task that is targeted towards incidents. When the
task runs, it updates a field on the incident. This works great when the
console task is run on an incident by selecting the incident in a simple
incident grid view in the console. However, the console task also appears as a
task on the Incident edit form. When a user applies changes to an incident and
then tries to run this console task, we get a
DiscoveryDataModificationCollisionException.
I see only two ways to avoid this:
1. Prevent the console task from appearing as a task on the incident edit
form. How would I do this?
2. Find a different way to update the field on the incident than the way
I am doing now. Am I doing the update the wrong way?
My update code looks like this
public override void ExecuteCommand(IList<NavigationModelNodeBase> nodes,
NavigationModelNodeTask task, ICollection<string> parameters)
{
var node = nodes[0];
EnterpriseManagementObject emo = node["$EMOInstance$"] as
EnterpriseManagementObject;
IList<ManagementPackProperty> properties = emo.GetProperties();
emo[properties.Where(p => p.Name == "<fieldtoupdate>").First()].Value =
"<newvalue>";
emo.Commit();
this.RequestViewRefresh();
}
Thanks!
Brandon Ryan
Software Engineer |
[email protected]<mailto:[email protected]>
ClearPointe(r) | 7 Office Park Dr., Suite 200 | Little Rock, AR |
www.clearpointe.com<http://www.clearpointe.com/>
MANAGED IT SERVICES: Your IT. Our People. 24/7. Guaranteed.