What Are Syntax Macros?

Syntax Editor Macros are rarely talked about.
Effectively, they are a text replacement table for script elements.

That might not seem that big of a deal, but for me. It could have saved me some serious headaches. Let's look at the examples provided on the docs site.

vargr will replace itself to;

var gr = new GlideRecord("");
gr.addQuery("name", "value");
gr.query();
if (gr.next()) {

}

As much as I dislike the use of variable name gr as using just that name can cause issues, its nice!

You can change the code up so if you want to ensure a glideAjax call always uses some format like I use cause for me consistency is key.

Additionally, because I don't believe anything is permanent online I'll include links and Wayback links to these next resources.

This shark711 person form Australia has had a "sn-syntax-editor-macro" repo public since 2016. Wayback Link.

In that repo its just a collection of these syntax editor macros.

Does it work everywhere in the platform?

Sadly, no, it doesn't work in the Service Portal Widget Editor screen :(

Thankfully, Dan Gibbard's post comes to the rescue Wayback;

He has a UI Script that he says you just gotta add to the widget editor widget. That's a mouthful.

Thanks jgr1ffin for sharing https://www.cheatography.com/kipp/cheat-sheets/personal-servicenow-syntax-macros/