A quick tip...
Because the sp.ui.dialog.js library is lazy-loaded, it may not be available when the page is ready / loaded. I've seen some early examples where if you wanted to do something on page load, you use:
This will not work if you want to open a SharePoint dialog on page load. Instead use: