diff --git a/force-app/main/default/aura/RD2_EnablementDelegate/RD2_EnablementDelegateController.js b/force-app/main/default/aura/RD2_EnablementDelegate/RD2_EnablementDelegateController.js index 4853052a48..06f1524d7e 100644 --- a/force-app/main/default/aura/RD2_EnablementDelegate/RD2_EnablementDelegateController.js +++ b/force-app/main/default/aura/RD2_EnablementDelegate/RD2_EnablementDelegateController.js @@ -28,6 +28,16 @@ helper.handleBatchEvent(component, event, 'v.dryRunBatch'); helper.refreshDryRun(component); helper.refreshEnable(component); + var status = event.Hp.batchProgress.status; + var dryRunJob = component.find("dryRunJob"); + if (["Completed", "Aborted"].includes(status)) { + if(dryRunJob){ + helper.setFocus(component, 'dryRunJob'); + } + else{ + helper.setFocus(component, 'dryRun2Job'); + } + } }, handleDryRunError: function (component, event, helper) { helper.handleBatchError(component, event, 'dryRun'); @@ -44,6 +54,10 @@ handleMigrationStatusChange: function (component, event, helper) { helper.handleBatchEvent(component, event, 'v.migrationBatch'); helper.refreshMigration(component); + var status = event.Hp.batchProgress.status; + if (["Completed", "Aborted"].includes(status)) { + helper.setFocus(component, 'migrationJob'); + } }, handleMigrationError: function (component, event, helper) { helper.handleBatchError(component, event, 'migration'); diff --git a/force-app/main/default/aura/RD2_EnablementDelegate/RD2_EnablementDelegateHelper.js b/force-app/main/default/aura/RD2_EnablementDelegate/RD2_EnablementDelegateHelper.js index 45f96989f3..9a18f91f26 100644 --- a/force-app/main/default/aura/RD2_EnablementDelegate/RD2_EnablementDelegateHelper.js +++ b/force-app/main/default/aura/RD2_EnablementDelegate/RD2_EnablementDelegateHelper.js @@ -599,5 +599,22 @@ hideSpinner: function (component, element) { var spinner = component.find(element); $A.util.addClass(spinner, 'slds-hide'); - } + }, + /** + * @description: Autofocus + */ + setFocus: function (component, elementId) { + window.setTimeout(() => { + try { var element = component.find(elementId); + if (element) { + element.getElement().setAttribute('tabindex', '0'); + element.getElement().focus(); + element.getElement().setAttribute('tabindex', '-1'); + } + } catch (error) { + console.error('Error setting focus on element:', error); + + } + }, 0); + } })