Highlighted

Adding identity name to dynamic stamp

New Here ,
Oct 22, 2020

Copy link to clipboard

Copied

I have created a stamp.  I have added the date through java script.  It works, but the identity name will not work with the code that I have.  I have had the person who made the code check it and it works for him, but not for me.  What am I doing wrong?

 

CODE:

if ((event.source.forReal)&&(event.source.stampName == "#AAN-ENG=MAIN"))
{
this.getField("Reviewer").value = identity.name;

 

Sandra

TOPICS
General troubleshooting, How to

Views

52

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Adding identity name to dynamic stamp

New Here ,
Oct 22, 2020

Copy link to clipboard

Copied

I have created a stamp.  I have added the date through java script.  It works, but the identity name will not work with the code that I have.  I have had the person who made the code check it and it works for him, but not for me.  What am I doing wrong?

 

CODE:

if ((event.source.forReal)&&(event.source.stampName == "#AAN-ENG=MAIN"))
{
this.getField("Reviewer").value = identity.name;

 

Sandra

TOPICS
General troubleshooting, How to

Views

53

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 22, 2020 0
Adobe Community Professional ,
Oct 22, 2020

Copy link to clipboard

Copied

For one thing, the code is missing the closing bracked, "}"

This is an error that will stop the code from working at all.

 

But also, the user must set the identity name. So it could be blank. To handle this situation, the built-in stamps use the "loginName" if the user hasn't filled out the identity parameters. Try this instead.

 

this.getField("Reviewer").value =  (identity.name && (identity.name != ""))?identity.name:identity.loginName;

 

And on another note. If this code is in the Calculation script on the "Reviewer" field, then do not use "this.getField". 

User this:

 

event.value =  (identity.name && (identity.name != ""))?identity.name:identity.loginName;

 

You can find out everything you ever wanted to know about scripting dynamic stamps here:

https://www.pdfscripting.com/public/All_About_PDF_Stamps.cfm

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 22, 2020 0
New Here ,
Oct 23, 2020

Copy link to clipboard

Copied

Thanks Thom.  It's still not working.  Identity name is filled out and here is the code that I used:

 

if ((event.source.forReal)&&(event.source.stampName == "#AAN-ENG=MAIN"))
{
event.value = (identity.name && (identity.name != ""))?identity.name:identity.loginName;
}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 23, 2020 0
Adobe Community Professional ,
Oct 23, 2020

Copy link to clipboard

Copied

Sounds like the "if" block may not be executing. Is the "#AAN-ENG=MAIN"stamp name correct. 

Maybe the name is "#AAN-ENG".  How did you check it?

Also, were any errors reported in the console window?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 23, 2020 0
New Here ,
Oct 23, 2020

Copy link to clipboard

Copied

Thanks for your help Thom!  

 

if ((event.source.forReal)&&(event.source.stampName == "#AAN-ENG"))
{
event.value = (identity.name && (identity.name != ""))?identity.name:identity.loginName;
}
SyntaxError: syntax error
1:Console:Exec
undefined

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 23, 2020 0
Adobe Community Professional ,
Oct 23, 2020

Copy link to clipboard

Copied

So this code will not run in the console because the "event" properties don't exist in this context. I meant, where there any errors reported in the console when the stamp was placed?

Also, have you verified the stamp name?

You'll find a video on how to find the stamp name here:

https://www.pdfscripting.com/public/Free_Videos.cfm#Stamps

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 23, 2020 0
New Here ,
Oct 23, 2020

Copy link to clipboard

Copied

Hi Thom - well, I think I found my issue. My original stamp has a template of #AAN-ENG, as noted in the page template section of "Organize Pages". When I open a blank page, create a stamp from #AAN-ENG, highlight the stamp and use the selectedAnnots[0].AP in the console, the template name is different.
[personal information deleted by moderator]

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 23, 2020 0
New Here ,
Oct 23, 2020

Copy link to clipboard

Copied

Hi Thom - well, I think I found my issue. My original stamp has a template of #AAN-ENG, as noted in the page template section of "Organize Pages". When I open a blank page, create a stamp from #AAN-ENG, highlight the stamp and use the selectedAnnots[0].AP in the console, the template name is different.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 23, 2020 0
Adobe Community Professional ,
Oct 23, 2020

Copy link to clipboard

Copied

Excellent News!! So how was it different? Did the template name change? or is there something else going on?

 

Also, it looks like your post got duplicated. The first one contains contact info. I would suggest editing that post to remove that information. 

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 23, 2020 0