November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
When mapping is saved, it is stored into a property of the FormContainerBlock. So it should be there when you do restart/rebuild. Do you have custom the editor for that mapping? Or do you return consitent data from your ExternalFieldMappingService?
The following is the class used for the mapping/autofill:
public class CustomerDataAutofill : IExternalSystem, IAutofillProvider { public string Id => "CustomerDataAutofill"; public IEnumerable<IDatasource> Datasources { get { var datasource = new Datasource() { Id = "ContextCustomerInfo", Name = "Kontextbaserad kunddata", OwnerSystem = this, Columns = new Dictionary<string, string> { {"FirstName", "Förnamn"}, {"LastName", "Efternamn"}, {"EMail", "E-post"}, {"Phone", "Telefonnummer"}, {"Address", "Adress"}, {"PostalCode", "Postnummer"}, {"City", "Ort"}, } }; return new[] { datasource }; } } public IEnumerable<string> GetSuggestedValues(IDatasource selectedDatasource, IEnumerable<RemoteFieldInfo> remoteFieldInfos, ElementBlockBase content, IFormContainerBlock formContainerBlock, HttpContextBase context) { if (selectedDatasource == null || remoteFieldInfos == null) { return Enumerable.Empty<string>(); } if (!this.Datasources.Any(ds => ds.Id == selectedDatasource.Id)) // datasource belong to this system { return Enumerable.Empty<string>(); } var activeRemoteFieldInfo = remoteFieldInfos.FirstOrDefault(mi => mi.DatasourceId == selectedDatasource.Id); if (activeRemoteFieldInfo == null) return Enumerable.Empty<string>(); var currentUser = ServiceLocator.Current.GetInstance<ICurrentUser>(); var restService = ServiceLocator.Current.GetInstance<IRestService>(); switch (activeRemoteFieldInfo.ColumnId) { case "FirstName": return new List<string> { currentUser.FirstName }; case "LastName": return new List<string> { currentUser.LastName }; case "EMail": return new List<string> { currentUser.Email }; case "Phone": var phonenumber = restService.GetContactById(currentUser.ContactId).Telefonnummer1; if (string.IsNullOrWhiteSpace(phonenumber)) phonenumber = restService.GetContactById(currentUser.ContactId).Telefonnummer2; return new List<string> { phonenumber }; case "Address": return new List<string> { restService.GetContactById(currentUser.ContactId).Folkbokforingsadress.StreetAddress }; case "PostalCode": return new List<string> { restService.GetContactById(currentUser.ContactId).Folkbokforingsadress.ZipCode }; case "City": return new List<string> { restService.GetContactById(currentUser.ContactId).Folkbokforingsadress.City }; default: return Enumerable.Empty<string>(); } } }
I have tried your class with Forms and the mappings are still there when I rebuild/restart the site. Are you running custom code to clear/create new database?
Reason for the failures is unknown. We believe a faulty synchronization between servers could have been a reason but we are not really sure. It is working now anyway. :)
I've tried out the External system integration and got it to work but whenever the site is restarted/rebuilt the mappings disappear which makes the functionality useless. Any pointers on where to look or is this just a bug?