This is from custom/Extension/modules/Cases/Ext/Layoutdefs/aos_products_cases_1_Cases.php
I would say parent_type comes from the same place as parent_name but that is quite deep down the rabbit hole for my first time with php
If I had to guess that didn’t work because parent_type is not a function?
I appreciate the help.
The real issue here is not just getting the operator syntax right, it is when this code is executed, and what context there is for it (which variables you can reference). I very much doubt that you will be able to achieve what you want from here. When SuiteCRM is loading a view it’s not providing that code with much context, unless I am mistaken.
I think here, you’re defining field names, you’re not handling any record…
Maybe it’s better if you say what you’re trying to achieve, so people can advise you about a better approach.
So fair this code works and it achieves that when products search pop-up is opened it populates contacts name from parent name. With this, you only get products assigned to that Contact without the need of typing it.
Now what I would like to do is for this to be only triggered if the parent_type is Contacts (because it can also be Accounts etc…)
I know parent_type will give me ‘Contacts’ so I was assuming conditional statement would work here.
I don’t think it will work there. I just tried setting a debugger breakpoint on the viewdefs assignments, and loading the account detail view. It doesn’t stop at the breakpoint. I don’t have time now to go and check exactly where this is loaded, but I bet you won’t have any bean available there for this kind of condition test.
Maybe try overriding the detail view and change the field’s contents there.