Deleting Record After Creation

steph3
Tera Contributor

I am developing a scoped app that utilizes a record producer to collect information. On the record producer I am utilizing a script that generates multiple records after it is submitted. Since I am using the script to generate the records I do not actually need the record that the record producer creates.I had added to my script to have it be deleted after it was submitted and it works fine but I was wondering if this would not be a good practice. Also, I am seeing an error in the logs "no thrown error" but the record is still being deleted. Any thoughts? Thank you!

1 ACCEPTED SOLUTION

Jim Coyne
Kilo Patron

You can stop the Record Producer from creating it's own record by using "current.setAbortAction(true);" in your script.



Take a look at this great post - Use a Record Producer to NOT CREATE A RECORD.   It's old now, but still valid.


View solution in original post

4 REPLIES 4

Jim Coyne
Kilo Patron

You can stop the Record Producer from creating it's own record by using "current.setAbortAction(true);" in your script.



Take a look at this great post - Use a Record Producer to NOT CREATE A RECORD.   It's old now, but still valid.


steph3
Tera Contributor

That is a great post! I am not sure how I missed that when searching but that will do exactly what I need. Thank you so much!


Chuck Tomasi
Tera Patron

Hi Stephanie,



Why delete the record? Why not keep it around as a... record? There's no harm in having a lot of requests that were made with the original request. You don't have to SHOW it to anyone. You can use the producer.redirect() option to take the person to another page/location after the record is created.



I say KEEP IT!


Thank you so much for your reply Chuck! I definitely see your point and I considered it. However, it would work better for our purposes if we didn't have the extra record. So I am team 'GET RID OF IT'