Logging within Scoped UI Actopms

ian_mackey
Kilo Contributor

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:

find_real_file.png

1 ACCEPTED SOLUTION

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.


View solution in original post

10 REPLIES 10

I missed reading first response to this thread.Thanks Chuck for the update