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.