In the related list I want keep this condition

harsha vv
Tera Contributor

I have created a button in  incident to create request and also created a related list for this request but in this related list all request  are showing but i want only for one particular incident i want that  related request only in the related list

harshavv_0-1714652222274.png

 

6 REPLIES 6

Mark Manders
Mega Patron

How did you create the related list? How are you relating the incident with the request? You are only sharing the result, not how you got there. It looks like you just have a list with requests or maybe a list with requests related to an incident, but definitely not the requests where xxxx-field is current.incident.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

I have created a button to convert an incident to request after that I have to show that request in the incident in related list and I have created related list from relationships

That doesn't answer the question on how you are relating the incident with the request. Do you have a 'parent' or 'incident' field on the request, to show that relation? 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Pavankumar_1
Mega Patron

Hi @harsha vv ,

if you are created a relationship for this requirement. Use below code to query the particular request.

 

Screenshot 2024-05-02 at 6.15.16 PM.png

(function refineQuery(current, parent) {

    // Add your code here, such as current.addQuery(field, value);
	//parent.sys_id is the incident sysid 
    current.addQuery('parent', parent.sys_id); //parent field will have the related incident record

})(current, parent);

 

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar