1

I need to override the New Case standard action with a custom Lightning (Aura) component, but I only need to do so for some record types (3 of 6). Is it possible within a Lightning Component to redirect to the standard action? So for example:

  1. Create New Case Action Override component, implement lightning:actionOverride and lightning:hasPageReference.
  2. Override Case's New action to use my new component, but do NOT check the "skip record type selection" box.
  3. System displays record type selection, shows my component.
  4. My component gets selected record type using page ref info as outlined here.
  5. If the record type does not need the custom component override, component redirects to the standard New Case LEX UI with the record type set.
  6. Otherwise, component displays and accepts input as normal.

Step 5 is the question. In VF, I'd add an action param to the apex:page to check the recordTypeId and redirect using classic URls, as in this answer. Is this possible in LEX?

1

You can utilize force:createRecord event here and set the recordTypeId attribute to present the standard create screen for a particular record type.

Sample code would look like:

var createRecordEvent = $A.get("e.force:createRecord");
createRecordEvent.setParams({
    "entityApiName": "Case",
    "recordTypeId" : "xxxxxxx"
});
createRecordEvent.fire();
  • Good solution. I would add that OP could check a value and determine if they want to create a record or send to a custom component. I used this to control the record type because my users tend to never pick the correct one. – disasterlooms May 6 at 17:36

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.