Related List - Question?

Community Alums
Not applicable

Hey Everyone! 

 

I hope all is well. I am creating a related list/relationship that applies to the interaction table and queries from the wu_appointment table. 

 

Nonetheless, the goal is for the interaction table to show the appointment for the user. One appointment per interaction. 

 

I want the query to query the sys_id for the interaction, but it isn't working. 

 

What am I missing? 

 

(function refineQuery(current, parent) {
var appointmentID = parent.opened_for;

var appointments = 'sys_class_name=wu_appointment^contact='+ appointmentID; 

current.addQuery("sys_id", current.sys_id);
current.addEncodedQuery('active=true'+ appointments);
current.addEncodedQuery('ORDERBYDESCopened_at');
	// Add your code here, such as current.addQuery(field, value);

})(current, parent);
1 ACCEPTED SOLUTION

James Chun
Kilo Patron

Hi @Community Alums,

 

How are you setting the relationship between the Interaction record and the Walk-up Appointment record?

If you use the 'Associate Record' functionality, the wu_appointment will be automatically visible under the 'Related Tasks' tab in the Interaction record.

e.g.

JamesChun_0-1712606468958.png

 

 

In regards to your script, looks like you want to fetch all the active wu_appointment with the same caller/requestor value. Not sure if you want to be doing that but try the script below:

 

(function refineQuery(current, parent) {

    current.addActiveQuery();
    current.addEncodedQuery('contact=' + parent.opened_for);

})(current, parent);

 

 

Cheers

View solution in original post

2 REPLIES 2

James Chun
Kilo Patron

Hi @Community Alums,

 

How are you setting the relationship between the Interaction record and the Walk-up Appointment record?

If you use the 'Associate Record' functionality, the wu_appointment will be automatically visible under the 'Related Tasks' tab in the Interaction record.

e.g.

JamesChun_0-1712606468958.png

 

 

In regards to your script, looks like you want to fetch all the active wu_appointment with the same caller/requestor value. Not sure if you want to be doing that but try the script below:

 

(function refineQuery(current, parent) {

    current.addActiveQuery();
    current.addEncodedQuery('contact=' + parent.opened_for);

})(current, parent);

 

 

Cheers

Community Alums
Not applicable

Hey James, 

 

It does work for the Assoicate Record and the answer was in that relationship query. 

So, when I used your more simplified query and added the interaction query, I got my answer. 

 

current.addActiveQuery();
current.addEncodedQuery('contact=' + parent.opened_for);
current.addEncodedQuery('interaction=' + parent.sys_id);

 

Thanks!