Elasticsearch doesn't open any custom fields

Hello

I am using Elastichsearch 5.6.10

When I search for anything I can ONLY open the main module

If I try to open any fields in a one-to-many relationship on the results page, I get an error entry. This post may have been deleted or you do not have permission to view it.

This happens because the custom module field has the same ID
Please see attachments:
If I click on Region it’s open the wrong ID.

Hey,

I’ve given it a try on:

SuiteCRM 7.11.15
Elasticsearch v5.6.16 & Elasticsearch v5.6.10

and it seems to route to the correct record on the Results screen.

I was wondering, What version of SuiteCRM are you using?

And, also, do you by chance know at what point the relationship was created?
(ie: In module builder, or in studio after the custom module was published)


(The one I had tested with was a One-to-Many Contacts-Custom Module relationship that had been created alongside the module, in module builder)

@John
Thanks for reply

I’m use SuiteCRM 7.11.15
Also, I use fix for Elasticsearch by your reply in separate topic Elasticsearch return empty result page

I created all my relationship in Studio after the custom module was published

How they can be correct If I try to open "Name" I get the correct redirect and can see this URL
index.php?action=DetailView&module=Contacts&record=zcrm_3111820000005032012&offset=1

But if I try to click Region (Lookup) I get a redirect with Error retrieving record. This record may be deleted or you may not be authorized to view it.
and can see the wrong ID in URL
index.php?action=DetailView&module=RGNS_Regions&record=zcrm_3111820000005032012&offset=1

As you can see both records have the same ID. But ID correct only for Name column
for Region (Lookup) records with this ID doesn’t exist

UPD:
in my first post, you can see the AsNa_AssociatedNames module, which contains the Name and Contact columns, they also have the same ID. and I don’t understand this point. why for the second column its own id is not registered?

Hey,

Thanks for your reply!

I’ve applied the changes you linked, and I am able to see the same issue


As far as I can tell, it looks like the lines added/modified in the “SearchResults.php” file are what is causing this.
It appears to be grabbing the ID for the parent item, (in this case the Contact), and using it for each link to a related record


I’ve been playing around with the code to try and find a solution, but unfortunately haven’t had much success as I’m not too knowledgable on the inner workings of the Search functionality

Though, If any other users have some insight, ( or are more knowledgeable), it’d be good to hear your thoughts!


As a side note, It might be worth raising this as a consideration against the fix on github, so that it is addressed

@John

Thanks for spending your time and testing it

I used this fix cause I get an empty result page but if I understood correctly you can use Elastichsearch without this fix, right?

Hey,

I was initially able to use the functionality without issue, but upon re-installing to test further, I started hitting the same issue that you did originally
(No results)

Although, I’ve made some progress thanks to this: https://github.com/salesagility/SuiteCRM/issues/7968

The user “tsummerer” mentions that custom relationships are sometimes being created with incorrect vardefs, creating 2 “Link” types, and no “id” type.
Specifically, The “_ida” vardef is set as a “link” type when it should be “id” type


So, you might be able to fix it with a small change, allowing you to search without the fix you've linked above.

After deploying your Custom Module, with the relationship,
Navigate to:
/custom/Extension/modules/Contacts/Ext/Vardefs/

Do you see a file named similar to?:
[packagekey]_[customModuleName]_contacts_Contacts.php
ie: pckg_customModule_contacts_Contacts.php

If so, does it contain a block similar to the following?:

$dictionary["Contact"]["fields"]["pckg_personmodule_contactspckg_personmodule_ida"] = array (
  'name' => 'pckg_personmodule_contactspckg_personmodule_ida',
  'type' => 'link',
  'relationship' => 'pckg_personmodule_contacts',
  'source' => 'non-db',
  'reportable' => false,
  'side' => 'right',
  'vname' => 'LBL_PCKG_PERSONMODULE_CONTACTS_FROM_CONTACTS_TITLE',
);

( Specifically one in which “Name” ends in “_ida”, it is the 3rd block for myself)
(Note: In this instance, “pckg” is my Package Key, and “personmodule” is my custom module’s name)


If it contains this block, in this section, change:
'type' => 'link',

To:

'type' => 'id'

Then, in the CRM, run a Quick Repair and Rebuild

After doing so, are you able to search and route through related items without issue?


Let me know if anything from the above doesn't make sense, or if you've got any questions/issues
2 Likes

@John

Thank you for helping me

I did a quick test, I did your fix above for only one module. After QRR it works well (for this relationship)
Tomorrow I will fix all my custom modules

Hey,

No worries, glad to be of help!

That’s great to hear that it worked, hopefully it’s just as successful elsewhere :sweat_smile:

Let us know how it goes!

Hi

It works fine for all my custom module

I changed all

could this lead to another problem?

Hey,

Nice!

I can’t say with 100% certainty, but if that is how the relationships should have been built by the CRM, then it should be good after making that change

Those changes would only affect the relationship fields, so if any issues do appear, it should only affect the relationships
And, if needed, you should be able to revert the change, and Repair and Rebuild, and it will return to how it was previously

But, if anything pops up, please feel free to drop another thread on the forums :slight_smile: