Loading
Set Up and Maintain Net Zero Cloud
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Copy Previously Submitted Disclosure Responses

          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
          1. 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);
                }
            }
            
          2. From the App Launcher, find and select Omnistudio Integration Procedures.
          3. Click New and enter the details.
            1. For Integration Procedure Name, enter Disclosure_Prefill.
            2. For Type, enter Disclosure.
            3. For Subtype, enter Prefill.
            4. Save your changes.
          4. Add a prefill remote action.
            1. For Element Name, enter GetPrefillAssessmentIdUsingApex.
            2. For Remote Class, enter GetPrefillAssessmentIdUsingApex.
            3. For Remote Method, enter getAssessmentId.
          5. Add an assessment remote action.
            1. For Element Name, enter GetAssessmentData.
            2. For Remote Class, enter DiscoveryFrmwrk.PrefillAssessment.
            3. For Send JSON Path, enter GetPrefillAssessmentIdUsingApex.RemoteActionAssessmentId.
            4. For Send JSON Node, enter RemoteActionAssessmentId.
          6. Add a response action.
            1. For Element Name, enter AssessmentData.
            2. For Send JSON Path, enter GetAssessmentData.AssessmentDataReturned.
          7. Save and activate the changes.
          8. From the App Launcher, find and select Omniscripts.
          9. Open the Omniscript form that you created for the assessment questions.
          10. Deactivate the Omniscript.
          11. Drag Integration Procedure Action to the canvas.
          12. In the Properties panel, for Integration Procedure, enter Disclosure_Prefill and select Disclosure_Prefill from the search list.
          13. Save and activate the changes.
           
          Loading
          Salesforce Help | Article