Create a receipt number in the form and store the data | Community
Skip to main content
New Participant
January 20, 2023
Solved

Create a receipt number in the form and store the data

  • January 20, 2023
  • 2 replies
  • 2849 views

Hello,


I want to create an application/reception form for a certain service and record the reception number as a history.
If the same person applies multiple times, I want to leave the number without overwriting.
I plan to use LocalForm for now.

 

1) What kind of data should be used for the reception number? (Campaign ID + UserID or something?)

2) I would like to store the receipt number without overwriting it, but I am concerned that it will be overwritten if I use a custom field.

 

I would appreciate it if you could tell me the best method.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

1) What kind of data should be used for the reception number? (Campaign ID + UserID or something?)

I would appreciate it if you could tell me the best method.


There's no one "best" answer to that question.

 

Is Campaign ID + Marketo Person ID (not "user" ID) a unique enough identifier for your business?

 

A given lead doesn't necessarily have the same ID over time, due to merges. So you might end up with value "1234-56789" on a person whose ID is currently 56790 (having been merged w/56789 at some point). But that also means 56789 is gone from the system and, within reason, will not be reused. So it's probably acceptable for this specific, non-cryptographic use case.

 

However, you can't use the {{campaign.id}} token from JS unless you're on a Marketo LP. So this isn't very scalable. Since browsers are good at creating random numbers, you might as well gen it on the fly:

 

{ const formReceiptNumber = new Date().getTime() + "-" + crypto.getRandomValues(new Uint32Array(1))[0].toString() MktoForms2.whenReady(function(mktoForm){ mktoForm.addHiddenFields({ formReceiptNumber: formReceiptNumber }); }); }

 

 

 


2) I would like to store the receipt number without overwriting it, but I am concerned that it will be overwritten if I use a custom field.

This is not a concern. In Field Management, block updates from form fillouts. Note this isn't any different with standard vs. custom fields.

2 replies

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
January 20, 2023

1) What kind of data should be used for the reception number? (Campaign ID + UserID or something?)

I would appreciate it if you could tell me the best method.


There's no one "best" answer to that question.

 

Is Campaign ID + Marketo Person ID (not "user" ID) a unique enough identifier for your business?

 

A given lead doesn't necessarily have the same ID over time, due to merges. So you might end up with value "1234-56789" on a person whose ID is currently 56790 (having been merged w/56789 at some point). But that also means 56789 is gone from the system and, within reason, will not be reused. So it's probably acceptable for this specific, non-cryptographic use case.

 

However, you can't use the {{campaign.id}} token from JS unless you're on a Marketo LP. So this isn't very scalable. Since browsers are good at creating random numbers, you might as well gen it on the fly:

 

{ const formReceiptNumber = new Date().getTime() + "-" + crypto.getRandomValues(new Uint32Array(1))[0].toString() MktoForms2.whenReady(function(mktoForm){ mktoForm.addHiddenFields({ formReceiptNumber: formReceiptNumber }); }); }

 

 

 


2) I would like to store the receipt number without overwriting it, but I am concerned that it will be overwritten if I use a custom field.

This is not a concern. In Field Management, block updates from form fillouts. Note this isn't any different with standard vs. custom fields.

KyokoAuthor
New Participant
January 25, 2023

Thank you for your comment.
I'm sorry to reply late.

 

How to create ID, it was helpful, thank you. As you said, it seems that you need to be careful when merging occurs. I'm thinking of trying to create a unique receipt number by using the date method.
The problem has not been solved yet where to store it or overwritten.

Please continue to ask me questions.

Thank you.

Darshil_Shah1
Community Manager
January 20, 2023

@kyoko wrote:

Hello,

 

1) What kind of data should be used for the reception number? (Campaign ID + UserID or something?)


When you say campaign id, do you mean the Marketo program id or the smart campaign id? With the very limited knowledge of your setup and use case, I'd incline towards using the Marketo program id + lead id as the reception number as the program id is unique for each program and the lead id is unique for all the leads. You could also use the Marketo smart campaign id, but I think program id might make more sense here unless you want to factor in unique ids of multiple smart campaigns in a single program.  Instead of marketo defined program/campaign ids, you could use a self-defined ID for each tactic also.

 

Again, this could change if there are more details to this use case that aren't listed in the question.

 


2) I would like to store the receipt number without overwriting it, but I am concerned that it will be overwritten if I use a custom field.

 

I would appreciate it if you could tell me the best method.


For ensuring the data isn't updated in the custom field, you could easily block the field updates for that respective field from the field management section in Marketo Admin.

 

KyokoAuthor
New Participant
January 24, 2023

Thank you for your reply.

I meant the program ID. As you said, I will try to make it with program ID and lead ID.

 

Also, I made a mistake, but I was worried that it would be overwritten by PMCF instead of custom fields.
I think it's a good idea to prevent overwriting with Admin privileges, but my company doesn't allow that control, so I can't.

Thanks for the idea.

SanfordWhiteman
New Participant
January 24, 2023

Well, whether PMCF or Person field, it can be overwritten if you let that happen.

 

I must say it's disturbing that your company is charging you with this project but won't change the Block Updates setting as necessary.