How to access previous record object in onsubmit client script?

Narayana Swamy
Tera Contributor

after form loads when user selects onhold and submit form the current date populates in hold_start field and after that if he select other than on hold hold_end should populate with current date.to achieve this i need method which gives previous record object to check whether user selected onhold?

1 ACCEPTED SOLUTION

Brad Bowman
Kilo Patron
Kilo Patron

Following your sequence of events, it sounds like you need to know the previous state value.  You can easily do this with a before Update Business Rule (previous.state).  Since you want the date field to populate when the form is submitted the updated from the Business Rule will display whether it is a Save that stays on the current form, or Submit redirected elsewhere.  If this must be a client script for some reason, you'll need a Display Business Rule to capture the state value in a scratchpad variable when the form loads, then you can access the value of the same scratchpad variable onSubmit.

View solution in original post

1 REPLY 1

Brad Bowman
Kilo Patron
Kilo Patron

Following your sequence of events, it sounds like you need to know the previous state value.  You can easily do this with a before Update Business Rule (previous.state).  Since you want the date field to populate when the form is submitted the updated from the Business Rule will display whether it is a Save that stays on the current form, or Submit redirected elsewhere.  If this must be a client script for some reason, you'll need a Display Business Rule to capture the state value in a scratchpad variable when the form loads, then you can access the value of the same scratchpad variable onSubmit.