Best practice regarding of Design RecordType

Hello:

I am trying to create a RecordType synchronized with a web-service.  One of the data objects obtained doesn't always have the same number of sub-data points (see nutrients in the image).  In order for me to store the nutrients values, right now, I am creating 20 columns (assuming a max) and using a forEach to store each value.  Is there a better way to do this?

Thank you.

  

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    Are the nutrients of any importance? I mean in terms of relationship? If not, just store them as a comma-separated string. If yes, I think you could create a separate record with just holds the nutrients and their relationship to the product. You could even create a many-many relationship using a third record.

    But I am not sure whether this is the best use case for a synced record. Did you consider making it a non-synced record, and just query the data directly from the API?

  • Stefan:

    The nutrient values has significant importance.  Need the data to analyze the product.  Right now, I am doing two tables - one for the product 'profile' info and another with the nutrient values - with UPC connecting the two tables.

    I am thinking about the non-synced record but was following the SpaceX tutorial to learn about webIntegration/Service-backed records.

    Thanks for the feedback - always appreciate it.

    Ma

  • 0
    Certified Lead Developer

    My opinion, based on feedback, nutrient should be its own Record.  Go ahead with synched records, I think they're still very useful for this case.

    The question you need to answer is whether the nutrients have a 1 to Many or a Many to Many relationship with these food items.  Does one food item contain many nutrients, or are there many nutrients that can be associated to many food items?  I'm leaning toward the former, because the amount of each nutrient is unique to each food item, isn't it?  You could also solve for that by making a link table and including the amount alongside the linkage. Still, you know more about your exact use case than I do, so you make the ultimate decision.  It all depends on how the webservice is structured what you're able to do.