Source:
private Long createPatientTestTask() { TaskTriggerInformation triggerInformation = new TaskTriggerInformation("CREATE SettingsRecord", "data-services", MDS_CHANNEL_NAME, VERSION, TRIGGER_SUBJECT, TRIGGER_SUBJECT); TaskActionInformation actionInformation = new TaskActionInformation("Create Patient [" + DEFAULT_CONFIG_NAME + "]", OPENMRS_CHANNEL_NAME, OPENMRS_CHANNEL_NAME, VERSION, TEST_INTERFACE, "createPatient"); actionInformation.setSubject(String.format("createPatient.%s", DEFAULT_CONFIG_NAME)); SortedSet<TaskConfigStep> taskConfigStepSortedSet = new TreeSet<>(); taskConfigStepSortedSet.add(createPatientDataSource()); TaskConfig taskConfig = new TaskConfig(); taskConfig.addAll(taskConfigStepSortedSet); Map<String, String> values = new HashMap<>(); values.put(Keys.ADDRESS_1, "{{ad.openMRS.Patient-" + DEFAULT_CONFIG_NAME + "#0.person.birthdate}}"); values.put(Keys.ADDRESS_2, "{{ad.openMRS.Patient-" + DEFAULT_CONFIG_NAME + "#0.uuid}}"); values.put(Keys.FAMILY_NAME, "{{ad.openMRS.Patient-" + DEFAULT_CONFIG_NAME + "#0.person.display}}"); values.put(Keys.GENDER, "{{ad.openMRS.Patient-" + DEFAULT_CONFIG_NAME + "#0.person.gender}}"); values.put(Keys.GIVEN_NAME, "{{ad.openMRS.Patient-" + DEFAULT_CONFIG_NAME + "#0.person.display}}"); values.put(Keys.MOTECH_ID, "{{ad.openMRS.Patient-" + DEFAULT_CONFIG_NAME + "#0.motechId}}" + "taskCreated"); values.put(Keys.CONFIG_NAME, DEFAULT_CONFIG_NAME); actionInformation.setValues(values); Task task = new Task("OpenMRSPatientTestTask", triggerInformation, Arrays.asList(actionInformation), taskConfig, true, true); getTaskService().save(task); getTriggerHandler().registerHandlerFor(task.getTrigger().getEffectiveListenerSubject()); return task.getId(); }

Target:
private Long createPatientTestTask() { TaskTriggerInformation triggerInformation = new TaskTriggerInformation("CREATE SettingsRecord", "data-services", MDS_CHANNEL_NAME, VERSION, TRIGGER_SUBJECT, TRIGGER_SUBJECT); TaskActionInformation actionInformation = new TaskActionInformation("Create Patient [" + DEFAULT_CONFIG_NAME + "]", OPENMRS_CHANNEL_NAME, OPENMRS_CHANNEL_NAME, VERSION, TEST_INTERFACE, "createPatient"); actionInformation.setSubject(String.format("createPatient.%s", DEFAULT_CONFIG_NAME)); SortedSet<TaskConfigStep> taskConfigStepSortedSet = new TreeSet<>(); taskConfigStepSortedSet.add(createPatientDataSource()); TaskConfig taskConfig = new TaskConfig(); taskConfig.addAll(taskConfigStepSortedSet); Map<String, String> values = new HashMap<>(); values.put(Keys.ADDRESS_1, "{{ad.openMRS.Patient-" + DEFAULT_CONFIG_NAME + "#0.person.birthdate}}"); values.put(Keys.ADDRESS_2, "{{ad.openMRS.Patient-" + DEFAULT_CONFIG_NAME + "#0.uuid}}"); values.put(Keys.FAMILY_NAME, "{{ad.openMRS.Patient-" + DEFAULT_CONFIG_NAME + "#0.person.display}}"); values.put(Keys.GENDER, "{{ad.openMRS.Patient-" + DEFAULT_CONFIG_NAME + "#0.person.gender}}"); values.put(Keys.GIVEN_NAME, "{{ad.openMRS.Patient-" + DEFAULT_CONFIG_NAME + "#0.person.display}}"); values.put(Keys.MOTECH_ID, "{{ad.openMRS.Patient-" + DEFAULT_CONFIG_NAME + "#0.motechId}}" + "taskCreated"); values.put(Keys.CONFIG_NAME, DEFAULT_CONFIG_NAME); actionInformation.setValues(values); Task task = new Task("OpenMRSPatientTestTask", triggerInformation, Collections.singletonList(actionInformation), taskConfig, true, true); getTaskService().save(task); getTriggerHandler().registerHandlerFor(task.getTrigger().getEffectiveListenerSubject()); return task.getId(); }