can u tell me the five best practices that we use in a server side script

AryanJ471894898
Tera Contributor

Hey hi,
folks can u all help me with the question...
This will be very helpful for me in the interviews...

2 ACCEPTED SOLUTIONS

Bhavya11
Kilo Patron

hi @AryanJ471894898 ,

 

please refer this link.

 

If this information proves useful, kindly mark it as helpful or accepted solution.

Thanks,

BK

 

 

View solution in original post

Yashraj
Tera Expert

Hi Aryan,

There are a lot but you can use these 5

 

1. Variable names should be clear and specific so that you have better understanding while writing code

2. While creating a after BR, don't use current.update() as it will create a recurssive action 

3. Don't need to use current.update() in before BR as it will automatically save the record. If you use current.update() it will save your record twice

4. Try to use Script include as much as possible for better usability of the code

5. Use system properties instead of hardcoding sysid or any value

If this is helpful for you, please mark it as accepted solution. 

 

Thanks,

Yashraj

View solution in original post

3 REPLIES 3

Bhavya11
Kilo Patron

hi @AryanJ471894898 ,

 

please refer this link.

 

If this information proves useful, kindly mark it as helpful or accepted solution.

Thanks,

BK

 

 

Ankur Bawiskar
Tera Patron
Tera Patron

@AryanJ471894898 

You should be able to find answer to your question easily in google or in blogs

Technical Best Practices 

ServiceNow Server-Side Scripting Best Practices 

ServiceNow Development Best Practices 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Yashraj
Tera Expert

Hi Aryan,

There are a lot but you can use these 5

 

1. Variable names should be clear and specific so that you have better understanding while writing code

2. While creating a after BR, don't use current.update() as it will create a recurssive action 

3. Don't need to use current.update() in before BR as it will automatically save the record. If you use current.update() it will save your record twice

4. Try to use Script include as much as possible for better usability of the code

5. Use system properties instead of hardcoding sysid or any value

If this is helpful for you, please mark it as accepted solution. 

 

Thanks,

Yashraj