- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2014 10:19 AM
Adam,
That is a good idea let me try that and see if it is acceptable on the other end!
Thanks,
Nathan G.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2014 07:10 AM
Adam,
Unfortunately this method will not work, because depending what column it is in will depict what table shows up, which means if the record is in both columns down the line they both show up still... I will have to revamp the whole structure and try to find a new way.
Thanks,
Nathan G
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2015 11:17 AM
Nathan, do you recall what you ended up doing here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2015 05:39 PM
Hello,
I ended up creating a list type field on the change table. From there I created a relationship(System Definition>Relationships) From the Change Req table to the Change Req table with the following query:
current.addQuery('sys_idIN' + parent.u_related_changes);
Then I overwrote the save and update functions for when they edited the list to query the change table and add the current change to the associated changes added or updated. as well as removed them with this code:
var gr = new GlideRecord('change_request');
gr.addQuery('sys_id','IN' , current.u_related_changes);
gr.query();
/*
gs.addInfoMessage('Current Sys ID: ' + current.sys_id);
gs.addInfoMessage('selected Sys ID: ' + current.u_related_changes);*/
while(gr.next()){
if(gr.u_related_changes == ''){
// gs.addInfoMessage('No Recored so the parent Child is entered1');
gr.u_related_changes = current.sys_id;
}else if(gr.u_related_changes.indexOf(current.sys_id) == -1){
// gs.addInfoMessage('No Recored so the parent Child is entered2');
gr.u_related_changes = gr.u_related_changes + ',' + current.sys_id;
}
gr.update();
}
action.setRedirectURL(current);
current.update();
Hope this helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2017 10:02 PM
Hey Nathan, I have a similar requirement - to display a few field values from the related m2m table on one of the 2 m2m tables. Any idea on how to do that ? I have written this below BR on that m2m table and 'Incident' & 'Train Delay' are the 2 tables that are related via many to many.
This script isn't working....:(
(function executeRule(current, previous /*null when async*/) {
var gr1 = new GlideRecord('u_train_delay');
gr1.addQuery('sys_id',current.u_train_delay);
gr1.query();
if(gr1.next()) {
var inc = new GlideRecord('incident');
inc.addQuery('sys_id',current.u_incident);
inc.query();
if (inc.next()) {
//var state = current.state.getDisplayValue();
//var group = current.assignment_group.getDisplayValue();
gr1.u_incident_state = inc.state.getDisplayValue();
gr1.u_incident_assignment_group = inc.assignment_group.getDisplayValue();
}
}
})(current, previous);