• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Field Update Based on Checkbox

New Here ,
Aug 23, 2024 Aug 23, 2024

Copy link to clipboard

Copied

Hello,

 

I have a requirement to fulfill in Adobe forms:

I already have a checkbox that is checked based on an Export Value that I have set and that value comes from Salesforce. The requirement is to fill another text field if that checkbox is checked. The problem is that when I do this the only value that comes is "Off" or ""(empty string). The good thing is that the checkbox is checked if the value that comes from Salesforce is true - so the checkbox is working. The problem is only for the text field which has the following javascript:

if (this.getField("CheckBox").isBoxChecked(0))
{event.value = "Test";}
else {event.value = "";}

 

Also if I try to not use the value from the Adobe Form Checkbox and instead use the value from Salesforce(that helps to check the checkbox), still it is not working:

if (this.getField("Field From Salesforce").value == True)
{event.value = "Test";}
else {event.value = "";}

TOPICS
Create PDFs , Edit and convert PDFs , JavaScript , PDF , PDF forms

Views

166

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
community guidelines
Explorer ,
Aug 23, 2024 Aug 23, 2024

Copy link to clipboard

Copied

To fill a text field based on whether a checkbox is checked in Adobe forms, use this Javascript: `if (this.getField("CheckBox").isBoxChecked(0)) { event.value = "Test"; } else { event.value = ""; }`. If you're using a value directly from Salesforce, ensure it's correctly interpreted as `true` or `false`, possibly by checking if the Salesforce value is a string like `"true"` or `"false"`.

Votes

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
community guidelines
New Here ,
Aug 23, 2024 Aug 23, 2024

Copy link to clipboard

Copied

To fill a text field based on whether a checkbox is checked in Adobe forms, use this Javascript: `if (this.getField("CheckBox").isBoxChecked(0)) { event.value = "Test"; } else { event.value = ""; }`. If you're using a value directly from Salesforce, ensure it's correctly interpreted as `true` or `false`, possibly by checking if the Salesforce value is a string like `"true"` or `"false"`.

Votes

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
community guidelines
Community Expert ,
Aug 23, 2024 Aug 23, 2024

Copy link to clipboard

Copied

Your first script should work, where did you place the script?

Check console for errors.

Votes

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
community guidelines
New Here ,
Aug 23, 2024 Aug 23, 2024

Copy link to clipboard

Copied

I forgot to mention that we use Conga Composer to make the relation between Salesforce and Adobe. Also, how to check for console errors? I just get a generated pdf with my mappings in it.

Votes

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
community guidelines
Community Expert ,
Aug 23, 2024 Aug 23, 2024

Copy link to clipboard

Copied

In Acrobat, make sure console is enabled in preferences, then you can press CTRL+J to open console, also if you can post your file so we can take a look and see if it's an issue with the script or problem is somewhere else.

Votes

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
community guidelines
Enthusiast ,
Aug 23, 2024 Aug 23, 2024

Copy link to clipboard

Copied

In your 2nd script, is the name of the field "Field From Salesforce" or "CheckBox" as in your first script?  Are you sure the value is True and not true (lower case t)?   If it is True it should be in quotes ("True").  In your first script, is there only one widget of the CheckBox field?  The 0 in brackets is for the first widget.  

Votes

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
community guidelines
Enthusiast ,
Aug 23, 2024 Aug 23, 2024

Copy link to clipboard

Copied

Doesn't make much sense to use !="Off" if there are multiple checkboxes, if there aren't checkThisBox is fine.

Votes

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
community guidelines
Enthusiast ,
Aug 23, 2024 Aug 23, 2024

Copy link to clipboard

Copied

LATEST

Correct.

Votes

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
community guidelines