How to add a Country Flag icon on a incident or change request record

Frans Brus - No
Tera Guru

Hello,

How would I be able to show a country flag on a incident or change form?

Like:

We have customers in different countries and I would like to show a flag icon next to the company name.

I know you can an reference attributes on User level (ref_contributions=user_show_country) but I would like to show it on company/account level and not on user level.

The company record had a field 'country' which contains a land code (for example: USA)
I thought it can be done with field styles, but I'm completely stuck.

Google show some info that could be correct but I cannot open the link

The content you requested cannot be displayed right now. It may be temporarily unavailable, the link you clicked on may have expired, or you may not have permission to view this page.

https://community.servicenow.com/community?id=community_question&sys_id=f23105b1db5ae450f77799ead39619a3

Anyone who has this in place on your instance and could/would help me out?

We are also on CSM, and I also want to use/show it in Agent Workspace.
I hope this can work also.

2 REPLIES 2

Gaurav Rotke1
Kilo Guru

Hi Frans Brus - NorthC,

I found a article related to attaching a image icon with the field,

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0751636
I am also exploring this, check it out, it might help.
 
Thank you
Gaurav Rotke

Frans Brus - No
Tera Guru

I have figured out how to present it on Change Level (on a form) and also on Account Level (form) find_real_file.png

I created a Style without JavaScript condition.

find_real_file.png

 

But I want to show a country flag based on a field within the Account record.

The company shows a flag of the actual company based on a Script Include is correct in a list view.

find_real_file.png     find_real_file.png

This is the Script Include:

var AccountFlag = Class.create();
AccountFlag.prototype = {
    initialize: function() {
        this.country = current.country;
        this.CHGcountry = current.company.country;
    },

    //True if country code is NL
    NL: function() {
        return this.country == 'NL';
    },

    //True if country code is DE
    DE: function() {
        return this.country == 'DE';
    },

    //True if country code is CH
    CH: function() {
        return this.country == 'CH';
    },

    //True if country code is NL on change
    CHGNL: function() {
        return this.CHGcountry == 'NL';
    },

    //True if country code is DE on change
    CHGDE: function() {
        return this.CHGcountry == 'DE';
    },

    //True if country code is DE on change
    CHGCH: function() {
        return this.CHGcountry == 'CH';
    },

    type: 'AccountFlag'
};

If I refer in the style to the Script Include with "javascript:new global.AccountFlag().DE();

It does work in a list view, but not in a form view

find_real_file.png

 

Can this be done with a style or should I use a Client Script?