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 metadata text from Helpshift:

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;
}

The method in this trigger requires two inputs:

  • CustomMetaDump – String containing all the Custom Metadata received from Helpshift (which is initially saved to a single Case field)
  • KeyName – Key for which value needs to be fetched Ex. userType, timestamp

The above method should be invoked in a Salesforce Case trigger that handles the logic for the individual field assignments. An example of such a trigger is below and includes the invocation of the getCustomMetaValue method.

trigger CaseTrigger on Case (before insert, before update) {
for(Case ca : Trigger.New) {
String val =
CaseTriggerHandler.getCustomMetaValue(ca.meta_data__c,’total_orders’);
try {
ca.Total_Transfers__c = Decimal.valueOf(val) ;
} Catch(Exception ex) {}
}