Creating a custom calculation

New Here ,
Jul 25, 2022 Jul 25, 2022

Copy link to clipboard

Copied

Hello Everybody,

 

Trying to create a custom calculation to where i can enter a date (contract Date Box), and the 2 boxes i want (minor Inspection, Major inspection) to automatically fill in will add 6months (minor Inspection) and 12months (major Inspection) from the date that was entered (contract Date). Here is a picture if i cant explain well.

 

Screenshot 2022-07-25 143416.jpg

TOPICS
JavaScript

Views

18

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
community guidelines
Adobe Community Professional ,
Jul 25, 2022 Jul 25, 2022

Copy link to clipboard

Copied

LATEST

Use this as 'validation' script of "Contract Date" field and change if needed "mm/dd/yyyy" to the date format you use:

var days = util.scand("mm/dd/yyyy", event.value)
if(event.value == ""){
this.getField("Minor Inspection").value = "";
this.getField("Major Inspection").value = "";}
else{
var month = util.scand("mm/dd/yyyy", event.value)
month.setMonth(month.getMonth() +6);
this.getField("Minor Inspection").value = util.printd("mm/dd/yyyy", month);
var year = util.scand("mm/dd/yyyy", event.value)
year.setFullYear(year.getFullYear() +1);
this.getField("Major Inspection").value = util.printd("mm/dd/yyyy", year);}

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