Hiding / Disabling Edit (pencil icon) in Grid form programmatically per record

Hi,

I’ve been looking for a way to programmatically hide or disable the “pencil” icon in a grid application based on conditions per record. There have been lots of topics similar to this but they don’t specifically solve this particular issue.

I wasn’t able to find a solution for this out of the box. Does anyone know how to do this?

Instead, I’m having to use a bespoke solution.

  1. Using the new Action bar feature I’m creating a link button with the “pencil” icon
  2. I delete the original Application Edit Link
  3. In the onRecord event of the grid I use the following code (a simple example)
if ({Id} == 1){
sc_actionbar_disable("edit_me");
}
else{
sc_actionbar_enable("edit_me");	
}

Where edit_me is my new Action bar button.

A word of warning, if you don’t call sc_actionbar_enable/disable per record it uses the last state.

If there isn’t a “standard” way of achieving this, I hope this solution helps others.

Arthur