Input variables how to get from service task?

I have service task “checkExternalAml”, before this process event, i fill json object.

how to get variable from json in service task?

String iin = job.getVariable(“user.iin”) not working?

Are you using Camunda 7 or Camunda 8?

I use Camunda 8.
I found solution, it was wrong variable name mapping in Inputs.

@JobWorker
    public Map<String, Object> checkExternalAml(@Variable String type, @Variable String clientId,
                                                @Variable LocalDate subDate, @Variable String name) {
        ExternalAmlCheckRequest.ClientType clientType = ExternalAmlCheckRequest.ClientType.valueOf(type);

        ExternalAmlCheckRequest request = ExternalAmlCheckRequest.builder()
                .id(UUID.randomUUID())
                .operationDate(LocalDateTime.now())
                .clientId(clientId)
                .clientType(clientType)
                .subDate(subDate)
                .fullName(name)
                .build();

        ExternalAmlCheckResponse response = creditCheckClient.checkAml(request);

        String outputMessageKey = switch (clientType) {
            case FL ->  OUTPUT_MESSAGE_KEY_V1;
            case UL -> OUTPUT_MESSAGE_KEY_V2;
            default -> throw new IllegalStateException(String.format("Not Implemented %s", clientType));
        };

        return Map.of(outputMessageKey, response.isSuccess());
    }
1 Like

Thanks for letting me know you got a solution :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.