How to open server side scripting window?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2014 10:36 PM
Hello All,
We often come across situations when we want to run our server side script on a form. The only way today is to go to background script and run the code. The problem here is not just going to background script module but also the code that we run.
Now if I want to copy short description into the description of an incident, I would simple want to write
current.description = current.short_description;
current.update();
but in the background script I have to write :
var inc = new GlideRecord('incident'); inc... if(....) { // Do some stuff
We are familiar with the similar client script javascript debugger : Press CTRL + ALT + SHIFT+ J but we dont have any debugger to do server side coding.
I thought of creating such window so we could easily test our server side scripts using the current object.
To create this, I have written a UI action which would be visible on all the tables in Form context menu. When the developer clicks on this button, it will call a UI page which will open a window to write your code. Once you click on OK, it will in turn call a script include which will run your code.
The entire logic has been added in the attached update set. The functionality will also check for errors in your code and print the error in the system log.
You may install this update set and play around if you like it.
Note: The above functionality works same as background script with an additional feature of current object. So this window could easily replace background script.
All the feedback is welcome.
Regards,
Bhavesh Jain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2014 08:50 AM
That's a cool idea.
I do this using onboard stuff:
Add the Background Script module to your UI11 bookmark pane and change its type to be "flyout".
Now you can also always run scripts without leaving the screen.
Disadvantage of it compared to your solution is of course that mine does not have the "current" object which is provided by your Script Include which is really making it more handy than the flyout version.