How to modify, the list of incidents from an value of field in Problem Management

seraias2016
Kilo Expert

Hello Experts.

I have an request from my customer.

he want select an incident and to relate to problem. but the request is that not want view all incidents

 find_real_file.png

he want view only incidents that belongs of an account, (the account is refence field in PM, but also exists in IM).

find_real_file.png

I tried it with the filter, but not can create filter dinamic with value of account field of PM.

find_real_file.png

 

I tried it with a dinamic filter witn script include, but also not function.

find_real_file.png

 

The script include get value the account in PM.  if I call the Script Include in BR it function well, but in the filter don´t funcion, 

Also I reviewed the list control but I can´t create an filter before show information in collection.

Do you have an idea, to solve it.

Is posible create an filter before show the collection.

 

 

1 ACCEPTED SOLUTION

seraias2016
Kilo Expert

I solved the requeriment for my customer.

I describe the step for it.

  • I modified the UI Action "Edit".
  • into script I obtained the sys_id of record of problem.
  • I opened the table of problem and get the value of field that is pivot
  • I added the sysparm_query to uri.set.
  • I builded the url and "ta-da👍" I view only the data desired.

So very thank you for your ideas.

 

Regards

 

kindly mark it as helpful and correct answer if it helps you.

View solution in original post

12 REPLIES 12

Hi,  

jerry2zhou

 

Of course, I share the script in ui action. 

Regards

var uri = action.getGlideURI();
var path = uri.getFileFromPath();
uri.set('sysparm_m2m_ref', current.getTableName());
uri.set('sysparm_collection_related_file', current.getTableName());
uri.set('sysparm_form_type', 'o2m');
uri.set('sysparm_stack', 'no');

//Para mostrar unicamente los INC. 
var liga = uri.toString('sys_m2m_template.do');
var param= liga.slice(153,185);


var problema;
var estacion;
var alcance;

    var gr = new GlideRecord('problem');
	gr.addQuery('sys_id', param);
    gr.query();
    if (gr.next()) {
    problema = gr.number;
    estacion = gr.u_estacion; 
	alcance = gr.u_alcance;
	     }

//para Estación
if(alcance=="Estación") { //if Estación
uri.set('sysparm_query',"u_cuenta_del_solicitante="+estacion+"^stateIN6,7");
action.setRedirectURL(uri.toString('sys_m2m_template.do'));
}

 

I hope it be useful for you

Community Alums
Not applicable

Hi seraias2016,

 

Yes, it help a lot and thanks so much!

still have 2 questions need your help:

1)Does the change made on the original global out of box Edit.. UI Action or a new one, I assume it is new one since if it is the global one I expected to see something " if the table is problem, then add this...".  But I tried to create new EDIT.. one to many UI action to overwrite the global one for a particular table, it seems the overwrite did not happen, did I miss anything?

 

2)Does this query "

uri.set('sysparm_query',"u_cuenta_del_solicitante="+estacion+"^stateIN6,7");

"

actually apply to the related incident table,  instead of parent problem.

 

I missed this point as well.

 

Thanks lot and Happy New Year!!

 

Jerry

 

 

 

 

Hello

1) you can modify the original UI ACtion or create a new UI Action, depends on your requeriment.

2) the query, filter two fields in the table. the Ui action calls an table depends on where button appears. the bucle if works with fields on problem, you can modify accordint to fields and table.

 

happy new year my friend!.