I would like to update the an AlertStatus record programatically.
I am able to update the TriggerCount and the Notes field as well. I would like to do an update of the LastUpdate record.
I am doing this is perl.
This is working:
my $result = $swql->swis->Update($alert->{uri}, {
'TriggerCount'=> $alert->{triggercount} + 1,
'Notes' => $notes,
});
This is NOT working:
my $time = '2014-04-17T17:31:18';
my $result = $swql->swis->Update($alert->{uri}, {
'TriggerCount'=> $alert->{triggercount} + 1,
'LastUpdate'=> "CAST('".$time."' AS DATETIME)",
'Notes' => $notes,
});
Keep getting this error:
ERROR SolarWinds.InformationService.Core.InformationService - Exception caught in method Update
System.InvalidOperationException: Unable to cast from String to DateTime
at SolarWinds.Data.Query.Expressions.ScalarExpression`1..ctor(T scalar, TypeInformation type)
at SolarWinds.Data.Query.Expressions.QueryExpressionFactory.MakeScalarExpression[T](T value, TypeInformation type)
at SolarWinds.InformationService.Core.CrudProcessor.MakeScalarExpression(Object value, TypeInformation typeInfo)
at SolarWinds.InformationService.Core.CrudProcessor.MapPropertiesToColumns(IDictionary`2 properties, IMappingFragment fragment, IQueryExecutionContext context)
at SolarWinds.InformationService.Core.CrudProcessor.UpdateInternal(Boolean bulkMode, SwisUriResolver uriResolver, IDictionary`2 propertiesToUpdate, IQueryExecutionContext context)
at SolarWinds.InformationService.Core.CrudProcessor.Update(IServiceHost serviceHost, SwisUri uri, IDictionary`2 propertiesToUpdate, IQueryExecutionContext context)
at SolarWinds.InformationService.Core.InformationService.Update(String uri, IDictionary`2 propertiesToUpdate)
',
'faultMessage' => 'Unable to cast from String to DateTime',
'faultstring' => 'Update failed, check fault information.'
Any assistance will be appreciated.
Charles