How to Hide or Disabled Custom Action Button in Opportunity Module

Hello Everyone, I would like to ask if it is possible to hide/show this Print as PDF depends on the status? For example if the status is Pending this “Print as PDF” will be hidden if Completed the button will display.

image

Here`s my opportunity PDF Print Code in detailview vardefs:

I was able to figure it out, I just added this code below in detailviewdefs.

{if $fields.connectivity.value != "NO"} <input type=button onclick="window.open(\'index.php?module=Opportunities&action=openPrintout&record={$bean->id}\', \'_blank\');" value="SAF Printout">{/if}

hey there ! And sorry to answer a 2 yo topic.

Im trying to do exactly this, but for the convert lead if the user is a specific role or not.
Hide the menu button if user is ROLE = A, else we display the menu button.

Tried a few things, including the {if} in the detailviewdef under custom but sadly it dont seem to work.

Does someone have an idea how to make this to work ?

I can give you a generic answer, but I don’t have time to dig in to the specific of this view…

The code you put in the customCode is Smarty syntax, and the variables available to it are the ones that were assigned form the calling code.

The obvious ones are in that array fields which reflects what is in the vardefs. But if you need something else, like a role, you can only get there if the code setting up the screen does an assign of that value for you. You could customize the view to add that, if it’s not already there.

1 Like

Hey pgr thanks for the answer,

Thats what I tried, in the (custom folder) view.detail.php :
$this->ss->assign(“DISABLE_CONVERT_ACTION”, true);

and then in the detailview im trying to if/else this var.

Sadly and I rly dont understand why for now, in suitecrm V8 the display() function in view.detail.php is not fired. I assume angular completely change the way of adding custom code to a module

Those views are set up differently in v8, so it won’t work to override those classes there.

The only thing that (I believe) works is adding the Smarty code in the vardefs, because v8 still pulls in that metadata.

But then if you’re working on v8 you have better mechanisms to use

1 Like