File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -687,6 +687,38 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat
687687
688688 // Get All elements for each OmniScript__c record(i.e IP/OS)
689689 const elements = await this . getAllElementsForOmniScript ( recordId ) ;
690+
691+ // Check for duplicate element names within the same OmniScript
692+ const elementNames = new Set < string > ( ) ;
693+ const duplicateElementNames = new Set < string > ( ) ;
694+
695+ for ( const elem of elements ) {
696+ const elemName = elem [ 'Name' ] ;
697+ if ( elementNames . has ( elemName ) ) {
698+ duplicateElementNames . add ( elemName ) ;
699+ } else {
700+ elementNames . add ( elemName ) ;
701+ }
702+ }
703+
704+ // If duplicate element names found, skip this OmniScript
705+ if ( duplicateElementNames . size > 0 ) {
706+ const duplicateNamesList = Array . from ( duplicateElementNames ) . join ( ', ' ) ;
707+ const skippedResponse : UploadRecordResult = {
708+ referenceId : recordId ,
709+ id : '' ,
710+ success : false ,
711+ hasErrors : false ,
712+ errors : [ ] ,
713+ warnings : [ this . messages . getMessage ( 'invalidOrRepeatingOmniscriptElementNames' , [ duplicateNamesList ] ) ] ,
714+ newName : '' ,
715+ skipped : true ,
716+ } ;
717+ osUploadInfo . set ( recordId , skippedResponse ) ;
718+ originalOsRecords . set ( recordId , omniscript ) ;
719+ continue ;
720+ }
721+
690722 if ( omniscript [ `${ this . namespacePrefix } IsProcedure__c` ] === true ) {
691723 // Check for reserved keys in PropertySet for Integration Procedures
692724 const foundReservedKeys = new Set < string > ( ) ;
You can’t perform that action at this time.
0 commit comments