protected override void Execute(CodeActivityContext eContext) { // Setup var context = eContext.GetExtension <IWorkflowContext>(); var serviceFactory = eContext.GetExtension <IOrganizationServiceFactory>(); var service = serviceFactory.CreateOrganizationService(context.UserId); var codeString = TimeZoneCodeString.Get(eContext); int code; if (String.IsNullOrWhiteSpace(codeString) || !Int32.TryParse(codeString, out code)) { var settings = UserSettings.GetUserSettings(service, context.UserId); code = (int)settings.Attributes["timezonecode"]; } var req = new UtcTimeFromLocalTimeRequest { TimeZoneCode = code, LocalTime = LocalDateTime.Get(eContext) }; var resp = (UtcTimeFromLocalTimeResponse)service.Execute(req); if (resp == null) { return; } UTCDateTime.Set(eContext, resp.UtcTime); }