SOLVED

Create a receipt number in the form and store the data

Go to solution
Kyoko
Level 2

Create a receipt number in the form and store the data

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.

2 ACCEPTED SOLUTIONS

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Create a receipt number in the form and store the data


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.

View solution in original post

Darshil_Shah1
Level 10 - Community Advisor

Re: Create a receipt number in the form and store the data

I honestly think that you should try getting some approvals to set up the field blocks on this field (as that's what it's built for and should be used instead of going all the way around to accomplish the same thing). You could store data in an auxiliary field and overwrite the original field's data with it upon any update on it (original field), but that'd need you have set up trigger campaigns, and there's no guarantee that someone wouldn't update your aux. field data (just like they could do it for the original field) - you see, how we're moving in circles with this! Alternatively, you could store all the non-empty data in a protected space such that no system could update it (aka outsourcing the data update blocks to an external system) and use it to restore your original field's data in case it gets updated (but again, why go through such troubles when there's the field block functionality available in Marketo)?

 

View solution in original post

7 REPLIES 7
Darshil_Shah1
Level 10 - Community Advisor

Re: Create a receipt number in the form and store the data


@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.

 

Kyoko
Level 2

Re: Create a receipt number in the form and store the data

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
Level 10 - Community Moderator

Re: Create a receipt number in the form and store the data

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.

Kyoko
Level 2

Re: Create a receipt number in the form and store the data

Thank you for your comment.

As you said, overwriting can happen. I'll try to find something else.
For example, writing out only the receipt number with JS and accumulating it somewhere...

Please continue to ask me questions.

Thank you

Darshil_Shah1
Level 10 - Community Advisor

Re: Create a receipt number in the form and store the data

I honestly think that you should try getting some approvals to set up the field blocks on this field (as that's what it's built for and should be used instead of going all the way around to accomplish the same thing). You could store data in an auxiliary field and overwrite the original field's data with it upon any update on it (original field), but that'd need you have set up trigger campaigns, and there's no guarantee that someone wouldn't update your aux. field data (just like they could do it for the original field) - you see, how we're moving in circles with this! Alternatively, you could store all the non-empty data in a protected space such that no system could update it (aka outsourcing the data update blocks to an external system) and use it to restore your original field's data in case it gets updated (but again, why go through such troubles when there's the field block functionality available in Marketo)?

 

SanfordWhiteman
Level 10 - Community Moderator

Re: Create a receipt number in the form and store the data


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.

Kyoko
Level 2

Re: Create a receipt number in the form and store the data

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.