Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How to set script include within field default value

mkdj12
Giga Contributor

Within this list collector, I am attempting to have this script include return a value for the field but I am unsure if the value that I am passing into the function (current.sys_id) is being sent over. 

 

Default Value:  javascript: new announcement_portal_util().getDefault(current.sys_id);

Script Include:

var announcement_portal_util = Class.create();
announcement_portal_util.prototype = {

    getDefault: function(announcement) {
        var gr = new GlideRecord("m2m_announcement_portal");
        gr.addQuery("sys_id", announcement);
        gr.query();
        if (gr.next()) {
            return gr.sp_portal;
        }
    },
    type: 'announcement_portal_util'
};
1 REPLY 1

Michael Fry1
Kilo Patron

You can add a gs.log statement after the function to confirm you're getting the correct value.