Code to fetch data from Azure
// Fetch the blob from Azure using the Blob Id
public String getBlobData(String blobID) {
String sasToken = azurePortalConfigurationService.getSASToken();
String storageURI = azurePortalConfigurationService.getStorageURI();
logger.debug("The SAS Token is " + sasToken);
logger.debug("The Storage URL is " + storageURI);
int timeout = 5;
RequestConfig config = RequestConfig.custom()
.setConnectTimeout(timeout * 1000)
.setConnectionRequestTimeout(timeout)
.setSocketTimeout(timeout * 1000).build();
org.apache.http.impl.client.CloseableHttpClient httpClient = HttpClientBuilder.create().setDefaultRequestConfig(config).build();
String getRequestURL = storageURI + blobID;
HttpGet httpGet = new HttpGet(getRequestURL + sasToken);
logger.debug("The url is: " + getRequestURL + sasToken);
try {
CloseableHttpResponse response = httpClient.execute(httpGet);
HttpEntity httpEntity = response.getEntity();
String rawResponse = EntityUtils.toString(httpEntity);
logger.debug("The Form Data is " + rawResponse);
return rawResponse;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
Associate the prefill service with the form
Associate the custom prefill service with the adaptive form as shown below
Preview the form by including the guid parameter in the url as shown below
http://localhost:4502/content/dam/formsanddocuments/azureportal/benefitsenrollment/jcr:content?wcmmode=disabled&guid=411b2f29-f0d0-468c-875b-4562dcc546fe