public static void InitializeUtils(ISFDCListener _subscirber, IAgentDetails _agentDetails, IConfService _confService) { try { logger = Log.GenInstance(); logger.Info("InitializeUtils : Reading Configuration and Initializing Properties......"); AgentDetails = _agentDetails; ConfigService = _confService; SFDCListener = _subscirber; foreach (string sfdcObject in SFDCOptions.SFDCPopupPages) { KeyValueCollection ConfigData = null; if (sfdcObject == "lead") { CommonPopupObjects += "Lead,"; logger.Info("InitializeUtils : Reading SFDCLead Configuration and Initializing Properties......"); LeadConfigs = ReadConfiguration.GetInstance().ReadSFDCObjectConfig(_agentDetails.MyApplication, _agentDetails.AgentGroups, _agentDetails.Person, sfdcObject); if (LeadConfigs != null) { LeadVoiceOptions = ReadProperties.GetInstance().GetSFDCObjectVoiceProperties(LeadConfigs, sfdcObject); LeadChatOptions = ReadProperties.GetInstance().GetSFDCObjectChatProperties(LeadConfigs, sfdcObject); ConfigData = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "voice." + sfdcObject); if (ConfigData != null) { VoiceActivityLogCollection.Add(sfdcObject, ConfigData); } ConfigData = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "chat." + sfdcObject); if (ConfigData != null) { ChatActivityLogCollection.Add(sfdcObject, ConfigData); } LeadNewRecordConfigs = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.NewRecordDataBusinessAttribute, sfdcObject); } else { logger.Info("InitializeUtils : No Lead Configuration Found."); } } else if (sfdcObject == "contact") { CommonPopupObjects += "Contact,"; logger.Info("InitializeUtils : Reading SFDCContact Configuration and Initializing Properties......"); ContactConfigs = ReadConfiguration.GetInstance().ReadSFDCObjectConfig(_agentDetails.MyApplication, _agentDetails.AgentGroups, _agentDetails.Person, sfdcObject); if (ContactConfigs != null) { ContactVoiceOptions = ReadProperties.GetInstance().GetSFDCObjectVoiceProperties(ContactConfigs, sfdcObject); ContactChatOptions = ReadProperties.GetInstance().GetSFDCObjectChatProperties(ContactConfigs, sfdcObject); ConfigData = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "voice." + sfdcObject); if (ConfigData != null) { VoiceActivityLogCollection.Add(sfdcObject, ConfigData); } ConfigData = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "chat." + sfdcObject); if (ConfigData != null) { ChatActivityLogCollection.Add(sfdcObject, ConfigData); } ContactNewRecordConfigs = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.NewRecordDataBusinessAttribute, sfdcObject); } else { logger.Info("InitializeUtils : No Contact Configuration Found."); } } else if (sfdcObject == "account") { CommonPopupObjects += "Account,"; logger.Info("InitializeUtils : Reading SFDCAccount Configuration and Initializing Properties......"); AccountConfigs = ReadConfiguration.GetInstance().ReadSFDCObjectConfig(_agentDetails.MyApplication, _agentDetails.AgentGroups, _agentDetails.Person, sfdcObject); if (AccountConfigs != null) { AccountVoiceOptions = ReadProperties.GetInstance().GetSFDCObjectVoiceProperties(AccountConfigs, sfdcObject); AccountChatOptions = ReadProperties.GetInstance().GetSFDCObjectChatProperties(AccountConfigs, sfdcObject); AccountNewRecordConfigs = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.NewRecordDataBusinessAttribute, sfdcObject); ConfigData = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "voice." + sfdcObject); if (ConfigData != null) { VoiceActivityLogCollection.Add(sfdcObject, ConfigData); } ConfigData = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "chat." + sfdcObject); if (ConfigData != null) { ChatActivityLogCollection.Add(sfdcObject, ConfigData); } } else { logger.Info("InitializeUtils : No Account Configuration Found."); } } else if (sfdcObject == "case") { CommonPopupObjects += "Case,"; logger.Info("InitializeUtils : Reading SFDCCase Configuration and Initializing Properties......"); CaseConfigs = ReadConfiguration.GetInstance().ReadSFDCObjectConfig(_agentDetails.MyApplication, _agentDetails.AgentGroups, _agentDetails.Person, sfdcObject); if (CaseConfigs != null) { CaseVoiceOptions = ReadProperties.GetInstance().GetSFDCObjectVoiceProperties(CaseConfigs, sfdcObject); CaseChatOptions = ReadProperties.GetInstance().GetSFDCObjectChatProperties(CaseConfigs, sfdcObject); CaseNewRecordConfigs = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.NewRecordDataBusinessAttribute, sfdcObject); ConfigData = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "voice." + sfdcObject); if (ConfigData != null) { VoiceActivityLogCollection.Add(sfdcObject, ConfigData); } ConfigData = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "chat." + sfdcObject); if (ConfigData != null) { ChatActivityLogCollection.Add(sfdcObject, ConfigData); } } else { logger.Info("InitializeUtils : No Case Configuration Found."); } } else if (sfdcObject == "opportunity") { CommonPopupObjects += "Opportunity,"; logger.Info("InitializeUtils : Reading SFDCOpportunity Configuration and Initializing Properties......"); OpportunityConfigs = ReadConfiguration.GetInstance().ReadSFDCObjectConfig(_agentDetails.MyApplication, _agentDetails.AgentGroups, _agentDetails.Person, sfdcObject); if (OpportunityConfigs != null) { OpportunityVoiceOptions = ReadProperties.GetInstance().GetSFDCObjectVoiceProperties(OpportunityConfigs, sfdcObject); OpportunityChatOptions = ReadProperties.GetInstance().GetSFDCObjectChatProperties(OpportunityConfigs, sfdcObject); OpportunityNewRecordConfigs = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.NewRecordDataBusinessAttribute, sfdcObject); ConfigData = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "voice." + sfdcObject); if (ConfigData != null) { VoiceActivityLogCollection.Add(sfdcObject, ConfigData); } ConfigData = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "chat." + sfdcObject); if (ConfigData != null) { ChatActivityLogCollection.Add(sfdcObject, ConfigData); } } else { logger.Info("InitializeUtils : No Opportunity Configuration Found."); } } else if (sfdcObject.Contains("customobject")) { logger.Info("InitializeUtils : Reading SFDCCustomObject Configuration and Initializing Properties......"); logger.Info("InitializeUtils : Object Name : " + sfdcObject); KeyValueCollection customConfig = ReadConfiguration.GetInstance().ReadSFDCObjectConfig(_agentDetails.MyApplication, _agentDetails.AgentGroups, _agentDetails.Person, sfdcObject); if (customConfig != null) { CustomObjectConfigs.Add(sfdcObject, customConfig); VoiceOptions voiceOptions = ReadProperties.GetInstance().GetSFDCObjectVoiceProperties(customConfig, sfdcObject); if (voiceOptions != null) { if (voiceOptions.ObjectName != null) { CommonPopupObjects += voiceOptions.ObjectName + ","; CustomObjectNames.Add(voiceOptions.ObjectName, sfdcObject); } CustomObjectVoiceOptions.Add(sfdcObject, voiceOptions); } ChatOptions chatOptions = ReadProperties.GetInstance().GetSFDCObjectChatProperties(customConfig, sfdcObject); if (chatOptions != null) { CustomObjectChatOptions.Add(sfdcObject, chatOptions); } CustomObjectNewRecordConfigs.Add(sfdcObject, ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.NewRecordDataBusinessAttribute, sfdcObject)); ConfigData = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "voice." + sfdcObject); if (ConfigData != null) { VoiceActivityLogCollection.Add(sfdcObject, ConfigData); } ConfigData = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "chat." + sfdcObject); if (ConfigData != null) { ChatActivityLogCollection.Add(sfdcObject, ConfigData); } } else { logger.Info("InitializeUtils : No Configuration Found for the CustomObject : " + sfdcObject); } } else if (sfdcObject == "useractivity") { logger.Info("InitializeUtils : Reading SFDCUserActivity Configuration and Initializing Properties......"); UserActivityConfigs = ReadConfiguration.GetInstance().ReadSFDCObjectConfig(_agentDetails.MyApplication, _agentDetails.AgentGroups, _agentDetails.Person, sfdcObject); if (UserActivityConfigs != null) { UserActivityVoiceOptions = ReadProperties.GetInstance().GetSFDCUserActivityVoiceProperties(UserActivityConfigs, sfdcObject); KeyValueCollection voiceUserActivityLog = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "voice." + sfdcObject); if (voiceUserActivityLog != null) { VoiceActivityLogCollection.Add(sfdcObject, voiceUserActivityLog); } UserActivityChatOptions = ReadProperties.GetInstance().GetSFDCUserActivityChatProperties(UserActivityConfigs, sfdcObject); KeyValueCollection chatuseractivitylog = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "chat." + sfdcObject); if (chatuseractivitylog != null) { ChatActivityLogCollection.Add(sfdcObject, chatuseractivitylog); } } else { logger.Info("InitializeUtils : No SFDCUserActivity Configuration Found."); } } } if (!String.IsNullOrEmpty(CommonPopupObjects)) { CommonPopupObjects = CommonPopupObjects.Substring(0, CommonPopupObjects.Length - 1); } if (SFDCOptions.CanUseCommonSearchData) { //Read business attribute for Profile level activity if (!string.IsNullOrWhiteSpace(SFDCOptions.ProfileActivityBusinessAttributeName)) { ProfileLevelActivity = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ProfileActivityBusinessAttributeName, "voice.useractivity"); } else { logger.Info("ProfileLevel Activity Log Creation is not configured"); } } } catch (Exception generalException) { logger.Error("InitializeUtils : Error Occurred while Reading SFDC Object configurations : " + generalException.ToString()); } }
private static void ReadCustomObjectConfigurations(string sfdcObjectName) { try { _logger.Info("Initialize: Reading CustomObject Configuration and Initializing Properties......"); _logger.Info("Initialize: Object Name : " + sfdcObjectName); KeyValueCollection customConfig = ReadConfiguration.GetInstance().ReadSFDCUtilityConfig(AgentDetails.MyApplication, AgentDetails.AgentGroups, AgentDetails.Person, sfdcObjectName); if (customConfig != null) { CustomObjectConfigs.Add(sfdcObjectName, customConfig); if (IsVoiceEnabled) { _logger.Info("Reading Voice Options for the " + sfdcObjectName + " object"); VoiceNewRecordCollection.Add(sfdcObjectName, ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, AgentDetails.Person.Tenant.DBID, SFDCOptions.NewRecordDataBusinessAttribute, "voice." + sfdcObjectName)); VoiceOptions voiceOptions = ReadProperties.GetInstance().GetSFDCObjectVoiceProperties(customConfig, sfdcObjectName); if (voiceOptions != null) { if (voiceOptions.ObjectName != null && !CustomObjectNames.ContainsKey(voiceOptions.ObjectName + ",")) { CommonPopupObjects += voiceOptions.ObjectName + ","; CustomObjectNames.Add(voiceOptions.ObjectName, sfdcObjectName); } CustomObjectVoiceOptions.Add(sfdcObjectName, voiceOptions); } ConfigData = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, AgentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "voice." + sfdcObjectName); if (ConfigData != null) { VoiceActivityLogCollection.Add(sfdcObjectName, ConfigData); } } if (IsChatEnabled) { _logger.Info("Reading Chat Options for the " + sfdcObjectName + " object"); ChatNewRecordCollection.Add(sfdcObjectName, ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, AgentDetails.Person.Tenant.DBID, SFDCOptions.NewRecordDataBusinessAttribute, "chat." + sfdcObjectName)); ChatOptions chatOptions = ReadProperties.GetInstance().GetSFDCObjectChatProperties(customConfig, sfdcObjectName); if (chatOptions != null) { if (chatOptions.ObjectName != null && !CustomObjectNames.ContainsKey(chatOptions.ObjectName + ",")) { CommonPopupObjects += chatOptions.ObjectName + ","; CustomObjectNames.Add(chatOptions.ObjectName, sfdcObjectName); } CustomObjectChatOptions.Add(sfdcObjectName, chatOptions); } ConfigData = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, AgentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "chat." + sfdcObjectName); if (ConfigData != null) { ChatActivityLogCollection.Add(sfdcObjectName, ConfigData); } } if (IsEmailEnabled) { _logger.Info("Reading Email Options for the " + sfdcObjectName + " object"); EmailOptions emailOptions = ReadProperties.GetInstance().GetSFDCObjectEmailProperties(customConfig, sfdcObjectName); if (emailOptions != null) { if (emailOptions.ObjectName != null && !CustomObjectNames.ContainsKey(emailOptions.ObjectName + ",")) { CommonPopupObjects += emailOptions.ObjectName + ","; CustomObjectNames.Add(emailOptions.ObjectName, sfdcObjectName); } CustomObjectEmailOptions.Add(sfdcObjectName, emailOptions); } EmailNewRecordCollection.Add(sfdcObjectName, ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, AgentDetails.Person.Tenant.DBID, SFDCOptions.NewRecordDataBusinessAttribute, "email." + sfdcObjectName)); ConfigData = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, AgentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "email." + sfdcObjectName); if (ConfigData != null) { EmailActivityLogCollection.Add(sfdcObjectName, ConfigData); } } } else { _logger.Info("Initialize: CustomObject Configuration Not Found."); } } catch (Exception generalException) { _logger.Error("Error occurred in CustomObjectConfigurations() method, Exception:" + generalException.ToString()); } }