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
Michael Webb 15Michael Webb 15 

How do I create a new record with a record type/page layout from a formula

I have a custom object that has a State field on it, related to this custom object is a another custom object with Questions we ask depending on what state the first object is located. ie the Company Account is in New York, then the user clicks on New QA and then chooses NY for the record type and the page layout for NY and the questions shows up.  I would like to see if I could create a custom button to create a new object and when it see's New York as the state from the Object it is being created from, it automatically defaults to the record type of New York.  Same with California, Alabama and so on.  I know I can set the record type, not sure how to do that with a formula.

Thanks in Advance!
Michael
Robert ZentgrafRobert Zentgraf
Hi Michael,

I think there are two ways:
  1. You can create a workflow to update the recordtype of QA by checking the fields of the related object Company Account.
  2. You can add some javascript-code on the button-method to check the fields and select the correct recordtype for the new object QA.

Regards
Robert
(mindforce: mind-force.de)
Michael Webb 15Michael Webb 15
Thanks! Do you have a link to some javascript to get me started? I know a TINY amount of Javascript so I may be able to muddle my way through. Thank you!
Robert ZentgrafRobert Zentgraf
Hi Michael,

perhaps you can find here some information: https://developer.salesforce.com/page/JavaScript

Best Regards
Robert
(mindforce: http://www.mind-force.de)