Trying to understand Hook System

I’m going through the documentation for implementing a hook and I cannot get it to work. I’m trying to run some custom code in the Third Pary card when loaded. In the documentation, there is a lot of help when creating a new hook, but I want to access an existing hook. When I search the code, I see:


and a little later down, I see:


So, I’m trying to add a "doActions function. Where do I put the file, what do I name it and what do I name the class?


You need to create a module :

I guess I’m confused because Triggers can be added without modules and I expected the same for hooks. It seems like a lot of work just to check a value and overwrite if necessary.

I’ve been playing around with this all day and I believe I understand now how this works. I have some functions that get executed at various spots in the code and it’s working as expected. Most of what I am trying to do is hide unnecessary fields. I tried a couple of methods, but I’m wondering if there is a simpler way and I’m missing something. For example, I created a function “printCommonFooter” that checks the current context and then hides the fields. Like this:

print '<script type="text/javascript" language="javascript">document.getElementById("options_iqa_level").hidden = true;</script>';

This works fine when I want to always display the field, but only allow admins to edit. However, when I always want to remove a field, I’m not sure how to do. When displaying the form, I thought I might be able to use the $object variable and just set the “visible” attribute to “0”. That way, it doesn’t show up in the view, modify or create actions. Can someone recommend the best way to “hide” unwanted fields?

Hi badkneecap,

Could you give a more detailed example of what you want to achieve ? This would help giving a relevant answer. There some hooks for some forms but not all, and not necessarily a “visible” attribute…

Furthermore, you may be interested in if you want to reshape the related forms.


Sorry, I thought it was clear. Again, I’m just trying to hide a field. For example, in the “Third Party” card, there are 6 fields, Professional ID 1, Professional ID 2, etc. I don’t want to show them. I have other forms where I have fields I don’t want to show. I figure I could use the hook system to run my own code to hide. I listed some code above that I have successfully used to hide an input field, but it doesn’t help when just viewing a field. I was going to look into the canvas development, but it seemed like a lot of work just to hide some fields and was hoping to find a simpler solution. The simplest solution is to comment out the code that displays it, but I’m trying not to update core code.


You can download MyField for that :

Can you please show me where we should comment out to hide Prof ID 1 to 5.? Thanks

Go to Setup/PDF/Parameters

My initial problem is that I want to be able to allow specific users to modify a field, but everyone else can view. I have MyField and it works most of the time but not in this situation. Yes, I can configure it so only specific authorized users can edit, but when an unauthorized user modifies the data, it doesn’t save that field and data is lost. For example, user 1 has access to edit “testfield” and user 2 does not. User 1 modifies and sets the field to “1”. Then user 2 comes along and modifies other data on the form, but doesn’t change the data in “testfield” because they don’t have access. When the user saves their other changes, the data in “testfield” is lost. Maybe they fixed, but I’m on v10.