Using g_form.flash on a service catalog form

treycarroll
Giga Guru

When I try to use

 

g_form.flash('sc_cat_item.ci_name','#FF0000',-4);

 

from a catalog client script, I get the following error

 

flash error.png

 

The documentation for g_form flash states the the widget name should be in the form <table name>.<field name>

 

I have tried:

g_form.flash('sc_cat_item.variables.ci_name','#FF0000',-4);

 

g_form.flash('variables.ci_name','#FF0000',-4);

g_form.flash('sc_cat_item.ci_name','#FF0000',-4);

g_form.flash('ci_name','#FF0000',-4);

 

Is there no way to make a field flash on a service catalog form?

1 ACCEPTED SOLUTION

Matthew Swarts
Tera Guru

Hi Trey,



I was able to apply g_form.flash to service catalog variables by first inspecting the element I want using Firebug in Firefox and locating the label_IO sys_id.   then use that in place of the variable name in the script.



For an onLoad example:



function onLoad() {


        g_form.flash('label_IO:33586fd4ad054100872edb6647c09400',"#CC0000", -2);


}



You just need the correct label_IO and associated sys_id which you can copy out of Firebug and you should be good.


View solution in original post

6 REPLIES 6

Hey Sri,



It appears that there is a conflict in the styles. So when you use the g_form.flash, it is just adding a background color to the label for the specified amount of time and then removing it twice. If you look at your element inspector in your browser, you'll see the style dynamically added and removed. It just so happens that any background color on a label now is overwritten.



Notice the style that is applied through CSS:


Screen Shot 2015-10-30 at 2.33.34 PM.png



You'll have to open that as a bug to SN, but they may not support it since they never really offered g_form.flash support on catalog forms. It's more of an oversight I think. Your best bet would be to write your own function and include it on each item that needs it or as a variable set with just the script. You can still use the above method from previous posts to get the element and then the label tied to that element.



Hope that helps!


Hi Sri,



This felt like it was a "fork" of the original topic, so I created a separate thread here:



Re: Using g_form.flash on a service catalog form



It contains a bit of client script that you could use to implement a flash in Fuji in a pinch.



Trey Carroll