Need help capturing previous value in onSubmit client script

Ryan L1
Mega Contributor

Hey everyone,

I'm a noob and i need help capturing and old value in the comments section onSubmit on a change request table.

Here's what i got,

find_real_file.pngWhen i put a '.value' after prev_val, I get an error, and when i run it like this, I get a prev_val as 'undefined' in the comments section after submission. Can anyone point me in the right direction?

 

thanks for your time

1 ACCEPTED SOLUTION

Ryan L1
Mega Contributor

Thanks for the quick reply, and no there is no particular reason why I'm trying to accomplish this with a client script rather than a business rule, other than that I'm inexperienced at writing business rules. I want to try what you suggested, but how should I go about doing it?

View solution in original post

4 REPLIES 4

Elijah Aromola
Mega Sage

Is there a specific reason you're doing this on the client? You'd have access to the previous and current value in a business rule. Also, you can show field changes in the activity log. 

Ryan L1
Mega Contributor

Thanks for the quick reply, and no there is no particular reason why I'm trying to accomplish this with a client script rather than a business rule, other than that I'm inexperienced at writing business rules. I want to try what you suggested, but how should I go about doing it?

Write an "before" business rule that runs on insert/update for that table. Then just get the previous.field_name and current.field_name and put them in the work notes.

Ryan L1
Mega Contributor

Thanks so much for your guidance