Syntax Editor Macro [ServiceNow]
hello everyone so in this video we are going to discuss a very useful utility or shortcut I would say while doing the scripting you can utilize this so it becomes very handy and very useful so it is a syntax editor network so some people might be aware of this some might not be so let's just go to instance so you have a syntax editor make roads module available in the system so you can go system definition and syntax editor macro so you can type syntax so here you have in text editor macros in system definitions so how these are useful basically so when you do the scripting actually if you see here some names dog for in for method where gr so if you go to a syntax editor let's go to the advanced ok if you type if you have already used it or if you not you can just try you type there gr and this press step you will see glide record some query related code automatically comes up so you can now fill in your table you can you fill in your query parameters and query and then you can write your logic inside there so how this is coming this is coming through syntax editor macro now if you see here we have one outer box in text editor macro define that is where you are now you have other as well like like you have info here for you have a method you have a gr or so if we go here and just remove this let's just I bear gr or and press step you will see the code which is I've typed here already in where gr so if you go here let me see the same code is available here you can ratify it we have another macro like for so if you type for and press tab it will give you the for loop so it becomes very useful and very handy while you are doing the scripting you can use these pre formatted function the defined function which help you writing your code very fast and reduces the error chances you can also define new macros which you usually use in quotes by doing the development or while doing the coding you can define your macros and make use of to it so let's just define one new macro editor so we don't have here a macro editor for insert so I will type the name as insert and sorry is ready then you can give some comments here or what exactly this function do so let's just put this function use to insert record in a table now you can type your code here like where gr is equal to new flight record and then you can we drank in code so whatsoever we'll be using that he will type the table here then we are God in his lies not in his lies then you can give some hint kind of thing but how we can set the values so let s put commented 1 let's say g r dot description so you can set the values according to age requirement and said well you and fresh your request rent now you can use gr dot insert now you will save it and your micro is ready now you can use it in your syntax editor while doing the scripting so let's just be loaded go to advanced and you have here your script section now she will type insert and press tab the code which you have written it is there you can now fill in your table like you incident and you can set your values which you want to set on incident and use it according to your requirement so you can define your new macros or you can make use of the already define macros like where gr for glide record for loop then where gr or and make use of those in your scripting thank you for watching the video please like share and subscribe I will be back with some other video thank you
https://www.youtube.com/watch?v=UopwB4ObYic