0

I have 2 custom objects, CustomA__c and CustomB__c, Master-detail relationship between them, A is master and B is child. I am working in lighting experience.

When creating new record from Master detail page's child's related list, i want that child record type is automatically selected based on what is parent recordtype.

I have same record types on parent and child objects, same labels and api names. Also i have apex trigger, to populate a field on parent record, when parent is created, to get matching recordTypeId for child record.

I tired to do custom list button with following input: /a0C/e?RecordType={!TT_application__c.TT_Application_Line_Record_Id__c} Record types are inheriting correctly, but when i try to prepopulate parent record master-detail lookup field on my child record form, it wont work. I read that URL hacking is not working in lightning anymore, still recordId's are working.

This code is with parent object field prepopulating on child record. Not working.

/a0C/e?RecordType={!TT_application__c.TT_Application_Line_Record_Id__c}&CF00NM0000000ZI5s={!TT_application__c.Name}&CF00NM0000000ZI5s_lkid={!TT_application__c.Id}&retURL=%2F{!TT_application__c.Id}

Any ideas how should I solve the problem any other way?

Thanks in advance!

6
  • Just to clarify - are you saying you want the "Record Type Selection" modal while creating the child record to be auto-selected based on what record type the parent is?
    – Jayant Das
    Jul 19, 2018 at 17:30
  • Yes. correct. I don't want that user has to select record type when they are creating child record from parent object. The record type should be selected based on what record type the parent is.
    – RSICK
    Jul 19, 2018 at 18:43
  • Unfortunately I don’t think you will be able to do that with the standard behavior. Even if you override the New button on related child object, you won’t be able to capture the parent record id.
    – Jayant Das
    Jul 19, 2018 at 20:28
  • I solved the problem. From UX perspective it is not the best, but still best i can do to use standard functionality. So i created custom lightning component and object-specific action on my parent object. When i click the action button, i will fire my custom component, which will fire e.force:createRecord event with set recordType and predefine values. Action button is located in header, ideally id use it on the related list area, but it is not possible yet.
    – RSICK
    Jul 20, 2018 at 8:52
  • Yes only if you trigger the creation from the parent.
    – Jayant Das
    Jul 20, 2018 at 11:52

0

Your Answer

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

Browse other questions tagged or ask your own question.