Copy Previously Submitted Disclosure Responses
Save time and the effort of entering responses to the same questions repeated every year. By adding the prefill integration to an Omniscript, you can access data from previously submitted responses.
Required Editions
| Available in: Lightning Experience |
| Available in: Enterprise, Performance, Unlimited, and Developer Editions |
| Permission Set Needed | |
|---|---|
| To use Disclosure and Compliance Hub: | Disclosure and Compliance Hub User |
-
To fetch a previous year’s disclosure, create an Apex class that retrieves the
AssessmentId using contextId.
global class GetPrefillAssessmentIdUsingApex implements System.Callable { global Map<String, Object> call(String action, Map<String, Object> args) { Map<String, Object> inputMap = (Map<String, Object>)args.get('input'); Map<String, Object> outputMap = (Map<String, Object>)args.get('output'); Map<String, Object> options = (Map<String, Object>)args.get('options'); return invokeMethod(action, inputMap, outputMap, options); } global Map<String, Object> invokeMethod(String methodName, Map<String,Object> input, Map<String,Object> output, Map<String,Object> options) { try { getAssessmentId(input, output, options); } catch(Exception ex) { Map<String, String> errorObject = new Map<String,String>(); errorObject.put('error', ex.getMessage()); return errorObject; } return output; } public static void getAssessmentId(Map<String, Object> input, Map<String, Object> output, Map<String, Object> options) { List < Map < String, String >> UIoptions = new List<Map<String, String>>(); String disclosureId = (String) input.get('ContextId'); String prevDisclosureId = [Select ReplicateResponsesFromId FROM Disclosure WHERE Id = :disclosureId LIMIT 1][0].ReplicateResponsesFromId; if(prevDisclosureId == null) { return; } for (Disclosure ds: [Select AssessmentId FROM Disclosure WHERE Id = :prevDisclosureId LIMIT 1]) { Map<String, String> tempMap = new Map<String, String>(); tempMap.put('PrevDisclosureId', prevDisclosureId); tempMap.put('AssessmentId', ds.AssessmentId); UIoptions.add(tempMap); output.put('RemoteActionAssessmentId', ds.AssessmentId); } System.debug(input); System.debug(output); } } - From the App Launcher, find and select Omnistudio Integration Procedures.
-
Click New and enter the details.
- For Integration Procedure Name, enter Disclosure_Prefill.
- For Type, enter Disclosure.
- For Subtype, enter Prefill.
- Save your changes.
-
Add a prefill remote action.
- For Element Name, enter GetPrefillAssessmentIdUsingApex.
- For Remote Class, enter GetPrefillAssessmentIdUsingApex.
- For Remote Method, enter getAssessmentId.
-
Add an assessment remote action.
- For Element Name, enter GetAssessmentData.
- For Remote Class, enter DiscoveryFrmwrk.PrefillAssessment.
- For Send JSON Path, enter GetPrefillAssessmentIdUsingApex.RemoteActionAssessmentId.
- For Send JSON Node, enter RemoteActionAssessmentId.
-
Add a response action.
- For Element Name, enter AssessmentData.
- For Send JSON Path, enter GetAssessmentData.AssessmentDataReturned.
- Save and activate the changes.
- From the App Launcher, find and select Omniscripts.
- Open the Omniscript form that you created for the assessment questions.
- Deactivate the Omniscript.
- Drag Integration Procedure Action to the canvas.
- In the Properties panel, for Integration Procedure, enter Disclosure_Prefill and select Disclosure_Prefill from the search list.
- Save and activate the changes.
Did this article solve your issue?
Let us know so we can improve!

