populate date field based on another field value change

siva58
Tera Contributor

i have teo fields in the request form. 1. Approval

siva58_0-1666091185836.png

2. Approval date

siva58_1-1666091306615.png

if we change the Approval field value as Approved, Approval date field need to display the date. 

ex: if we change approval field value as approval today, approval date field need to display today date.

similar to we we change the approval field value  to approval  after 2 days,  approval date field need to display on that date.

1 ACCEPTED SOLUTION

Hey Siva,

 

The business rule solution is the quickest possible way to achieve the requirement.

In case you need it via client script, you can try using  the solution provided by SnowLearns below.

 

please mark my solution as helpful if it somehow helped you reach your solution or to enhance your understanding.

 

Thanks,

Shreya

View solution in original post

12 REPLIES 12

Swapnil Shirsik
Giga Guru

Hi siva,

You may write a before business rule with condition - when approval is approved, then in the set values or in script.. approval date : javascript: new GlideDateTime().getDate();

 

Please mark the answer as Helpful/Correct based on the impact.

Snow Learners
Kilo Guru

Hello Siva,

 

1.Create CLient callable Script Include which return current date example. getCurrnetDate().

1. Create an onChange client script on approval field and ad if condition is newVlaue == 'approved' then,

 Use GlideAjax api to call getCurrnetDate() function.

 

Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.

Snow Learners
Kilo Guru

Hello Siva,

 

1.Create Client callable Script Include with a function example. getCurrnetDate(). which return current date.

1. Create an onChange client script on approval field and add if condition if newVlaue == 'approved' then,

 Use GlideAjax api to call getCurrnetDate() function and set the approval date field.

 

Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.