Creating a Related List

jamesmcwhinney
Giga Guru

Ok, so I have read the wiki over and over to make sure I am not missing something, but am still having trouble.

I am trying to create a related list on the incidents table to show all agile enhancements which are associated with the given incident via the task relationship table (task_rel_task).

So I tried creating a new related list as follows:

Name: Requested Enhancements

Applies to table: rm_enhancements

Queries from table: task

Script:

var grSQ = current.addJoinQuery('task_rel_task','parent','sys_id');

grSQ.addCondition('parent', parent.sys_id);

Could anyone give me an idea of where I am going wrong.

The related list is not showing up as an option under the available related lists when I open up an incident record and click "Confiure->Related Lists".

Also, what confuses me further is that many of the options that I do see available, dont appear to be defined in the "Relationships" table.   Where are they coming from???

Thanks!

- James

1 ACCEPTED SOLUTION

jamesmcwhinney
Giga Guru

Ok, I had it all messed up.



Here is what I needed:



Name: Requested Enhancements


Applies to table (Related list will be visible for this table): task


Queries from table (Related list will pull results from this table): rm_enhancements


Script:


//Only show enhancements for which there is a task_rel_task record which has a child value equal to the given enhancement's sys_id


var grSQ = current.addJoinQuery('task_rel_task','sys_id','child');


//.....and for which the task_rel_task record has a 'parent' value of the current task's sys_id


grSQ.addCondition('parent', parent.sys_id);


View solution in original post

3 REPLIES 3

richelle_pivec
Mega Guru

Did you add a reference field to one of the fields on that table onto your Incident Form. Usually once I add the field using "Configure: Form Layout" (in Fuji), the related table then becomes available for me to navigate to as a related list.



Richelle


jamesmcwhinney
Giga Guru

Ok, I had it all messed up.



Here is what I needed:



Name: Requested Enhancements


Applies to table (Related list will be visible for this table): task


Queries from table (Related list will pull results from this table): rm_enhancements


Script:


//Only show enhancements for which there is a task_rel_task record which has a child value equal to the given enhancement's sys_id


var grSQ = current.addJoinQuery('task_rel_task','sys_id','child');


//.....and for which the task_rel_task record has a 'parent' value of the current task's sys_id


grSQ.addCondition('parent', parent.sys_id);


Hi James,



Could you please have a look at this one and help me ? : Creating Related Lists for Contract and Entitlements on Incident form