I'd like to filter the available child record types a user can create based on the parent record type, any ideas?
[SalesForce] How to limit record type selection based on Parent record type
Related Solutions
Where are your getters and setters in the controller? I see no references to currentAccount.RecordType.DeveloperName
except in your 2nd query. Your controller hasn't built this map and it's not done a get
of the Account ID's or Opportunity.Account
needed to build it.
You have a return options
statement, but what are you returning those options to? How are you planning to get them back to your VF page?
Once you do that, I'm assuming you'll need to get your selection(s) back to your controller for cloning which you'll need to add another method for.
I highly recommend you take a look at the VisualForce Workbook, the VisualForce Developer's Guide and the Force.com Apex Code Developer's Guide for more on VisualForce pages and custom controllers.
Edit in response to comments...
In your VisualForce page,
<apex:page standardController="Account">
The above should refer to your custom controller and look something more like this:
<apex:page Controller="myController">
Error: Unknown property AccountStandardController.recTypeID
is in part because you're specifying the wrong controller. Once you do have the correct controller, I suspect you'll still see errors because what you're returning and "setting" is not the recordtype.ID. Your controller as written above, appears to "return" or set "opts" which you have listed in your page as !myOptions
which doesn't appear to me to be what you're setting.
Again, I highly recommend you take a look at the VF Workbook and other references I pointed you to which might help get you quickly sorted if you'll only spend a few minutes with them.
I believe you can use process builder to set the association.
Create a field on the call type to hold the record type that the record will be used for
then use process builder to update the call lookup field based on the record type of the call and the associated call type....
Per your comment here is how you did it:
set the Call Object to execute on record create the action an "Update Record" action. I associated this to call, then set the criteria for updating records to filter based upon the Record Type ID (you need the 18char ID) followed by the final part which sets the Call Type field ID value as necessary
Best Answer
One possible alternative is to override the new record creation of the child object with a Visualforce page, and use whatever logic you want to enforce the record type. I suppose the end user will be happy too.
Like the others mentioned a validation rule could work, but it may be a bit ugly from the end user perspective, since its not really the user's fault that he/she was allowed to choose that option.