'Dynamic Variables within Filepond Instance

I am attempting to have multiple uploads within the same Filepond instance in that a user will create a New Development, each development can have 1 or more Plans that need to be associated to the development. My problem is mainly Javascript related but I need the plantrn_id to be dynamic so that when a plan is saved, a new plan transaction id is associated to the new upload. At the moment, whatever #plantrnid is set to on pageload is what is passed but it needs to collect the new plantrnid on upload. My code looks like this currently :

var plantrn_id = $('#plantrnid').val();

 var pond5 = FilePond.create(document.querySelector('input.filepond5'), {
        filePosterMaxHeight: 256,
        fileMetadataObject: {
            transactionid: transaction_id,
            plantrnid: plantrn_id,
            upload_type: 'development_planimage'
        },


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source