Hi,
I have an edit view with a few custom fields which are related fields. We have altered the way how records are written to the DB so that we can define fields in the edit view which do not appear in the field list of the module (we write those fields to other places in the DB).
These custom related fields work mostly. The popup for selecting records and their ids works just fine. Just the auto-complete when typing directly into the field does not work. I read older threads and figured out that I have ro register my new custom related field to some “sqs_object” in order to enable the autocomplete. I found the definition of the sqs_object entry in the editview.tpl
However, this is not working and I don’t know why. The SuiteCRM-created related fields have this auto-complete working. Just my custom fields, which mimic the code of the related field (with updated field names, obviously) do not have auto complete.
Here is what I did. My custom related field is called ‘vendor_0’ (name) and ‘hidden_vendor_0’ (id), i.e. following the logic of how related fields are definied in SuiteCRM.
I created a .js extension for the module which I added to the editviewdefs.php creating a query endpoint like this:
$(function(){
SUGAR.util.doWhen(
"typeof(sqs_objects) != 'undefined' && typeof(sqs_objects['EditView_vendor_0']) == 'undefined'",
function(){
sqs_objects['EditView_vendor_0']={
"form":"EditView",
"method":"query",
"modules":["Company"],
"group":"or",
"field_list":["name", "id"],
"populate_list":["vendor_0","hidden_vendor_0"],
"required_list":["parent_id"],
"conditions":[{"name":"name","op":"like_custom","end":"%","value":""}],
"order":"name",
"limit":"30",
"no_match_text":"No Match" };
}
);
});
This should correspond to the way the SuiteCRM-created fields look like but its not working. I would appreciate pointers where to look / what could be missing.
Best,