Auto reference numbers on the calculator

i would like to get an addition to actions that does refernce numbers for all communications, and stores that into google sheets or any database store. I am thinking along the lines of the calculator being used to issue reference numbers to clients who provide their email in the actions section of the calculator.
Please accept this challenge as soon as possible.

2 Likes

Hi there, @Tayeb :waving_hand:

Could you please specify the name of the Calculator widget, where you’d like to implement it? I’ll be happy to look into this for you :slightly_smiling_face:

1 Like

Hi @max , thanks for quick reply..
The calculator in question is the called “Loans Calculator”
please let me know , I just want to do customer reference numbers

2 Likes

Hi there, @Tayeb :waving_hand:

Thank you so much for sharing the widget name!

If I got it right, you’d like to have an automatically generated query number for each submission. If so, here is a custom solution:

Add the Hidden field to your Calculator form


Copy the ID of the Hidden field and add it to the Subject field in the Notify Me section

The ID of the field depends on your field label:


Adding the code to the Custom JS field on the Settings tab of your widget's settings
function formatDateTime() {
  const now = new Date();

  const day = String(now.getDate()).padStart(2, '0');
  const month = String(now.getMonth() + 1).padStart(2, '0');
  const year = String(now.getFullYear()).slice(-2);
  const minutes = String(now.getMinutes()).padStart(2, '0');
  const seconds = String(now.getSeconds()).padStart(2, '0');

  return `[${day}${month}${year}${minutes}${seconds}]`;
}

const date = formatDateTime();
widget.submissionForm.setFieldValue('[ticket-number]', date);

Replace ticket-number in the last line of the code with the actual ID of your Hidden field


Give it a try and let me know if it worked for you :wink:

2 Likes