Issue with the link_name_to_fields_array in the get_entry_list method

Hello,

I’m currently facing an issue with the link_to_name_fields_array of the get_entry_list method of the API v4_1.
I want to get contacts informations with the associated accounts informations.
For example, I want to get the email adress, first name, last name of the contact with the name of the associated account, the type of the account, and the creation date of the account.
So I create my rest_data object for the header like this :
{“session”: “session_id”,“module_name”:“Contacts”,“query”:null,“order_by”: null,“offset”: null,“select_fields”: [“id”, “first_name”, “last_name”, “email1”],“link_name_to_fields_array”: [[“name”:“accounts”, “value”:[“name”,“account_type”,“date_entered”]]] null,“max_results”: 10 }.
But whenever I send the request in POST, I obtain a null response with the code 200. And if I remove the link_name_to_fields_array parameter or put it to null like “link_name_to_fields_array”:null, I obtain the contact information.
I’m sorry but I don’t see what I’m doing wrong or maybe I didn’t understand fully the link fields.
Can you help me with this ?

I precise that I use Advanced Rest Client to do my request.

Thank you for your time.

Best regards

Hello, can somebody help me with this issue please ? It’s kinda blocking me right now because I can not retrieve some crucial information. Do you know how the link fields work and how I can make this work please ?

Hello, I still need some help. Can someone help me please ?

I don’t know this issue, I can only offer some “meta-help”: do you have a debugger set up with xdebug so you can follow the code and see what it happening? That is a game changer for your productivity, especially with getting unstuck from issues such as this.

I don’t mind helping you set this up, if you don’t have it, and would like to try.

I partially debug my issue. I can know retrieve Account related field of Contacts with this rest_data object:
{“session”: “sess_id”,“module_name”:“Contacts”,“query”:null,“order_by”: null,“offset”: null,“select_fields”: [“id”, “first_name”, “last_name”,“lbl_assigned_to_name”],“link_name_to_fields_array”: [{“name”:“accounts”,“value”:[“account_type”, “date_entered”]}],“max_results”: 4 }.

But I still have an issue to retrieve the assigned SuiteCRM user to the contact. I tried to add in the link_name_to_fields_array the following object {“name”:“users”,“value”:[“user_name”]} but in the json object, the field is null like if the contact was not assigned to any suitecrm user.

Do someone have any idea on how to retrieve the assigned user with the link_name_to_fields_array object ?

Hi,

You are using lbl_assigned_to_name in select_fields.
There is no such field.
You should use assigned_user_name and/or assigned_user_id

1 Like

Hi,

Thank you so much. I tried to understand the vardef.php of the Contact’s module but I didn’t get it quite right. Now, it’s working perfectly with assigned_user_name.
I’m new to the api and i’m still trying to understant the mechanics of it.