The bane of every ServiceNow Application Developers existence!
Some functions are not allowed in scope for a good reason ( like gs.getSession().impersonate() ) while others seem to be arbitrarily not available ( like applyTemplate() ).
If you want to know exactly what is and is not in callable in scope, it is all in the API documentation.
Read more here: LINK
Source used with permission.