- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2018 10:12 PM
Ok so I have a business rule that does what it should, it creates a new song record in a 'set list' table.
However the rule then generates a duplicate in the 'songs list', so I have 2 of the same song in the 'songs list' table.
So below is the 'when to run'
And here is the script. I was thinking it was because of insert being ticked, but I thought that was if a record was inserted on the table, not insert a new record when this rule is run.
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord("x_120100_band_set_lists");
gr.initialize();
gr.u_song_title=current.u_song_title; //Song Title
gr.u_lead_vocals=current.u_lead_vocals; //Lead vocals
gr.u_kylie_key=current.u_kylie_key; //Our key
gr.u_genre=current.u_genre; //Song Genre
gr.u_original_artist=current.u_original_artist; //Original artist
gr.insert();
})(current, previous);
I figure this is pretty simple, Im just being a bit of a nong and missing something.
It shouldn't add a new record to the 'song list' table just to the 'set list'
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2018 04:24 PM
Hi Nikhil,
You were right, the issue wasn't the script.
The issue was me extending the songs table to create the set list table.
I created new set list tables and the duplication is gone.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2018 12:47 AM
Hi walshy,
Try this :- Write Before - insert Business Rule & Use current.setAbortAction(true); in your code
Please mark it Correct or Helpful, if it works based on impact....!!!!
Warm Regards,
Priyanka
www.dxsherpa.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2018 02:24 AM
Thanks for all the suggestions.
I think I have screwed up with the table set up.
I extended the 'songs list' table when I created the 'set lists' table to avoid making the tables again. I think every time I add to the set list table, it is adding another song to the songs list due to the extension?
Or am I just making stuff up?