Using filename as description in receipt hub

Hello,

I’m looking for a way to automatically populate the description field using the receipt filename when creating a purchase from the receipt hub:

Is there a way this can be done using a custom script for example?

Regards,

Richard

Hi Richard,

This should do the trick:

$(document).ready(function() {
    $('.page-receipts-detail #txtdescription').val($('#txtReceiptDesc').val());
});

Just add this to your custom scripts in Account Settings >> Design customisation >> Advanced CSS & HTML Customisation.

This will also pull in the file extension (.pdf in your example), but hopefully that’ll help speed up your entry! :slight_smile:

1 Like

And if you want to strip off the .pdf you could do something like this (not tested):

$(document).ready(function() {
    $('.page-receipts-detail #txtdescription').val(
      $('#txtReceiptDesc').val().replace(/\.[a-z]{1,4}$/, '')
    );
});

This code will strip off any trailing dot-plus-up-to-4-letters extension from the file name.

2 Likes

This topic was automatically closed after 7 days. New replies are no longer allowed.