@@ -89,8 +89,7 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
8989
9090 // Perform Records Migration from VlocityCard__c to OmniUiCard
9191 async migrate ( ) : Promise < MigrationResult [ ] > {
92- // Get All the Active VlocityCard__c records
93- const allCards = await this . getAllActiveCards ( ) ;
92+ const allCards = await this . getAllCards ( ) ;
9493
9594 Logger . log ( this . messages . getMessage ( 'foundFlexCardsToMigrate' , [ allCards . length ] ) ) ;
9695
@@ -156,7 +155,7 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
156155 public async assess ( ) : Promise < FlexCardAssessmentInfo [ ] > {
157156 try {
158157 Logger . log ( this . messages . getMessage ( 'startingFlexCardAssessment' ) ) ;
159- const flexCards = await this . getAllActiveCards ( ) ;
158+ const flexCards = await this . getAllCards ( ) ;
160159 Logger . log ( this . messages . getMessage ( 'foundFlexCardsToAssess' , [ flexCards . length ] ) ) ;
161160
162161 const flexCardsAssessmentInfos = await this . processCardComponents ( flexCards ) ;
@@ -234,20 +233,10 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
234233 'Ready for migration' ;
235234 flexCardAssessmentInfo . name = this . allVersions ? `${ cleanedName } _${ version } ` : cleanedName ;
236235 if ( cleanedName !== originalName ) {
237- if ( ! this . IS_STANDARD_DATA_MODEL ) {
238- flexCardAssessmentInfo . warnings . push (
239- this . messages . getMessage ( 'cardNameChangeMessage' , [ originalName , cleanedName ] )
240- ) ;
241- assessmentStatus = getUpdatedAssessmentStatus ( assessmentStatus , 'Warnings' ) ;
242- } else {
243- flexCardAssessmentInfo . warnings . push (
244- this . messages . getMessage ( 'needManualInterventionAsSpecialCharsInFlexcardName' )
245- ) ;
246- flexCardAssessmentInfo . errors . push (
247- this . messages . getMessage ( 'needManualInterventionAsSpecialCharsInFlexcardName' )
248- ) ;
249- assessmentStatus = 'Needs Manual Intervention' ;
250- }
236+ flexCardAssessmentInfo . warnings . push (
237+ this . messages . getMessage ( 'cardNameChangeMessage' , [ originalName , cleanedName ] )
238+ ) ;
239+ assessmentStatus = getUpdatedAssessmentStatus ( assessmentStatus , 'Warnings' ) ;
251240 }
252241
253242 // Check for duplicate names
@@ -404,23 +393,13 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
404393
405394 // Add warning if child card name will change
406395 if ( childCardName !== cleanedChildCardName ) {
407- if ( ! this . IS_STANDARD_DATA_MODEL ) {
408- flexCardAssessmentInfo . warnings . push (
409- this . messages . getMessage ( 'cardNameChangeMessage' , [ childCardName , cleanedChildCardName ] )
410- ) ;
411- flexCardAssessmentInfo . migrationStatus = getUpdatedAssessmentStatus (
412- flexCardAssessmentInfo . migrationStatus ,
413- 'Warnings'
414- ) ;
415- } else {
416- flexCardAssessmentInfo . warnings . push (
417- this . messages . getMessage ( 'needManualInterventionAsSpecialCharsInChildFlexcardName' )
418- ) ;
419- flexCardAssessmentInfo . errors . push (
420- this . messages . getMessage ( 'needManualInterventionAsSpecialCharsInChildFlexcardName' )
421- ) ;
422- flexCardAssessmentInfo . migrationStatus = 'Needs Manual Intervention' ;
423- }
396+ flexCardAssessmentInfo . warnings . push (
397+ this . messages . getMessage ( 'cardNameChangeMessage' , [ childCardName , cleanedChildCardName ] )
398+ ) ;
399+ flexCardAssessmentInfo . migrationStatus = getUpdatedAssessmentStatus (
400+ flexCardAssessmentInfo . migrationStatus ,
401+ 'Warnings'
402+ ) ;
424403 }
425404 }
426405 } catch ( err ) {
@@ -694,8 +673,7 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
694673 }
695674 }
696675
697- // Query all cards that are active
698- private async getAllActiveCards ( ) : Promise < AnyJson [ ] > {
676+ private async getAllCards ( ) : Promise < AnyJson [ ] > {
699677 //DebugTimer.getInstance().lap('Query Vlocity Cards');
700678 const filters = new Map < string , any > ( ) ;
701679
@@ -740,7 +718,7 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
740718 }
741719 }
742720
743- // Upload All the VlocityCard__c records to OmniUiCard
721+ // Upload All the VlocityCard__c records to OmniUiCard for custom model and update references for standard
744722 private async uploadAllCards (
745723 cards : any [ ] ,
746724 progressBar : ReturnType < typeof createProgressBar >
@@ -789,42 +767,13 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
789767 }
790768 }
791769
792- const isChildCardUpdated : boolean = this . updateChildCards ( card ) ;
793-
794- if ( this . IS_STANDARD_DATA_MODEL && isChildCardUpdated ) {
795- originalRecords . set ( recordId , card ) ;
796-
797- cardsUploadInfo . set ( recordId , {
798- referenceId : recordId ,
799- hasErrors : true ,
800- success : false ,
801- errors : [ this . messages . getMessage ( 'needManualInterventionAsSpecialCharsInChildFlexcardName' ) ] ,
802- warnings : [ ] ,
803- } ) ;
804-
805- return ;
806- }
770+ this . updateChildCards ( card ) ;
807771 }
808772
809773 // Perform the transformation
810774 const invalidIpNames = new Map < string , string > ( ) ;
811775 const transformedCard = this . mapVlocityCardRecord ( card , cardsUploadInfo , invalidIpNames ) ; // This only has the card structure, card definition is not there
812776
813- if ( this . IS_STANDARD_DATA_MODEL ) {
814- if ( transformedCard [ 'Name' ] != card [ 'Name' ] ) {
815- originalRecords . set ( recordId , card ) ;
816-
817- cardsUploadInfo . set ( recordId , {
818- referenceId : recordId ,
819- hasErrors : true ,
820- success : false ,
821- errors : [ this . messages . getMessage ( 'needManualInterventionAsSpecialCharsInFlexcardName' ) ] ,
822- warnings : [ ] ,
823- } ) ;
824- return ;
825- }
826- }
827-
828777 // Verify duplicated names
829778 let transformedCardName : string ;
830779 if ( this . allVersions ) {
@@ -1051,11 +1000,9 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
10511000 return childs ;
10521001 }
10531002
1054- private updateChildCards ( card : AnyJson ) : boolean {
1003+ private updateChildCards ( card : AnyJson ) : void {
10551004 const definition = JSON . parse ( card [ this . getFieldKey ( 'Definition__c' ) ] ) ;
1056- if ( ! definition ) return false ;
1057-
1058- let hasNameChanges = false ;
1005+ if ( ! definition ) return ;
10591006
10601007 for ( let state of definition . states || [ ] ) {
10611008 if ( state . childCards && Array . isArray ( state . childCards ) ) {
@@ -1065,14 +1012,12 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
10651012 // Check if any child card name was changed
10661013 for ( let i = 0 ; i < originalChildCards . length ; i ++ ) {
10671014 if ( originalChildCards [ i ] !== state . childCards [ i ] ) {
1068- hasNameChanges = true ;
10691015 }
10701016 }
10711017 }
10721018 }
10731019
10741020 card [ this . getFieldKey ( 'Definition__c' ) ] = JSON . stringify ( definition ) ;
1075- return hasNameChanges ;
10761021 }
10771022
10781023 // Maps an indivitdual VlocityCard__c record to an OmniUiCard record.
@@ -1125,6 +1070,18 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
11251070 mappedObject [ CardMappings . Author__c ] = this . cleanName ( mappedObject [ CardMappings . Author__c ] ) ;
11261071 mappedObject [ CardMappings . Active__c ] = false ;
11271072
1073+ if ( this . IS_STANDARD_DATA_MODEL ) {
1074+ if ( mappedObject [ 'OmniUiCardKey' ] ) {
1075+ mappedObject [ 'OmniUiCardKey' ] =
1076+ mappedObject [ 'Name' ] +
1077+ '/' +
1078+ mappedObject [ CardMappings . Author__c ] +
1079+ '/' +
1080+ mappedObject [ CardMappings . Version__c ] +
1081+ '.0' ;
1082+ }
1083+ }
1084+
11281085 // Update the datasource
11291086 const datasource = JSON . parse ( mappedObject [ CardMappings . Datasource__c ] || '{}' ) ;
11301087 if ( datasource . dataSource ) {
@@ -1146,8 +1103,10 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
11461103 mappedObject [ CardMappings . Datasource__c ] = JSON . stringify ( datasource ) ;
11471104 }
11481105
1149- const isCardActive : boolean = cardRecord [ `${ this . namespacePrefix } Active__c` ] ;
1150- this . ensureCommunityTargets ( mappedObject , isCardActive ) ;
1106+ if ( ! this . IS_STANDARD_DATA_MODEL ) {
1107+ const isCardActive : boolean = cardRecord [ this . getFieldKey ( 'Active__c' ) ] ;
1108+ this . ensureCommunityTargets ( mappedObject , isCardActive ) ;
1109+ }
11511110
11521111 // Update all dependencies comprehensively
11531112 this . updateAllDependenciesWithRegistry ( mappedObject , invalidIpNames ) ;
0 commit comments