+ Start a Discussion
Jordan MilesJordan Miles 

Accomodating for n-number of the same fields?

I'm using the Salesforce REST APIs to created customers (in our case organizations) that can have n-number of agents (users within an organization). Most of them only have 1-2 users, but currently, I have an agent rich text field where I just append every agent with line breaks in between each name because I didn't know a way accomodate for what I was needing. In other words, I would have to create n-number of fields within salesforce, each with a unique field name. Is there a better way to do this?
Greg RohmanGreg Rohman
Hi Jordan.

You might want to consider creating a new object to hold the users for each organization and use a lookup or master-detail relationship to link them. That way, the users for each organization will show up as a Related List on each organization.

This sounds like the built-in heirarchy of Accounts and Contacts that Salesforce provides. Are you utilizing those objects already?

-Greg
Jordan MilesJordan Miles
We aren't utilizing this currently. I have a customer Customers object that I use. I created a new object called Users and created a master-detail relationship back to Customers, but I can't seem to find any information about creating and updating detail records with RESTful services. Currently, I have a script that reads a table and creates the Customers JSON to be inserted into salesforce. Is there a way to access the detail records for a customer through REST?
Greg RohmanGreg Rohman
Hi Jordan.

I don't have much experience with JSON or REST. But here are a couple of links from the Salesforce documentation that might be helpful:

https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_relationship_traversal.htm
https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_relationships.htm

-Greg