SalesforceLabs / EnhancedLightningGrid

Component that allows you to sort and filter data within the Lightning Experience. Use as a replacement for a Related List, or create a new grid that shows results from a custom query.
BSD 3-Clause "New" or "Revised" License
136 stars 96 forks source link

create record actions are not working correctly after Salesforce's Winter'21 release #45

Closed ashishsutar123 closed 1 year ago

ashishsutar123 commented 4 years ago

Hi Team,

We are using this grid application for our project. Recently we observed that post Winter'21 release the grid is malfunctioning. We have create new record action created on this grid related list, in this actions we have defaulting some of the values of the new record including record type, which was working fine but all of the sudden post the new release the actions have stopped picking the record type that is defined in the grid's create record action and are picking master record type as a default one. This is happening in all the the sandboxes that have got upgraded to the winter'21 release.

Would like to know in case we are aware about this issue and if we have any solution or workaround for this.

Your help would be really appreciated.

Regards, Ashish Sutar

jeremyjpalmer commented 4 years ago

Hi Ashish -- My sandbox is on the Winter 21 release, and my create new record actions are selecting the record types appropriately.

ashishsutar123 commented 3 years ago

Thanks @jeremyjpalmer for replying, Just to confirm, You are referring to data grid action buttons, correct?, and there in you have pre-defaulted a different record type?

jeremyjpalmer commented 3 years ago

@ashishsutar123 Yes, my buttons create records with different record types. They works fine. The only thing that could be improved is that the new record popup window title mentions the default record type name (i.e., "New [Object]: [Default Record Type]", which is incorrect), but the Record Type field value is correct. Having the record type on the page layout is helpful.

ndemers-wk commented 3 years ago

We are having the same issue as @ashishsutar123 Our org was updated over the weekend to Winter 21 and now the action button is not opening the correct record type - it only opens the default record type.
This is our definition in the event payload. {"entityApiName":"CustomObjectc","defaultFieldValues":{"Opportunityc":"#parentrecordId#","RecordTypeId":"012f4000000yvS4AAI"}}

Anyone have any suggestions on how to fix? Thanks

jeremyjpalmer commented 3 years ago

Try this as a fix --add the following at the end of the payload, before the last "}": , "navigationLocation": "LOOKUP"

ndemers-wk commented 3 years ago

Thanks for the suggestion. But, it didn't fix the issue. FYI - it's a List Button with event e.force:createRecord {"entityApiName":"CustomObjectc","defaultFieldValues":{"Opportunityc":"#parentrecordId#","RecordTypeId":"012f4000000yvS4AAI"}, "navigationLocation": "LOOKUP"}

jeremyjpalmer commented 3 years ago

@ndemers-wk I'm able to replicate your issue when I remove "navigationLocation": "LOOKUP", but adding it back in fixes it for me. You might also try to log out and log back in to ensure that your arent caching the old version.

ndemers-wk commented 3 years ago

Wait..... It did work. I moved to the beginning {"entityApiName":"Client_Accessc", "navigationLocation": "LOOKUP","defaultFieldValues":{"Opportunityc":"#parentrecordId#","RecordTypeId":"012f4000000yvS4AAI"}} Or maybe I was an idiot and didn't see it last time. The title of the record is incorrect, but the correct RecordType is presented.

I will test with LOOKUP at the beginning and at the end... and let you know the results. THANKS!!

ndemers-wk commented 3 years ago

@jeremyjpalmer You're a genius. Thanks. Adding to the beginning or end works. I just missed it the first time. Life is good. Thanks again.

infinityrobot commented 3 years ago

@ndemers-wk We had the same problem as you re the RecordType not being set correctly. We found a solution that was pretty simple and figured I'd share here just in case! Turns out we just needed to include the RecordTypeId in the parent payload object by setting a recordTypeId key rather than including it our defaultFieldValues key. Doing that fixed all our problems and has also fixed the display of the title of the record too! 🎉 We tried the "navigationLocation": "LOOKUP" fix above which did work, but it was super troublesome for our users to have the wrong title so I dug a bit further.

Before in our Event Payload field we had this, which wasn't working and was behaving exactly like your original issue.

{ "entityApiName": "CustomObject__c", "defaultFieldValues": {
  "OpportunityId__c": "#parentRecordId#", "RecordTypeId": "0122P0000004IlSQAU"
} }

We then changed it to this, which now works perfectly and sets the record title correctly :)

{ "entityApiName": "CustomObject__c", "recordTypeId": "0122P0000004IlSQAU", "defaultFieldValues": {
  "OpportunityId__c": "#parentRecordId#"
} }

One thing is don't forget the casing on recordTypeId needs to be camelcased that way for it to work when moving it to the parent level, including it as RecordTypeId won't work.

Hope this is helpful!

ndemers-wk commented 3 years ago

Thanks. Very helpful!

ghost commented 3 years ago

It would be nice to use Record Type Developer Name instead of Id, but that is just a wish list item really.

mcarrilloatsalesforcedotcom commented 1 year ago

Closed based on the comments above