Calling a script include in breadcrumbs

Snow-Man
Tera Contributor

Hello Guys,

 

I have a requirement to show list in custom table for fiscal start period FY25 and fiscal end period FY25. 

so we have created a system property which stores the value i.e FY25. I made a script include that gets this sys property and I am calling that script include in breadcrumb. I tried both script includes with client callable checked(I am getting undefined) and unchecked (I am getting NULL). when I testing script include so it is displaying me FY25. it means script include is good. what could be the issue? please let me know and how can I make it works

 

thank you everyone 

WhatsApp Image 2024-05-11 at 13.42.50.jpegWhatsApp Image 2024-05-11 at 13.43.01.jpegWhatsApp Image 2024-05-11 at 13.43.08.jpegWhatsApp Image 2024-05-11 at 13.43.14.jpeg

3 REPLIES 3

Keminda
Tera Expert

seems like gs.getProperty is failing in the script include. As a workaround you can query the properties table and get the value as below

 

        var result = "";
        var sp = new GlideRecord('sys_properties');
        sp.addQuery('name', '<property_name>');
        sp.query();
        if (sp.next()) {
            result = sp.getValue('value');
        }
retun result;

Community Alums
Not applicable

Hi @Snow-Man ,

 

Please find the below snapshot of the script include that you need to configure.
@Keminda has provided the correct script that you should use in your

script include:

SanjayG_3-1715430413956.png

function myFunction() {
        var propertyValue = "";
        var systemProperty = new GlideRecord('sys_properties');
        systemProperty.addQuery('name', 'get_value_test');
        systemProperty.query();
        if (systemProperty.next()) {
            propertyValue = systemProperty.getValue('value');
        }
    return propertyValue;
}

Property:

SanjayG_1-1715430063025.png

Calling function in the filter

SanjayG_2-1715430195525.png

 

 

To add more on this, you can refer to the link below to configure the module and call a script-

https://www.servicenow.com/community/developer-forum/script-include-not-working-in-filter-condition/...

 

If my response has resolved your query, please consider giving it a thumbs up ‌‌ and marking it as the correct answer‌‌!

 

Thanks & Regards,

Sanjay Kumar

Community Alums
Not applicable