
9 answers
I also encounter this issue and solved this. here's my idea.
The reason why recordId is undefined is that seems salesforce launch a new context for the messageCallback function. So we should define and pass them to the new variable and use this. below is my code and it works(already tested)
also you can see the whole code which from my blog: https://www.cnblogs.com/zero-zyq/p/17927154.html
Please mark this as best solution to help more developers.