@@ -113,11 +113,14 @@ export class ResultsBuilder {
113113 // Determine which rollback flag to use based on component type
114114 let rollbackFlagNames : string [ ] = [ ] ;
115115 const componentName = result . name . toLowerCase ( ) ;
116+ const isGlobalAutoNumber =
117+ componentName . includes ( 'global auto number' ) || componentName . includes ( 'globalautonumber' ) ;
118+
116119 if ( componentName . includes ( 'datamapper' ) || componentName . includes ( 'data mapper' ) ) {
117120 rollbackFlagNames = [ 'RollbackDRChanges' ] ;
118121 } else if ( componentName . includes ( 'omniscript' ) || componentName . includes ( 'integration procedure' ) ) {
119122 rollbackFlagNames = [ 'RollbackOSChanges' , 'RollbackIPChanges' ] ;
120- } else if ( componentName . includes ( 'global auto number' ) || componentName . includes ( 'globalautonumber' ) ) {
123+ } else if ( isGlobalAutoNumber ) {
121124 rollbackFlagNames = [ 'RollbackDRChanges' , 'RollbackIPChanges' ] ;
122125 }
123126 const rollbackFlags = orgDetails . rollbackFlags || [ ] ;
@@ -134,15 +137,15 @@ export class ResultsBuilder {
134137 assessmentDate : new Date ( ) . toLocaleString ( ) ,
135138 total : result . data ?. length || 0 ,
136139 filterGroups : [ ...this . getStatusFilterGroup ( result . data ?. map ( ( item ) => item . status ) || [ ] ) ] ,
137- headerGroups : [ ...this . getHeaderGroupsForReport ( componentName ) ] ,
140+ headerGroups : [ ...this . getHeaderGroupsForReport ( componentName , isGlobalAutoNumber ) ] ,
138141 rows : [
139142 ...( result . data || [ ] ) . map ( ( item ) => ( {
140143 rowId : `${ this . rowClass } ${ this . rowId ++ } ` ,
141144 data : [
142145 createRowDataParam ( 'id' , item . id , false , 1 , 1 , true , `${ instanceUrl } /${ item . id } ` ) ,
143146 createRowDataParam ( 'name' , item . name , true , 1 , 1 , false ) ,
144- // Only include migratedId for custom data model
145- ...( isStandardDataModel ( )
147+ // Include migratedId for custom data model OR Global Auto Number
148+ ...( isStandardDataModel ( ) && ! isGlobalAutoNumber
146149 ? [ ]
147150 : [
148151 createRowDataParam (
@@ -198,9 +201,12 @@ export class ResultsBuilder {
198201 fs . writeFileSync ( path . join ( resultsDir , result . name . replace ( / / g, '_' ) . replace ( / \/ / g, '_' ) + '.html' ) , html ) ;
199202 }
200203
201- private static getHeaderGroupsForReport ( componentName : string ) : ReportHeaderGroupParam [ ] {
204+ private static getHeaderGroupsForReport (
205+ componentName : string ,
206+ isGlobalAutoNumber : boolean
207+ ) : ReportHeaderGroupParam [ ] {
202208 const firstRowHeaders = [
203- ...this . getNameHeaders ( componentName ) ,
209+ ...this . getNameHeaders ( componentName , isGlobalAutoNumber ) ,
204210 { name : 'Status' , colspan : 1 , rowspan : 2 } ,
205211 { name : 'Errors' , colspan : 1 , rowspan : 2 } ,
206212 { name : 'Summary' , colspan : 1 , rowspan : 2 } ,
@@ -221,19 +227,18 @@ export class ResultsBuilder {
221227 { name : nameLabel , colspan : 1 , rowspan : 1 } ,
222228 ] ;
223229
224- if ( isStandardDataModel ( ) ) {
230+ // Global Auto Number always needs 4 columns (Managed Package + Standard), even in standard data model
231+ if ( isStandardDataModel ( ) && ! isGlobalAutoNumber ) {
225232 return [ { header : firstRowHeaders } , { header : secondRowHeadersForStandard } ] ;
226233 } else {
227234 return [ { header : firstRowHeaders } , { header : secondRowHeadersForCustom } ] ;
228235 }
229236 }
230237
231- private static getNameHeaders ( componentName : string ) : Array < { name : string ; colspan : number ; rowspan : number } > {
232- let isGlobalAutoNumber = false ;
233- if ( componentName . includes ( 'global auto number' ) || componentName . includes ( 'globalautonumber' ) ) {
234- isGlobalAutoNumber = true ;
235- }
236-
238+ private static getNameHeaders (
239+ componentName : string ,
240+ isGlobalAutoNumber : boolean
241+ ) : Array < { name : string ; colspan : number ; rowspan : number } > {
237242 if ( isStandardDataModel ( ) && ! isGlobalAutoNumber ) {
238243 return [ { name : 'Standard' , colspan : 3 , rowspan : 1 } ] ;
239244 } else {
@@ -287,7 +292,7 @@ export class ResultsBuilder {
287292
288293 const pageSize = 1000 ; // Smaller page size for better performance
289294 const totalLabels = customLabelMigrationInfos . length ;
290- const totalPages = Math . ceil ( totalLabels / pageSize ) ;
295+ const totalPages = Math . max ( 1 , Math . ceil ( totalLabels / pageSize ) ) ;
291296
292297 Logger . logVerbose ( messages . getMessage ( 'generatingCustomLabelsReport' , [ totalLabels , totalPages , pageSize ] ) ) ;
293298
@@ -827,7 +832,7 @@ export class ResultsBuilder {
827832 const totalLabels = result . totalCount || result . data ?. length || 0 ;
828833 // Use actual processed records for file naming, not total count
829834 const processedRecords = result . data ?. length || 0 ;
830- const totalPages = Math . ceil ( processedRecords / 1000 ) ;
835+ const totalPages = Math . max ( 1 , Math . ceil ( processedRecords / 1000 ) ) ;
831836 const fileName = totalPages > 1 ? `Custom_Labels_Page_1_of_${ totalPages } .html` : 'Custom_Labels.html' ;
832837
833838 return {
0 commit comments