How to Save Record ID as a Field Value (View-Based)

Hi @LeighBerre96926

I’m not a coder but have the below JavaScript snippet in my library. If you set the form to just show a confirmation message it will then close on submit. Just change the view to your form that is being submitted.

Might work :thinking:

$(document).on('knack-form-submit.view_XXX',
function (event, view, record) {
Knack.closeModal()
})

Hi @LeighBerre96926

I noticed that you use KTL have you looked into @NormandDefayette_CortexRD _recid?

Craig

Craig, I owe you a beer. I didnt see this keyword (its actually _recid) in the KTL list. Works brillaintly and allows me to dump a bunch of javascript etc. Thanks for the heads up. And thanks to Norm for the KTL library, yet another great use for me.

2 Likes

Wow, this is great! I was told that many people would certainly love this keyword, but I wasn’t too sure.

Glad you like the KTL, and I bet you haven’t even scratched the surface of all what it can do. Especially when you start to combine various elements to create meta-features.

Cheers,
Norm

Thanks Carl, I came up with something similar from my library of stolen snippets, and that worked, but I’ve stripped out the lot and using the KTL library to achieve the same outcome, only easier.

@RobertHill this is amazing! This code is awesome and saved me a significant amount of time. I would add for those that may be attempting to use this that when the new function is called it should be:

save_Record_ID(record.id, scene_number & “/views/” & view_number, field_number);

whereas is your original post it is:

save_Record_Id(record.id, scene_number & “/views/” & view_number, field_number);

since in your function definition ID is all caps. Just thought I would share to save someone a few minutes of debugging. Thanks again!