You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While JSUtil.notNil is awesome, do keep in mind that it does not work for empty object. Use JSUtil.isEmpty for checking objects.
// Sample:gs.print("This does not work for object JSUtil.notNil({}):"+JSUtil.notNil({}));gs.print("This works for empty object JSUtil.isEmpty({}):"+JSUtil.isEmpty({}));varobj={a:1};gs.print("Not a empty object JSUtil.isEmpty(obj):"+JSUtil.isEmpty(obj));
Source: Kalai
You may know that get() function can accept two arguments. When you pass two arguments, the first becomes the column for searching and the second is the value. But you should also know that get() can return multiple records based on the condition passed. So do not write your script under the assumption that get() will return only one record.
varincident=newGlideRecord('incident');if(incident.get('caller_id',gs.getUserID())){//This returns more than one recordgs.print(incident.number);incident.next();//You can iterate to next record like a normal gliderecord querygs.print(incident.number);}
Source: Kalai
report.view event gets triggered by the platform whenever you view a report in ServiceNow. The event is also generated when the report is run via scheduled report.
What: GlideElement actually includes most of the String.prototype functions. Thus current.description.toUpperCase() for instance converts description to uppercase.
Source: János Szentpáli
sp_rel_widget_clone holds the relationship from which the widget was cloned.
If you want to relink your scoped app to a new repo, you have to delete the existing repo link for the app from sys_repo_config table. Deleting the existing link will allow you to use studio to add the new repo link.
What: #til : The evil of toString() - Regex strikes back
Spent few hours tracking this down as Replace method won't support regex for objects. What a fun Friday this was.
// Simplified code:varuri=gs.action.getGlideURI()varobject=uri.toString();varstring=uri+"";gs.print(uri);//gs.print(object.replace(/sys_scripts/,'')); //throws an error.gs.print(string.replace(/sys.scripts/,''));gs.print(typeofobject);gs.print(typeofstring);
#TIL
Today I learned that connection_test.do give you this handy measuring tool.
LinkedIn: https://www.linkedin.com/posts/iamkalai_til-servicenow-activity-6668864912032460800-Biho
Scheduling from a template. Would've always used a scheduled job/script.
Link: https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/administer/form_administration/task/t_ScheduleATemplate.html
While
JSUtil.notNil
is awesome, do keep in mind that it does not work for empty object. UseJSUtil.isEmpty
for checking objects.You may know that get() function can accept two arguments. When you pass two arguments, the first becomes the column for searching and the second is the value. But you should also know that get() can return multiple records based on the condition passed. So do not write your script under the assumption that get() will return only one record.
report.view event gets triggered by the platform whenever you view a report in ServiceNow. The event is also generated when the report is run via scheduled report.
You can rollback fix scripts. Why this isn’t on the form by default and why it is set to do this is beyond me. /shrug.
Link: https://jace.pro/post/2020-04-23-fix-scripts-can-rollback-now/
What: GlideElement actually includes most of the
String.prototype
functions. Thuscurrent.description.toUpperCase()
for instance converts description to uppercase.sp_rel_widget_clone
holds the relationship from which the widget was cloned.If you want to relink your scoped app to a new repo, you have to delete the existing repo link for the app from
sys_repo_config
table. Deleting the existing link will allow you to use studio to add the new repo link.What: #til : The evil of toString() - Regex strikes back
Spent few hours tracking this down as Replace method won't support regex for objects. What a fun Friday this was.
g_user
object is not available for client scripts on service portal widget. You can instead useglideUserSession
object to retrieve the same info.The text was updated successfully, but these errors were encountered: