Using business rules to switch on / off actions on records

Peter Klören 7 years ago in ADAM Core updated by anonymous 4 years ago 0

I would like to have the option to configure a code reference to be checked (like a validation) to switch on or of buttons in the searchresults (or maybe everywhere).

This validation should be possible on both the ActionGroup level as on the Action level.

Example (extract from .assetStudioSearchRecordActions):

<add type="Adam.Web.Extensions.Providers.Actions.ActionGroup, Adam.Web.Extensions">
<add type="Adam.Web.AssetStudio.Actions.EditRecord, Adam.Web.AssetStudio"

        visibilityCheck="Custom.Core.CodeReferences.EnableEditRecord, Custom.Core" />


UX configurability


I don't know if you have tried the following, but I think it is possible to create your own ActionGroup that enables this behavior (I haven't tested this):

  • Inherit Adam.Web.Extensions.Providrs.Actions.ActionGroup
  • Add a property called VisibilityCheck of type string
  • Override IsSupported and return false if the your VisibilityCheck returns false
  • Adjust your xml to include the visibilityCheck attribute and the name of your newly created type.
  • done

For EditRecord you could do the same:

  • inherit EditRecord and add a VisibilityCheck property
  • override CanEditItem and call the class in the VisibilityCheck property
  • done

Only problem here is the amount of work. You would have to repeat this for every action you want the VisibilityCheck behavior on.

Hope this helps,

Nik De Clercq