Custom Adobe Script Not Working
Copy link to clipboard
Copied
Hi, this is the first time that I have attempted to write a custom java script and something isn't working right.
I need to calculate one filed * 600, and this is what I have so far: event.value = Number(this.getField("# of Wells").value*600).value;
Data is not showing up and I'm not sure if my script is even working.
Also I have another field that isn't working. There is no data and I'm not sure if the script is working: I need the different from "Total New..." and "Previous...": var nDiff = this.getField("Total New Annual Rental").value=this.getField("PreviousRental").value-("PreviousRental");
Any assistance you can provide would be greatly appreciated.
Copy link to clipboard
Copied
1. Use this:
event.value = Number(this.getField("# of Wells").value)*600;
2. Use this:
event.value = Number(this.getField("Total New Annual Rental").value)-Number(this.getField("PreviousRental").value);
Edited: Your field names were not clear in #2... I hope I got it right.
Copy link to clipboard
Copied
Thank you, but for some reason the field is still blank:
I also had another example of an issue. I think you did ask about my field names, they are "# of wells" and the output is "Additional Well Payment"
Copy link to clipboard
Copied
JS is case-sensitive, so if the field is called "# of wells" it must appear like that in the code, not as "# of Wells"... An error message saying getField returned null should have appeared in the JS Console. Did you check it?
Copy link to clipboard
Copied
Thank you!! Everything is working now.
Copy link to clipboard
Copied
I spoke too soon. I'm in a bit of circular reference scenario...in my field for "Additional Well Payment", I need it to calculate as a total in another field, and I just used the simple "value is the sum" and picked the fields. The issue is that "Additional Well Payment" is calculating if there is a value in the "# of wells" field, if I delete the value, then amount calculates and additional well payment goes to 0. I attached the document to make it easier.
Copy link to clipboard
Copied
You need to fix the fields calculation order.
Copy link to clipboard
Copied
Thank you! When I used the automatic "pick" feature, it alphabatizes it. I did a custom and it worked!
You rock! I've never written java before, and with a lot of googling and your help, I feel confident now!

