- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2016 06:58 AM
I am Trying to debug my UI action after trying to follow the template set out in this blog
Client & Server Code in One UI Action - ServiceNow Guru
Both styles of logging do not seem to work in my code. I am not sure if doing this within a scoped application requires more permissions or something else.
Any Ideas ? I do not see any messages at the top of my screen nor messages below the number field
Here is my code:
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2016 09:47 AM
Hi Ian,
Thanks for the update. There was error on how you were displaying info message. Syntax is gs.info. I see you mentioned in your code as gs.Info(Error with Caps I)
Here is the final script :
runBusRuleCode();
//Server-side function
function runBusRuleCode(){
gs.addInfoMessage('IAY Package is ' + current.location_package.getDisplayValue());
try{
// var collectionGr = new GlideRecord('x_enig_extreme_quo_product_collection_location');
var collectionGr = new GlideRecord('incident');
gs.addInfoMessage('INIT gr');
collectionGr.addQuery('collection_id', current.location_package.getDisplayValue()); //if this is customf ield then it should be u_collection_id
collectionGr.query();
gs.addInfoMessage('preLoop');
}
catch(e)
{gs.info("Error: " + e);
}
gs.addInfoMessage('IAY in UI Action');
action.setRedirectURL(current);
}
Also collection_id referenced in line 18 doesn't looks to be OOTB field on incident table. If this is custom field then it should be u_collection_id. Please make changes and let me know.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2016 09:32 AM
Thank you Ian.
What is 'location_package'? It's not a standard task or incident field.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2016 09:47 AM
Hi Ian,
Thanks for the update. There was error on how you were displaying info message. Syntax is gs.info. I see you mentioned in your code as gs.Info(Error with Caps I)
Here is the final script :
runBusRuleCode();
//Server-side function
function runBusRuleCode(){
gs.addInfoMessage('IAY Package is ' + current.location_package.getDisplayValue());
try{
// var collectionGr = new GlideRecord('x_enig_extreme_quo_product_collection_location');
var collectionGr = new GlideRecord('incident');
gs.addInfoMessage('INIT gr');
collectionGr.addQuery('collection_id', current.location_package.getDisplayValue()); //if this is customf ield then it should be u_collection_id
collectionGr.query();
gs.addInfoMessage('preLoop');
}
catch(e)
{gs.info("Error: " + e);
}
gs.addInfoMessage('IAY in UI Action');
action.setRedirectURL(current);
}
Also collection_id referenced in line 18 doesn't looks to be OOTB field on incident table. If this is custom field then it should be u_collection_id. Please make changes and let me know.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2016 09:50 AM
Nice catch on the gs.Info(). Very hard to see!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2016 09:06 AM
Hi Ian,
Can you uncomment 11th line in your script. Also please paste whole script here(copy and paste the script) so that we can take a look.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2016 09:12 AM
Hi Pradeep,
Line 11 was commented out because we turned off the client capability in the UI action. There's no client code to be found so it was just overhead. We decided to run it all server side and turn off that field and make it all server side for testing.