Best Practice to follow while adding code to the out of box script include.

divyasurada
Tera Contributor

Hi,

When security incident is created through ITSM incident through a UI action "Create Security Incident", I want to copy some more fields from ITSM incident to the Security incident.

find_real_file.png

For this, can I directly add the code to the out of box script include or do I have to create a copy of the script include and then add my code to "CreateFromIncident" function?

find_real_file.png

Please help me with the best practice that I need to follow here.

Thanks,

Divya

1 ACCEPTED SOLUTION

Hi Divya,

 

I donot have any exact documentation but let me tell you, in one of my projects i had to work on change module and change the flow of flow formatter by adding an extra stage as the customer wanted, there i had to make changes in the OTB script include that handles this. I dont think your case would have any affect during the upgrade. But if upgrade haunts you to override the OOTB SI then i would suggest you to create a new once and call it.

 

Hope this helps.

Omkar Mone

View solution in original post

9 REPLIES 9

Omkar Mone
Mega Sage

Hi 

Best practise says not to ammend the existing functionality because it may have effect on various places.

I would suggest you to create on more function same as this one(different name) and add your lines of code in order to proceed.

 

Hope this helps.

 

Regards

Omkar Mone

Hi Omkar,

Thanks for your reply.

Can you also please tell me if I can add the new function to the existing out-of-the-box script include or create a new script include and then add a new function to this?

Hi Divya,

 

Creating a function in script include won't have any effect because this is your custom function and it won't be called from anywhere else until you call it. So writing it in the same SI would be a good option.

 

Regards

Omkar Mone

Hi Omar,

During upgrade, this script include will be excluded from upgrade process because this script include will be customized. Is it okay if this happens?

Also can you tell me in which cases we update the existing Script Include/Business rules and in which cases we cannot.

Can you also share a related best practice document by serviceNow if you have any.

Thanks

Divya Soorada