AnsweredAssumed Answered

Need help with a puzzling problem

Question asked by jdevans on Dec 11, 2015
Latest reply on Dec 11, 2015 by BillisSaved

I may have designed myself into a corner on this, but I'll try as best I can to describe the problem.

 

I have a list view layout based on a TO called Accounts. I'm using this Layout to allow users to enter time (in hours) for themselves in a time-card system at work.

Each "row" on account records in this list view has 7 fields spread across from L to R, one for each day of the week. These fields are for entering in hour for any account the user spends time on. These are dumped into a second related table called Hours. It stores each Hours charge including the hours they worked, the account worked, the person who worked, and the date.

 

I have a drop down menu at the top of the layout where the user can select their name from the list of employees, so they can enter time for themselves.

 

The problem I'm facing is, I have button at the top of the layout for "approving and locking" the records, once the employee has determined that they are finished entering in their time for the week.

 

1)  I want to only show this Approve/Lock button only to the person (via privilege set) who can do approvals, and

2) I want to display replace that button with a do-nothing button/label that says "Approved" once it has been clicked.

3) Also need the Approver person to be able to select each employee from the dropdown list, and approve for all employees who have completed their time for the week.

4) I need the buttons to re-appear based on if an employee is selected from the dropdown who hasn't completed their time yet.

 

I have a successful script that runs whens the Approve/Lock button is pressed. It loops thru the Hours records n a found set (this employee, this week), and sets two fields: 1) an "is_locked" to 1, and 2) "is_approved" to the user account and timestamp.

 

I haven't been able to figure out a way to hid the Approve/Lock button and show the do-nothing button when conditions are right. Basically,I haven't figured out how to establish the conditions in the first place.

Outcomes