5 Replies Latest reply on Jul 11, 2017 8:13 AM by keithstehlik

    Hide button in list when record not active

    keithstehlik

      I have a list layout that has a button on it. I want to hide this button when that record is not active. I have found ways to do this with a portal row but not in a list view. I'm sure this is something simple.

        • 1. Re: Hide button in list when record not active
          robwoof

          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.

           

          For example:

          <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.

           

          Cheers,
          Rob

           

          -- Edited to update version info.

          • 2. Re: Hide button in list when record not active
            keithstehlik

            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.

            • 3. Re: Hide button in list when record not active
              robwoof

              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.

              • 4. Re: Hide button in list when record not active
                philmodjunk

                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 )

                • 5. Re: Hide button in list when record not active
                  keithstehlik

                  Thanks! This worked perfect