Hi All,
I am using below code to get timezone code value from timezone entity which is a lookup in Opportunity
var query = new QueryExpression(OPPORTUNITY.EntityLogicalName);
query.ColumnSet.AddColumns(OPPORTUNITY.timezoneid, OPPORTUNITY.nristarttime, OPPORTUNITY.nriendtime, OPPORTUNITY.OpportunityId);
query.Criteria.AddCondition(OPPORTUNITY.OpportunityId, ConditionOperator.Equal, targetEntity.Id);
var tZ = query.AddLink("new_timezone", "new_timezoneid", "new_timezoneid", JoinOperator.LeftOuter);
tZ.EntityAlias = "tZ";
tZ.Columns.AddColumns("new_timezonecode");
EntityCollection retrieveColl = organizationService.RetrieveMultiple(query);
tracingService.Trace("Line 323 " + retrieveColl.Entities.Count);
if (retrieveColl != null && retrieveColl.Entities.Count > 0)
{
timeZoneCode = retrieveColl.Entities[0].Attributes.Contains("tZ.new_timezonecode") ? ((AliasedValue)retrieveColl.Entities[0].Attributes["tZ.new_timezonecode"]).Value.ToString() : string.Empty;
tracingService.Trace("Line 325 " + timeZoneCode);
GetLeadData(tracingService, ref nriStartDate, ref nriEndDate, ref timezoneID, retrieveColl);
}
Here when timezone is first time empty & we are trying to update this field value then getting retrieveColl count as 1 but Linq is not working means timezone code not getting.Anything doing wrong here?
But it is working if 2nd time i am updating timezone lookup value on opportunity

But in postoperationUpdate its working fine in prevalidation its taking previous value.
Thanks,
Jharana