- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2018 12:29 PM
Hi Team,
Could you please provide me the solution for below requirement.
How to add flag icon in field control .
for example :
User is india --display india flag
user is USA -- display USA flag.
Through ui macros
.Could you please provide me the solution for this requirement
Thanks in ADV.
Regards,
Vamsi M.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2018 08:27 AM
You have multiple reference attributes there.
1) ref_contributions
2) tree_picker
Reference attributes are separated by commas. If you have multiple items for one attribute (like 'user_show_country' and 'user_show_incidents'), those should be separated by semicolons. In order to maintain current functionality and add another macro your 'Attributes' field value should look like this..
ref_contributions=user_show_country;user_show_incidents,tree_picker=true
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2018 03:30 AM
Hi Mark,
Thanks for your response .
its working fine.just i have small doubt for flag set
based on group display the country flag
for example:Us Citizen group --vamsi is member of the Us citizen group
Indian Citizen group --krishna is member of the Indian citizen group.
if i select krishna i want to display Indian flag .
could you please provide solution for this.
i used below code its not working.
Thanks in ADV .
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate var="jvar_guid" expression="gs.generateGUID(this);" />
<j:set var="jvar_n" value="show_user_country${jvar_guid}:${ref}"/>
<g2:evaluate jelly="true">
//Set country image names (as uploaded to Images module) here
var usImage = 'USA321.png';
var indiaImage = 'INDIA32.png';
//Add additional countries by copying 'else if' statements and modifying country information in 2 locations below
var userGroupDisplay;
var userGroupName;
var userGroupImage;
var id = __ref__.getSysIdValue();
if (id == null) {
userGroupDisplay = "none";
}
else {
var caller = new GlideRecord('sys_user_grmember');
caller.get(id);
if (!caller.Group.nil()) {
userCountryDisplay = "";
//Add additional countries here by copying the 'else if' statement below
//If user is from United States
if (caller.Group== 'Us Citizen') {
userGroupName = 'Us Citizen';
userGroupImage = usImage;
userGroupDisplay = "";
}
//If user is from India
else if (caller.Group== 'Indian citizen') {
userGroupName= 'Indian citizen';
userGroupImage = indiaImage;
userGroupDisplay = ""
}
else {
userGroupDisplay = "none";
}
}
else {
userGroupDisplay = "none";
}
}
</g2:evaluate>
<a id="${jvar_n}"
name="${jvar_n}"
style="display:$[ userGroupDisplay ]; cursor:default"
title="User location: $[userGroupName]">
<img id="${jvar_n}_image" border="0" src="$[userCountryImage]" height="24" width="24"/>
</a>
<script>
//Client script portion to handle 'onChange' events after initial load
needsRefreshCaller = false;
function onChange_caller_id_show_user_country(element, original, changed, loading) {
var s = '${ref}'.split('.');
var referenceField = s[1];
if (needsRefreshCaller == false) {
needsRefreshCaller = true;
return;
}
if (changed.length == 0) {
$('${jvar_n}').hide();
return;
}
var callerRec = g_form.getReference(referenceField , callerShowCountryReturn);
}
function callerShowCountryReturn(callerRec) {
var el = $('${jvar_n}');
var imgEl = $('${jvar_n}_image');
if (callerRec.Group) {
//Add additional countries here by copying the 'else if' statement below
//If user is from United States
if (callerRec.Group == 'Us Citizen') {
el.setAttribute('data-original-title', "User location: United States");
imgEl.src = "$[usImage]";
el.show();
}
//If user is from India
else if (callerRec.Group == 'Indian citizen') {
el.setAttribute('data-original-title', "User location: Japan");
imgEl.src = "$[indiaImage]";
el.show();
}
else {
el.hide();
}
}
else {
el.hide();
}
}
var l = new GlideEventHandler('onChange_caller_id_show_user_country', onChange_caller_id_show_user_country, '${ref}');
g_event_handlers.push(l);
</script>
</j:jelly>
Regards,
Krishna M.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2018 04:56 AM
That's a different requirement that you should ask in a new forum post...and a bit more complex to implement. You should mark my original response as the correct answer to your original question and then post a new question for the group issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2018 05:57 AM
Hi Mark,
Yes, Its working fine for original question .
thank you so much mark.
Regards,
Krishna M.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2018 06:18 AM
Yes, please mark his response as correct.
Any new requirement or question, please make a new post.
Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
