How to get backend variable into email

I’m new to wixCode and JS. Have the following in backend folder

 import wixData from 'wix-data';
export function Warranty_Claim_beforeInsert(item, context) {
 //TODO: write your code here...
    item.claimId = randomNumber(10);    
 return item;
    }
function randomNumber (len) {   
 var n = '';
 for(var count = 0; count < len; count++) {
        randomNumber = Math.floor(Math.random() * 10);
        n += randomNumber.toString();
        }
 return n;
    } 

Function writes to my dB but I’d also like to get the generated number value to included in a confirmation email. The rest of the email works fine, I’m just stuck on putting the generated randomNumber into the subject line as noted below.

function sendFormData() {
 const subject = `Warranty Claim #` randomNumber;
 const body = `Name: ${$w("#input1").value}
    \rEmail: ${$w("#input6").value}
    \rComments: ${$w("#datePicker1").value}`;
 const recipient = $w("#input6").value; 
 
  sendEmailWithRecipient(subject, body, recipient)
    .then(response => console.log(response));

    sendEmail(subject, body)
    .then(response => console.log(response));
}

What is the best way to do this?