The CreatorCon Call for Content is officially open! Get started here.

what is getAttribute('something') used for? (easy points!!)

juan casas
Mega Expert

Hello,

This is probably the easiet question Il post here!!

I have the following script::

 

    function hasEmailClient() {
        var gr = new GlideRecord(data.table);
   
        if (gr.get(data.sys_id)) {
            return gr.getAttribute('taco_chiken') ? gr.getAttribute('taco_chiken') : false;
        }
        return false;
    }

 

so this works for some tables and not others, I though this was checking a field on the table called 'taco_chiken', but its not.

I understand that you can check attributes on fields, but is this checking a attribute on the gliderecord obj itself?

the data that comes back from the getAttribute('...') I either 'True' or 'null'

 

How do I set/change the getAttribute per table?

1 ACCEPTED SOLUTION

Hitoshi Ozawa
Giga Sage
Giga Sage

Hi Juan,

There's a api document.

Returns the dictionary attributes on the specified field.

https://developer.servicenow.com/dev.do#!/reference/api/sandiego/server_legacy/c_GlideRecordAPI#r_Gl...

View solution in original post

2 REPLIES 2

Hitoshi Ozawa
Giga Sage
Giga Sage

Hi Juan,

There's a api document.

Returns the dictionary attributes on the specified field.

https://developer.servicenow.com/dev.do#!/reference/api/sandiego/server_legacy/c_GlideRecordAPI#r_Gl...

Hi again,

To be more precises, it's returning the value of "attributes" field in sys_dictionary table. The "fieldName" that is passed is the name of the attribute.

find_real_file.png