How to get popup (info message) on incident page

Yash38
Kilo Guru

Requirement is to include popup (info message) on create incident form in the case mobile phone number and business phone number are missing where we are asking the user depending upon the language of logged in user to maintain that contact data in the source system?

Info message to display : 

  • GER: Sind Sie interner-Mitarbeitender und wollen Ihre Kontaktdaten dauerhaft im System hinterlegen? Dann pflegen Sie diese einfach unter xyz.com (Daten zur Person --> Kontaktinformationen) ein.
  • EN: Are you an internal employee and want to permanently store your contact data in the system? Then simply enter them at xyz.com (Personal data --> Contact information).

 

On incident form we have 2 fields as mobile phone number and business phone number(Details in these fields gets auto populated from sys_user table),

we have an UI policy which makes mobile phone number field mandatory if both the above fields are empty and in that case we need to popup an info message using the scripting in the same UI Policy.

find_real_file.png

find_real_file.png

Thank You

1 ACCEPTED SOLUTION

SumanthDosapati
Mega Sage
Mega Sage

If you want to check current user language.

That is very simple. There is one shortcut for that. --> g_lang

alert(g_lang); // it will print en if english.

You can use that to add if condition. 

so your script will be :

if(g_lang == 'en')
{
g_form.addInfoMessage("Are you an internal employee and want to permanently store your contact data in the system? Then simply enter them at xyz.com Personal data --> Contact information.");
}
else if(g_lang == 'ger')
{
g_form.addInfoMessage("Sind Sie interner-Mitarbeitender und wollen Ihre Kontaktdaten dauerhaft im System hinterlegen? Dann pflegen Sie diese einfach unter xyz.com Daten zur Person --> Kontaktinformationen ein.");
}

 

Mark as correct and helpful if it solved your query.

Regards,
Sumanth

View solution in original post

19 REPLIES 19

From Sys_user table

I mean did you write a client script to populate them?

If yes, in the same client script you can add conditions and make mandatory and show field message.

In that case you can deactivate your ui policy.

 

Regards,
Sumanth

No i didnt write client script to populate data.

In variable we have a field call default value there i have written script like this : 

javascript: gs.getUser().u_mobile_phone

@SUMANTH DOSAPATI,

I'm going to have to highlight here, please don't code like this as it's a "hard-coded string" which is not good practice. I have blogged about this very topic in the past (here), 

To learn more about the MessageAPI please review our Language Guide (here),

Many thanks,
Kind regards 

--------------------------------------------------------------------
Director of Globalization Deployment, Internationalization

@Alex Coope 

My intention here is not to hardcode. I knew that isn't best practice.

Here I just wanted to provide him the logic to complete his business requirement.

Anyways thanks for your article. That's a good one!!