4

We are working towards making our application “Lightning Ready”. We have one functionality that we are not able to implement in lightning. I will describe it below. Please advise how we can get similar functionality in lightning.

We have two custom objects, say PARENT and CHILD. CHILD has a lookup to PARENT. We have a visualforce page where when the user clicks on a button in the context of PARENT, we create a new CHILD record, set some of the attributes and open it in edit mode. When opening in edit mode, we also set our own cancelURL page parameter. The idea is that if the user click “Cancel”, we have a mechanism to delete the newly created CHILD record. In lightning, we tried the following options.

  1. We can create a new CHILD record using sforce.one.createRecord. The problem here is that we cannot prepopulate any fields (other than recordtype) of the newly created CHILD record.
  2. We can create a new CHILD record using sforce.one.createRecord, populate the required fields, open it in edit mode using sforce.one.editRecord. The problem here is that we do not have a mechanism to delete the newly created CHILD record if the user clicks “Cancel”
  3. We can create a new object specific action on PARENT object. This allows us to prepopulate most of the fields before creating the CHILD record. The problem here is that this action cannot be called from visualforce/javascript.

The only viable (and not preferred) option is

  1. Create a custom VF page. This page will take the record type as parameter and render the fields based on a fieldset specific to the record type. The problem here is that we will deviate from defined page layout and also have to maintain separate fieldsets.
1

As of Summer'17, it is not possible to override return URLs because it is not stated in the official documentation. We can only hope, that Salesforce recognizes the severe necessity for us more control over the routing.

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.