gs.addInfoMessage() and gs.print() sometimes doesn't work at the same script? Please read the description

Ashirav
Tera Expert

gs.addInfoMessage(gs.getMessage("New User Created: {0}", current.caller_id.getDisplayValue()));

I have used this statement on a 'Before' Insert and Update Business Rule. When the page is to be submitted this runs. While testing I noticed sometimes sometimes it worked and sometimes it didnt work?

Same with gs.print() function.

Any specific reason? Is this normal to happen? Has it ever happened before?

Thanks.

 

1 ACCEPTED SOLUTION

Hi,

if you use gs.info("test"), then it will be visible every time this script is called.

if you use gs.addInfoMessage, hen this will be visible only when you are on the screen from where this script is executed.

if you are using gs.info or gs.log with the dynamic value, then if the dynamic value is null, then you might not see the information. 

Hence it is advisable to add the log with the static text along with dynamic something like below

gs.info("Testing value"+yourval);

Also, check if the gs.info log exists in any condition. Maybe the script or block of code is not being executed everytime.

Mark comment as correct and helpful if this helps.

View solution in original post

6 REPLIES 6

Nitesh Balusu
Giga Guru

Typically you would only see gs.print display if you were running as a background script where you could actually see the feedback from the script being run.   However, if you actually download the log file (System Logs > Node Log File Download) you would be able to see the results of gs.print statements there as well.

 

 

Thanks for replying Nitesh.

I use "Debug Log" in Left navigator to view the logs using the gs.print() option. Sometimes the value is displayed, sometimes it isn't.

I am not quite sure where you're running this, now it might not display anything may be because it has nothing to display, may be nothing is returning from the script. It depends on the script you're trying to execute.

 

If you for example randomly say gs.print("blah blah blah"); it must display every single time. But if the script is returning something then it depends on other factors.

Shashwat  Saxen
Giga Expert

Just use this. 

gs.addInfoMessage("New User Created: {0}"+ current.caller_id.getDisplayValue());