List view

Hi,

I have id field in the table now instead of id i want to display name of the person and redirect to the profile of that person
if i hide id field in the listview from name field won’t be able to redirected to the profile as id passed blank.

please guide us the way to do this.

Which version of SuiteCRM?

Which module’s List view, so I can try reproducing it?

it is our custom module list view

SuiteCRM version please?

Can you get the same thing to happen in a default module, so I can try it here? Or does it only happen in your custom module?

we are using suitecrm 7.9.11.
step we have follow to fulfill our custom requirement

  1. List view of the jobs where all the applied jobs are listed
  2. we are storing job details with the logic hook only those job details which are applied.
  3. so in this logic hook directly we are storing applicant id and other applicant details like status , comment etc.
  4. On the create job list view we are displaying no of applicants and on click of applicant count (data which are stored with logic hook ) called in the listview.
  5. so instead of applicant id how do i replace name?
  6. Also i need to show the applicant profile on click of applicant name.

I hope the steps will help you to understand the senario.

Thanks in Advance

Try using a process_record logic hook to be able to change what is displayed in the List view (including HTML and CSS). Like this:

http://www.jsmackin.co.uk/suitecrm/suitecrm-list-view-conditional-formatting/

Hi there,

I think I have a similar issue, even if the scenario is not the same.
My basic scenario is that I want to hide (or not display the value of) a field in a list view based on the user role.
I have tried a customCode in the listviewdefs.php and the custom logic in the view.list.php, but that does not work for list views (although it works for detail and edit views).
So I have tried with logic hook in the same way as your link :
www.jsmackin.co.uk/suitecrm/suitecrm-lis...ditional-formatting/
and also more specifically as this one :
https://stackoverflow.com/questions/15278977/sugarcrm-smarty-code-in-listviewdefs/15304065
And it almost works.

In the latter case (adapted to my scenario), what I want to do is to display a non db field based on an initial db field, but only for some users (based on roles).
To do that, the logic is done in a process_record logic_hook in order do display the list view.
It almost works, but only if both fields are displayed : the initial db field and the non db one.
Once the initial db field is hidden, the non db field is always blank.

-> this is where I think the issue is similar to pragneshc’s one (if I have correctly understood his scenario).
Because when he hides the id, the link is blank…

And I have done some tests and even before the logic is applied, I just try to log the value of a field in the process_record logic hook, and the value is available only if the related field is not hidden.
Perhaps it is a normal behavior, but I don’t really understand why.

Any help would be greatly appreciated.

Thank you very much in advance

PS: for my scenario (hide a field in a list view based on user role) it is perhaps not the correct way to do that, so any help on the point would also be greatly appreciated :slight_smile:

PB

I don’t think you need a non-db field for this, just go ahead and customize the way the original field is printed on screen.

That way you will avoid your current problem altogether.

Hi pgr,

Thank you for your reply,
I think the problem is not the way the logic itself is applied and db or non db field.
As I said at the end of my post, even before applying any logic, at the very beginning of the process_record logic hook, if you want to put the value of a field into the logs, this value is available only if the field is not hidden in the list view. Otherwise you get a blank value. Perhaps it is normal, but I don’t really understand why.

Now, you suggest to customize the way the field is printed on screen in order to avoid this behaviour. That’s completely fine for me, but could you please precise a little bit in which way? I couldn’t find any other way on the forums and the guides to do it.

Thanks a lot in advance.

PB

Your original field won’t be hidden, it will be present in the list view. But when SuiteCRM is about to show it, you will hide it (in some cases).

So you just need to do the simple version just like this one:

http://www.jsmackin.co.uk/suitecrm/suitecrm-list-view-conditional-formatting/

and then inside the function do something like this pseudo-code:


    public function highlightIndustry(SugarBean $bean, $event, $arguments){
        $colour = substr(md5($bean->industry),0,6);
        if (IWantToShowIndustry) {
               $bean->industry = "<div style='border: solid 5px #$colour;'>".$bean->industry."</div>";
        }
        else {
               $bean->industry = "<div style='border: solid 5px #$colour;'>----</div>";
        }
    }

Hi pgr,

Very straightforward indeed!
Need some holidays… :slight_smile:

Here is the simple code of the logic hook function (defined as a process_record logic hook):


class ListViewLogicHook {

    public function getListValue(&$bean, $event, $arguments) {
        //Get the current user's role
        $objACLRole = new ACLRole();
        $roles = $objACLRole->getUserRoles($GLOBALS['current_user']->id);

        //check if they are in the PT's role
        if(in_array('PT',$roles) ){ 
            $bean->total_amt = '';
            $bean->total_amount = '';
        }
    }
}

Very simple…

Thanks a lot

I assume pragneshc could apply similar approach to the scenario of the initial post…

PB

1 Like

Grazie pgr
I solved 1 minute before your suggestion !!
How exhausting
No I’m not a developer

I ask you one last thing, if instead I would like to color the whole line?

thanks
Luca