Unable to retrieve property value using gs.getProperty('') in scheduled report (sysauto_report)

pavan_yadav
Tera Contributor

I'm trying to use var prop = gs.getProperty('some.property.name'); inside a scheduled report (sysauto_report), but the value of prop keeps returning undefined. Can anyone confirm if gs.getProperty() works in scheduled reports, or if there's a limitation in that context?

 

Thanks,
Pavan.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@pavan_yadav 

I believe it has something to do with the sandboxing.

Check this link which talks the same which all classes are not allowed

Script sandbox property

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

31 REPLIES 31

GlideFather
Tera Patron

@pavan_yadav FYI

I tried it in my PDI but I cannot get no logs at all, not undefined, but nothing....

 

Documentation:

 

KamilT_0-1752665111305.png

https://developer.servicenow.com/dev.do#!/learn/learning-plans/xanadu/new_to_servicenow/app_store_le...

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


Community Alums
Not applicable

As Ankur mentioned this is due to script executes in sandbox and you don't have access to gs.getProperty() method.

Hello @Community Alums ,
Is there any document, please give me link, 
i want to override that behaviour

Mark Manders
Mega Patron

If it is for branding of the email, you can use email scripts. Those work in scheduled reports as well. And from there your can absolutely call properties.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Hi @Mark Manders ,
Yes we can also use email scripts but in my case I need to apply this condition in SLA, this report schedule should send notification only 9am to 7pm, so I already declared timings in cmn_schedule table, 
so in the schedule report I'm using GlideSchedule() and its method isInSchedule(), these 2 are helps to restrict schedule running between the time.