function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
xnerd00xxnerd00x 

Creating a child object to the delivered User Object

Sorry for the x-post, but hopefully maybe I can get an answer here?

 

Hi all,

We have a requirement at our company to add a related list to the delivered user object. However,salesforce doesn't allow the user object to have a related list.  So we decided to create a new custom object called user_default that links back to the regular user object.

 

Things we've tried:

  • Creating a user_default record after insert into the user table.  However salesforce gives us an error saying that any change to the user set-up object cannot be accompanied by an insert/update to a non-setup object. 
  • Have a custom link on the page that would take the user to a 'new' user default page with their user id auto-filled in IF the row did not exist already.  If it did exist, we would like to take them to the already created page.

 

Being new to salesforce, I'm not quite sure how to do option 2.  I'm thinking I need a SOQL statement to query the user_default object to see whether that user_id exists, and if so, then build the link appropriately.  However, I don't see how you can execute a SOQL query within the link.  I know you can make an apex call, but according to what I've read, you can only return a success/failure from it (I would need the user_default Id returned).

 

Any ideas on how to do this?  Is my approach even viable?  Or is there a different approach I can take?

 

p.s. VisualForce pages are currently not in scope for our project, so non-VF solutions would be appreciated, but that doesn't mean to not respond if a VF solution is all that's available.

 

Thanks in advance.