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

Shreya Kaushik1
Mega Guru

Hi Siva,

 

You can put a condition using a Business Rule wherein as soon as the state ChangesTo Approved, the Approval Date is updated by today's date or the date when the state changes which you can get using gs.now() or if it's a date/time type field; it can be fetched using gs.nowDateTime().

 

NOTE: gs.nowDateTime() function is not available in scoped applications.

 

Thanks,

Shreya

@Shreya Kaushik1  it is only date type field. 

could you please help me with the script 

Hi Siva,

 

I have tried replicating your scenario with incident table, as below:

 

Created a Before Update BR with condition State Changes to In progress (you can customize the conditions based on your state field and value)

 

ShreyaKaushik1_0-1666100212880.png

 

In the Actions tab on the Business Rule, configure as below:

 

ShreyaKaushik1_1-1666100449362.png

 

The results were something like this:

 

ShreyaKaushik1_2-1666100616507.png

 

 

Please let me know if you face any challenges.

Please mark the answer helpful if it solves your purpose.

 

Thanks,

Shreya

 

thanks for help. @Shreya Kaushik1 

could you please elaborate how you have written gavascript:gs.now();