diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceTriggerSolutionCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceTriggerSolutionCEImpl.java index c4a571037d27..b73dc33a26de 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceTriggerSolutionCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceTriggerSolutionCEImpl.java @@ -101,11 +101,12 @@ public Mono trigger( // If the plugin has overridden and implemented the same, use the plugin result Mono resultFromPluginMono = Mono.zip( - validatedDatasourceStorageMono, pluginMono, pluginExecutorMono) + validatedDatasourceStorageMono, pluginMono, pluginExecutorMono, datasourceMonoCached) .flatMap(tuple -> { final DatasourceStorage datasourceStorage = tuple.getT1(); final Plugin plugin = tuple.getT2(); final PluginExecutor pluginExecutor = tuple.getT3(); + final Datasource datasource = tuple.getT4(); // TODO: Flags are needed here for google sheets integration to support shared drive behind a flag // Once thoroughly tested, this flag can be removed @@ -118,7 +119,7 @@ public Mono trigger( // Now that we have the context (connection details), execute the action. // datasource remains unevaluated for datasource of DBAuth Type Authentication, // However the context comes from evaluated datasource. - .flatMap(resourceContext -> setTenantAndInstanceId(triggerRequestDTO) + .flatMap(resourceContext -> populateTriggerRequestDto(triggerRequestDTO, datasource) .flatMap(updatedTriggerRequestDTO -> ((PluginExecutor) pluginExecutor) .triggerWithFlags( resourceContext.getConnection(), @@ -161,13 +162,15 @@ public Mono trigger( return resultFromPluginMono.switchIfEmpty(defaultResultMono); } - private Mono setTenantAndInstanceId(TriggerRequestDTO triggerRequestDTO) { + private Mono populateTriggerRequestDto( + TriggerRequestDTO triggerRequestDTO, Datasource datasource) { return tenantService .getDefaultTenantId() .zipWith(configService.getInstanceId()) .map(tuple -> { triggerRequestDTO.setTenantId(tuple.getT1()); triggerRequestDTO.setInstanceId(tuple.getT2()); + triggerRequestDTO.setWorkspaceId(datasource.getWorkspaceId()); return triggerRequestDTO; }); }