I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
No.1:
You need to use all four function parameters.
You are not using records at all.
You are not supposed to use recordCollection but instead you have to use records.
You need to replace all of the recordCollections in your code with records.
No.2:
You have errors in the following areas.
You are not supposed to use dots and brackets.
Just use the brackets.