1

I am trying to create a new Object record from a VF page and using the code:

function newContractClick() {     
          sforce.one.createRecord('Contract',null);    
    }

On this code, it is directly taking the default record type of the contract, I need the record type selection page before it takes to the form filling screen.

I saw a 1-year-old post on which we have a custom solution where I can create a screen and ask the user to select the record type and then use sforce.one.createRecord.

But apart from custom solution, do we have anything

1

It's supposed to work that way. You won't get the "record type selection" page when you use this function/event to create a record. The way these event work is that it fires and takes you directly to the record creation page. Note that the record type selection is a step prior to that process. It does not start the "record creation process" just by landing to the record type selection page but only after the record type has been selected.

To be able to provide your users a selection of record type, you will need to create a custom page/screen to allow users to select the respective record type. And then upon selection of that, you initiate the creation of the record along with the respective record type id selected by firing this event.

Remember, if you have a record type on an object, then you definitely need at one point of time to provide that record type id as well while calling sforce.one.createRecord before creating the record itself.

  • hmm...I got it ... Is their any standard way in lightning to get the recordtype page ? Like in classic we can use /recordtype.jsp (something in window.open ) then it lands on the record type selection page. Am wondering is their anything in lightning you came accross ? – Abhik Dey Aug 24 '18 at 17:21
  • Unfortunately, there's nothing standard. You will need to build that in a custom way. Easiest way (as we did in one of our implementations) is to build a custom component, and that its not too complex and call that during your create process. And only once you have selected the record type, you fire the create record event. – Jayant Das Aug 24 '18 at 17:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.