Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 55831

Issue with plugin and retrieval of timezone.

$
0
0

Hello,

I had a strange issue recently with an update plugin. The plugin has  function to retrieve the users timezone for proper display of date/time.  This is defined on the Opportunity entity.

It works fine when updating the opportunity directly.  But the plugin also runs when updating the Assigned/Owner of the record.   When this occurs the timezone query result throws a invalid index error.  The index is used here: Entities[0].ToEntity<Entity>

(see full query below).   But why does this work ok on the Opportunity but not the Owner?

Best Regards,

Tom.

var currentUserSettings = service.RetrieveMultiple(
new QueryExpression("usersettings")
{
ColumnSet = new ColumnSet("localeid", "timezonecode"),
Criteria = new FilterExpression
{
Conditions =
{
new ConditionExpression("systemuserid", ConditionOperator.EqualUserId)
}
}
}).Entities[0].ToEntity<Entity>();


Viewing all articles
Browse latest Browse all 55831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>