Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com

Retrieving Dynamic Extension forms

Introduction:

This document describes how to use the API for DE forms with the help of an example. The same API can be implemented to obtain different DE forms at Participant, Visit, and Specimen level.

Include DynamicExtention.jar

The prerequisite for making use of DE form API's is to include the updated DynamicExtensions.jar in the class path.

Example:

The API mentioned below retrieves DE form data at Visit level.

Note that the EntityType will change as per the object. Since, below mentioned example retrieves form fields present at visit level the entityType = "SpecimenCollectionGroup"


private Map<String, List<FormData>> getRecords(Long visitId){
	GetFormRecordsListOp opDetail = new GetFormRecordsListOp();
	opDetail.setEntityType("SpecimenCollectionGroup");
	opDetail.setObjectId(visitId);

	List<FormRecordsList> forRecordsList = formSvc.getFormRecords(new RequestEvent<GetFormRecordsListOp>(opDetail)).getPayload();
	Map<String, List<FormData>> result = new HashMap<>();

	for(FormRecordsList formRecords : formRecordsList) {
		List<FormData> formDataList = new ArrayList<>();
		for(FormRecordSummary record : formRecords.getRecords()) {
			FormRecordCriteria crit = new FormRecordCriteria();
			crit.setFormId(formRecords.getId());
			crit.setRecordId(record.getRecordId());
			FormData data = formSvc.getFormData(new RequestEvent<FormRecordCriteria>(crit)).getPayload().getFormData();
			formDataList.add(data);
		}
	result.put(formRecords.getName(), formDataList);
	}
	return result;
}


Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com