- 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-08-2018 10:17 PM
Hi
The script loooks good, I think this is happening because of update checkbox. Pl try to debug it.
- 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-08-2018 10:39 PM
Hi,
Change the When to run condition to After insert or update and try.
Thanks,
Ravi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2018 12:03 AM
Hi Walshy,
Uncheck the insert checkbox, use only update option and which will fix the issue.
Thanks,
Manoj.