Use Case: Let us say for example we created a widget to just upload a file and other widget to display the files for the current record. As and when the file is uploaded in the first widget, we need to refresh the attachment list in second widget This can be done by sending a […]
Avoid duplicate attachments in ServiceNow
This can be achieved by creating a before business rule on the sys_attachment table. If there is a file with same name, same content type and of same size in bytes then the attachment upload is aborted. The code for the same is as below (function executeRule(current, previous /*null when async*/) { var attach = […]
Mark terminated LDAP users as inactive in ServiceNow
We Find inactive LDAP accounts using the last refresh time. In this method, we add a Last Refreshed field to the user record and set the value during the import process. We create a scheduled job that checks for users that have not been refreshed in 30 days, and deactivate them. Create a datetime […]