Enable/disable button conditionally
I have a requirement to create se of activities when a new lead record is created. I have achieved this requirement using workflow. Now the next part of the requirement is, based on the status and substatus of the Activity I have to enable and disable buttons on Lead record type. If all the activities are in Completed status with substatus as "Pass" then only "Mark as qualified" and "Convert" button should be enabled else it should be disabled. If any of the activity substatus is "Failed", "Reject" button should be enabled, else it should be disabled. I have written a JavaScript code to implement this requirement, but issue is if I change the status or substatus of the activity, I have to refresh the page manually to enable /disable buttons. I also tried with Windows.location.reload(); but as soon as I write this statement in script,