In version 13, one of the new features was "conditional visibility", or "Hide Object When…". It allows you to specify conditions where a layout object is invisible to the user. It is still there in all subsequent versions.
In Layout mode, in the Inspector's Data tab, under Behaviour, the first item is "Hide object when". Create a calculation that evaluates to 1 (true) for the condition that determines when you want the button to be hidden.
<table>::<statusField> ≠ "Active"
Obviously, the <table> and <statusField> would be replaced with the actual table occurrence name and field name. You can click the pencil icon next to the "Hide object when" field to enter the calculation editor window.
-- Edited to update version info.
Is there a way to find out if just the record is active and not a specific field? All the fields are locked in this layout, it is a schedule layout. The button will mark that the task as complete and take it off the schedule.
The key to your question is the meaning of "the record is active". What field value or values need to be checked to determine whether "the record is active"?
My example calculation assumed there was a "statusField" in the record that records the current status. The field or fields referenced in the Hide calculation do not need to be on the list layout. They just need to be accessible via the layout's Table Occurrence.
From your reply, I gather that once the record is marked as complete, the button should disappear. So then, what does the button do to make the task "complete"? You then incorporate a check for that in the calculation. If the "completed" tasks in the Tasks table have a field called "Status" that contains "Complete", then the Hide calculation would be:
Tasks::Status = "Complete"
If the button does something different, then the test should reflect what it does.
Get ( RecordID )
returns the internal ID of the current record.
So you can use OnRecordLoad to perform this script:
Set Variable [ $$CurrentRecord ; Value: Get ( RecordID ) ]
Refresh Object ["ButtonObjectNameHere"]
Your button would be given this Hide Object When expression:
$$CurrentRecord <> Get ( RecordID )
Thanks! This worked perfect