/// <summary> /// Gets the entity's option set value's int value based on its text value. /// </summary> /// <param name="settings">The CrmService settings.</param> /// <param name="entityName">Logical name of the entity.</param> /// <param name="attributeName">Name of the attribute.</param> /// <param name="optionTextValue">The text value of the OptionSetValue.</param> /// <returns></returns> public static int GetEntityOptionValue(this CrmService settings, string entityName, string attributeName, string optionTextValue) { return(settings.GetEntityOption(entityName, attributeName, optionTextValue).Value.GetValueOrDefault()); }
/// <summary> /// Gets the entity's option set value's text value based on its int value. /// </summary> /// <param name="settings">The CrmService settings.</param> /// <param name="entityName">Logical name of the entity.</param> /// <param name="attributeName">Name of the attribute.</param> /// <param name="value">The int value of the OptionSetValue.</param> /// <returns></returns> public static string GetEntityOptionText(this CrmService settings, string entityName, string attributeName, int value) { return(settings.GetEntityOption(entityName, attributeName, value).GetText()); }