0

I have a custom metadata type with API names that match custom fields on the Case object. Is there a way to combine the two and retrieve the data within the Case custom field to populate the value for each aura:iteration? For example:

// Iterate through all controller returned custom metadata type fields
<aura:iteration items="{!v.docTypes}" var="item"> 
    <option text=""
           // Use the current iterated field to look up the data to populate
           // the field. (v.simpleRecord + attendanceDate__c)
           *value="{!v.simpleRecord}" + "{!item}">*
        selected=""/>
</aura:iteration>

Since the custom metadata type field API name matches the one on the Case object, the goal is to use the LDS record and locate the field on it that matches the same item being iterated through and return the record's actual value.

0

You can combine the value in server side controller.

So, execute the SOQL query with the necessary fields.

Case caseObj = [SELECT customField__c, .... FROM Case WHERE Id=:caseId LIMIT 1];

And then use caseObj.get("customField__c") to retrieve the field value. Here customField__c is a place holder and this API name can be fetched from custom metadata type.

  • Doing it the way you suggest, wouldn't I have to do this for each custom field? – Jeff May 7 '18 at 18:25
  • No, you should create a list of fields in custom metadata types and dynamically populate those upon looping through the list. You can try first and post your code and I will guide you. – Santanu Boral May 8 '18 at 0:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.