To map your Helpshift custom metadata to Salesforce fields, you must first map all of your custom metadata from Helpshift onto one singular Salesforce field. From there, your Salesforce Admin can parse out the custom metadata data into individual Salesforce fields.

To set this up, first, your Salesforce admin will need to work with your app developer to identify all of the custom metadata that is currently being collected by your Helpshift SDK. For a better understanding of how this works, please see our guide to Understanding Metadata, Custom Issue Fields, & Tags.

Please note: you do not need to incorporate Custom Issue Fields or tags to map custom metadata.

Next, your Salesforce Admin should create matching custom fields in Salesforce that the custom metadata can be parsed into. To review these steps, please see Salesforce’s documentation on Creating Custom Fields.

Once the fields are set, your Salesforce Admin will use a trigger in Salesforce to parse the custom metadata from Helpshift into individual custom fields in Salesforce. Sample text for that trigger is below:

Sample text: timestamp: on Jun 01 at 16:11:31.
​ ​   userType: Paid

​Above are two custom metadata keys and their values. ​To retrieve only a single key or value to add to your Salesforce custom field, your Salesforce Admin can use the following trigger:

public static String getCustomMetaValue(String CustomMetaDump, String KeyName)
if(String.isBlank(CustomMetaDump) || String.isBlank(KeyName))
return null;
String[] arrValues = cas.custom_meta__c.Split(‘\n’);
for(String KeyValuePair : arrValues)
Unknown macro: { if(KeyName.equalIgnoreCase(KeyValuePair.substringBefore(‘}
return null;
}

Please note: Custom_meta can be mapped only to one of the TextArea fields of the Case Object.

The method in this code snippet requires two inputs:

  • CustomMetaDump – String received in field which is mapped to Custom Meta Ex above sample string.
  • KeyName – Key for which value needs to be fetched Ex. userType, timestamp

This method can also be added to the Case trigger handler.