Javascript to render a field based on picklist old & new value

I am looking for a javascript to render a field based on picklist field vales (mainly old & new picklist values)

I am aware of standard way of conditional rendering but my requirement bit different, we have a picklist field 'Status' with 'Active'& 'Inactive' status & other field 'Deactivation' which is a text field and should be render based on 'status' value (Status= Inactive) this can be done in usual rendering condition but in my case whenever a new record creates the default status will be "Inactive" after several approval (flow is like 'Inactive' ->'Rejection'->inactive (when resubmit)-> 'Active')status will updated to 'Active'.

As per the requirement, 'Deactivation' field should be shown on page when 'Status'=Inactive, with the regular rendering condition 'Deactivation' field is showing all the time on detail page as per the condition, I want to check the status field old value as 'Active' and new value as 'Inactive' then only render my 'Deactivation' field.

Both field's (Status & Deactivation) are in same model


Hi Kailas,

If you haven’t already done so, I would recommend experimenting with other render conditions like model properties or row properties. With the right combination of conditions and field values, you may not need any scripting for this. 
Some options to try:

  • “Has data rows”
  • “Is new record”
  • "Has unsaved changes"
If the records in question are not new, you might try adding a render condition where the row “Is new record” is false, and pair it with “Has unsaved changes.” You can also check for field values, as you’ve described, so I’d hope that combining a few of these options could get you where you need.

Hi Mark,

Thanks for your suggestion, as you said we added one more picklist field in the condition which solved my requirement.