@@ -20,15 +20,25 @@ internal static string PrettyDescription(this string description) =>
2020 . Replace ( "\" " , @"”" )
2121 . Replace ( "\n " , " " ) ;
2222
23- public static bool StandardFieldHasChanged ( this AttributeMetadata attribute , string entityDisplayName )
23+ public static bool StandardFieldHasChanged ( this AttributeMetadata attribute , string entityDisplayName , bool isCustomEntity )
2424 {
2525 if ( attribute . IsCustomAttribute ?? false ) return false ;
2626
2727 var languagecode = attribute . DisplayName . UserLocalizedLabel ? . LanguageCode ;
2828
2929 var fields = GetDefaultFields ( entityDisplayName , languagecode ) ;
30- return fields . StandardDescriptionHasChanged ( attribute . LogicalName , attribute . Description . UserLocalizedLabel ? . Label ?? string . Empty )
30+ var hasTextChanged = fields . StandardDescriptionHasChanged ( attribute . LogicalName , attribute . Description . UserLocalizedLabel ? . Label ?? string . Empty )
3131 || fields . StandardDisplayNameHasChanged ( attribute . LogicalName , attribute . DisplayName . UserLocalizedLabel ? . Label ?? string . Empty ) ;
32+
33+ // Check if options have been added to statecode or statuscode
34+ var hasOptionsChanged = attribute switch
35+ {
36+ StateAttributeMetadata state => StateCodeOptionsHaveChanged ( state ) ,
37+ StatusAttributeMetadata status => StatusCodeOptionsHaveChanged ( status ) ,
38+ _ => false
39+ } ;
40+
41+ return hasTextChanged || hasOptionsChanged ;
3242 }
3343
3444 private static bool StandardDisplayNameHasChanged ( this IEnumerable < ( string LogicalName , string DisplayName , string Description ) > fields , string logicalName , string displayName )
@@ -45,6 +55,16 @@ private static bool StandardDescriptionHasChanged(this IEnumerable<(string Logic
4555 . Any ( f => description . Equals ( f . Description ) ) ;
4656 }
4757
58+ private static bool StateCodeOptionsHaveChanged ( StateAttributeMetadata state )
59+ {
60+ return state . OptionSet ? . Options ? . Count > 2 ;
61+ }
62+
63+ private static bool StatusCodeOptionsHaveChanged ( StatusAttributeMetadata status )
64+ {
65+ return status . OptionSet ? . Options ? . Count > 2 ;
66+ }
67+
4868 private static IEnumerable < ( string LogicalName , string DisplayName , string Description ) > GetDefaultFields ( string entityDisplayName , int ? languageCode )
4969 {
5070 switch ( languageCode )
0 commit comments