How to add email icon in ui action button

viraj4
Giga Contributor

How to add email icon in UI action button??

1 ACCEPTED SOLUTION

Got it , below script works for me in my PDI

function onLoad() {

transformButton('email_incident', '#FF0000', 'white', 'icon-mail');

}

function transformButton (buttonID, buttonBackgroundColor, buttonTextColor, buttonIconName)  {
try{
//Find the button(s) by ID and change the background color
$$('button[id=' + buttonID + ']').each(function(elmt) {
elmt.style.backgroundColor = buttonBackgroundColor;
if(buttonTextColor){
elmt.style.color = buttonTextColor;
}
if(buttonIconName){
elmt.addClassName(buttonIconName);
//Add some spacing between the icon and button label
elmt.innerHTML = ' ' + elmt.innerHTML;
}
});
}catch(e){}
}

View solution in original post

23 REPLIES 23

Hi Viraj,

 

Can you update your script to something like this?

 

function onLoad() {

transformButton('approve', '#77FF77', 'white', 'icon-success-circle'); 
//transformButton('inspect the id of your ui action you want to change','color of that action','text color','icon')
}

function transformButton(buttonID, buttonBackgroundColor, buttonTextColor, buttonIconName) {
try{
//Find the button(s) by ID and change the background color
$$('button[id=' + buttonID + ']').each(function(elmt) {
elmt.style.backgroundColor = buttonBackgroundColor;
if(buttonTextColor){
elmt.style.color = buttonTextColor;
}
if(buttonIconName){
elmt.addClassName(buttonIconName);
//Add some spacing between the icon and button label
elmt.innerHTML = ' ' + elmt.innerHTML;
}
});
}catch(e){}
}

 

As mention above the function has these parameters - 

transformButton('inspect the id of your ui action you want to change','color of that action','text color','icon');

 

To inspect the id of your Ui Action check the below Screenshot - 

 

1) Press F12 on your form where Ui Action is present.

2) With the inspector, inspect the ui action for which you want the ID.

3) Put that id in the transformButton function.

4) Check the Isolate Script checkbox on your client script, it should be unchecked.

find_real_file.png

 

Hope this helps.

 

Regards

Omkar Mone

Hi Omkar,

I have tried the above code earlier but somehow I am not able to achieve the result.Could you please help me with the script so that I have the email icon in UI action.

Thanks in advance!!

Viraj

Can you put the updated script?

Hi Omkar,

I have updated the script to 

function onLoad() {

transformButton('email', '#77FF77', 'white', 'icon-mail');

}

Thanks

Hi Viraj,

 

Where is the transformButton function? Can you copy the exact code that i have provided, and in the first parameter of transformButton function can you press f12 and inspect the id of the button where you want to put the icon. I have tried the above script in my instance(the one i have provided) and after that i have out it here. So i know it is working fine.

 

Regards

Omkar Mone