Loading
Get Started with Communications, Media, and Energy & Utilities (CME)...
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
          Example Custom Record Id Class

          Example Custom Record Id Class

          When you configure a Relationship Graph Use the Vlocity Graph Component Editor, by default the Vlocity Graph component uses the Id of the record associated with the page as the root object. You can use an Apex class to provide a different record Id.

          This Apex class must:

          • Implement VlocityOpenInterface2

          • Accept input through the options parameter

          • Return a recordId parameter with a value that is valid for one of the node types in the graph

          The following example class meets the minimum requirements. It invokes a query that returns the AccoundId associated with the input contextRecordId, which is an InteractionId.

          global with sharing  class RelGraphInteractionObject implements vlocity_cmt.VlocityOpenInterface2 {
          
              global Boolean  invokeMethod(String methodName,Map<String,Object> inputMap, 
                  Map<String,Object> outputMap, Map<String,Object> options)
              {
                  if(methodName == 'CustomRecordMethod') return CustomRecordMethod (inputMap, outputMap, options);
                  return false;
              }
             
              private Boolean  CustomRecordMethod(Map<String, Object> inputMap, Map<String, Object> outputMap, Map<String, Object> options) {
                 String InteractionId = (String) options.get('contextRecordId');
                 String AccountId = [SELECT Id, vlocity_cmt__AccountId__c FROM vlocity_cmt__CustomerInteraction__c WHERE Id = :InteractionId LIMIT 1].vlocity_cmt__AccountId__c;
                 outputMap.put('recordId', AccountId);
                 return true;
              }
          }

          The graph passes information to the options parameter of the class in the following format. The contextRecordId is the Id of the record associated with the page. The contextRecordId is empty if the page has no context record. You must supply both the contextRecordId and the graphId even if the class doesn't use them.

          { contextRecordId: 0032E00002RZMNgQAP, graphId: 0032E00002RZMNgQAP } 
          Important
          Important

          Use the options parameter to pass information to the class. Most classes accept information via the inputMap, but classes of this type are an exception.

          Here is the required format of the output passed back to the graph:

          { recordId: 0032E00002RZMNgQAP }
           
          Loading
          Salesforce Help | Article