@@ -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 ) {
@@ -1064,11 +1013,9 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
10641013 return childs ;
10651014 }
10661015
1067- private updateChildCards ( card : AnyJson ) : boolean {
1016+ private updateChildCards ( card : AnyJson ) : void {
10681017 const definition = JSON . parse ( card [ this . getFieldKey ( 'Definition__c' ) ] ) ;
1069- if ( ! definition ) return false ;
1070-
1071- let hasNameChanges = false ;
1018+ if ( ! definition ) return ;
10721019
10731020 for ( let state of definition . states || [ ] ) {
10741021 if ( state . childCards && Array . isArray ( state . childCards ) ) {
@@ -1078,14 +1025,12 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
10781025 // Check if any child card name was changed
10791026 for ( let i = 0 ; i < originalChildCards . length ; i ++ ) {
10801027 if ( originalChildCards [ i ] !== state . childCards [ i ] ) {
1081- hasNameChanges = true ;
10821028 }
10831029 }
10841030 }
10851031 }
10861032
10871033 card [ this . getFieldKey ( 'Definition__c' ) ] = JSON . stringify ( definition ) ;
1088- return hasNameChanges ;
10891034 }
10901035
10911036 // Maps an indivitdual VlocityCard__c record to an OmniUiCard record.
@@ -1138,6 +1083,18 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
11381083 mappedObject [ CardMappings . Author__c ] = this . cleanName ( mappedObject [ CardMappings . Author__c ] ) ;
11391084 mappedObject [ CardMappings . Active__c ] = false ;
11401085
1086+ if ( this . IS_STANDARD_DATA_MODEL ) {
1087+ if ( mappedObject [ 'OmniUiCardKey' ] ) {
1088+ mappedObject [ 'OmniUiCardKey' ] =
1089+ mappedObject [ 'Name' ] +
1090+ '/' +
1091+ mappedObject [ CardMappings . Author__c ] +
1092+ '/' +
1093+ mappedObject [ CardMappings . Version__c ] +
1094+ '.0' ;
1095+ }
1096+ }
1097+
11411098 // Update the datasource
11421099 const datasource = JSON . parse ( mappedObject [ CardMappings . Datasource__c ] || '{}' ) ;
11431100 if ( datasource . dataSource ) {
@@ -1159,7 +1116,7 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
11591116 mappedObject [ CardMappings . Datasource__c ] = JSON . stringify ( datasource ) ;
11601117 }
11611118
1162- const isCardActive : boolean = cardRecord [ ` ${ this . namespacePrefix } Active__c` ] ;
1119+ const isCardActive : boolean = cardRecord [ this . getFieldKey ( ' Active__c' ) ] ;
11631120 this . ensureCommunityTargets ( mappedObject , isCardActive ) ;
11641121
11651122 // Update all dependencies comprehensively
@@ -1671,6 +1628,7 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
16711628 /**
16721629 * Ensures that the FlexCard Definition includes required Lightning Community targets
16731630 * Adds "lightningCommunity__Page" and "lightningCommunity__Default" if missing
1631+ * This is needed as vlocity wrapper can have flexcard which is unpublished but omniwapper needs published card
16741632 */
16751633 private ensureCommunityTargets ( mappedObject : any , isCardActive : boolean ) : void {
16761634 if ( ! isCardActive ) {
0 commit comments