Customer doctype scripts, get_last_doc

Hoping someone can help me understand the best way to create custom scripts for the Customer doctype.

I’d like to use the function get_last_doc. I’ve read in the forum that this can’t be used on the client script side. However if I were to make changes or add scripts to the Customer doctype directly, this would be wiped when I update ERPNext at some point in the future, right?

Wondering how to proceed with these constraints? Any help would be greatly appreciated.