/// <summary> /// Replace the items in my items list, which is the list passed in by the caller, with /// the options returned for the 'category_id' field of the 'email' module. /// </summary> public override string Perform() { try { Field field = RestAPIWrapper.GetFieldsForModule("Emails").moduleFields.FirstOrDefault(x => x.name == "category_id"); if (field != null) { Properties.Settings.Default.EmailCategories.IsImplemented = true; Properties.Settings.Default.EmailCategories.Clear(); Properties.Settings.Default.EmailCategories.AddRange(field.Options.Keys.OrderBy(x => x)); } else { /* the CRM instance does not have the category_id field in its emails module */ Properties.Settings.Default.EmailCategories.IsImplemented = false; } Properties.Settings.Default.Save(); return("OK"); } catch (WebException wex) { if (wex.Status == WebExceptionStatus.Timeout) { throw new ActionRetryableException("Temporary network error", wex); } else { throw; } } }
/// <summary> /// Replace the items in my items list, which is the list passed in by the caller, with /// the options returned for the 'category_id' field of the 'email' module. /// </summary> public override string Perform() { Field field = RestAPIWrapper.GetFieldsForModule("Emails").moduleFields.FirstOrDefault(x => x.name == "category_id"); if (field != null) { Properties.Settings.Default.EmailCategories.IsImplemented = true; Properties.Settings.Default.EmailCategories.Clear(); Properties.Settings.Default.EmailCategories.AddRange(field.Options.Keys.OrderBy(x => x)); } else { /* the CRM instance does not have the category_id field in its emails module */ Properties.Settings.Default.EmailCategories.IsImplemented = false; } Properties.Settings.Default.Save(); return(string.Empty); }