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
Yogesh SheteYogesh Shete 

'Record Type ID: this ID value isn't valid for the user:' error occurs in Lightning mode for Opportunity creation on VF page.

Hi,
We are using standard Salesforce action ($Action.Opportunity.New) on custom VF page for Opportunity creation. It works fine in Classic mode but not in Lightning mode. In Lightning mode it shows record type selection. It allows to select avaialble record type. On clicking continue it shows record creation popup, but inside popup it always shows page layout assigned for master record type. Then on clicking save button it shows 'Record Type ID: this ID value isn't valid for the user:'. 

Please, can anyone help me?
NagendraNagendra (Salesforce Developers) 
Hi Yogesh,

It sounds like you have some automation in place that is trying to change the record type of the Opp.  Check for Processes or Workflow Rules that have been defined which might be causing the issue.

For more information may I suggest you please check with below link with similar issue. Please let us know if you are looking for something else.

Kindly mark this as solved if it's resolved.

Best Regards,
Nagendra.
Yogesh SheteYogesh Shete
Thanks Nagedra.

There is no Processes or Workflows have been defined in the organization. Same VF page works fine in Classic Mode, but not working in Lightning Mode.

And suggested link is similar but no one gave appropriate answer.

 
Vivek S 42Vivek S 42
Hi Nagendra/Yogesh, 

I am also having same issue, on url direction - working fine in classic, but not in lightning. thorugh everything is same and perfect. 
can you just tell me the solution what you have. 
Jenny ShresthaJenny Shrestha
Hi Yogesh,

Weer you able to find a solution to that? I am having same issues.
Héctor EspíHéctor Espí
Hi Yogesh,

We are also experiencing the same issue. Is there any workaround or solution?.
Yogesh SheteYogesh Shete
Hi All,

I have raised this issue to salesforce support. They are looking into it. As soon as I get reply I will post here.
rrustenrrusten
Hi Yogesh
Any feedback from Salesforce support yet? I`m having the same issue with Case creation.
Lars PetterssonLars Pettersson
Running into the same issue, does anyone have any ideas?
Arian KermanchiArian Kermanchi
Hi All,

The problem is that when you override a standard action with a custom visualforce page, in Lightning Experience it will still use the Classic interface for the record type selection page and the selected record type does not get passed on to the Lightning new record form afterwards, so the record type field will remain empty and it gives that error. One workaround is to fetch and store the record type in the APEX class and then pass it on to the Lightning form using JavaScript.

Class: 
// store the record type here
public String chosenRecordType {get; set;}


// execute these lines upon loading the VF page:
if(str == 'Theme4d'){
  //Lightning interface specific logic
  map<string, string> pageParameters =  ApexPages.currentPage().getParameters();
  if(pageParameters.containsKey('RecordType')) {
    chosenRecordType = pageParameters.get('RecordType');
  }
}
VisualForce page:
<script>
  sforce.one.createRecord(INSERTRECORDTYPEHERE, '{!chosenRecordType}');
</script

So this way once the record type is chosen, the APEX class will be initialized and the code above will check if the user is in Lightning. If so, it will fetch the record type Id and store it in variable 'chosenRecordType'. Then the script on the VisualForce page will open the Lightning new record form and pass along the record type Id.

Hope this helps! :)
Marcello Anders 9Marcello Anders 9
Hey all,

I had the same error with an automated process & two custom objects and found an easier solution. I gave the object a default record type on profile level and it works just fine now!

Cheers

 
CVCCVC
Thank you Marcello Anders for the tip. I had the same issue and your solution worked for me!