i have a module which has one-to-many relationship to accounts and contacts.
Now if I choose an Account, I want only the dependent contacts of this Account to be shown in the Quick Search of Contacts field.
Is this possible to implement? Can someone guide me?
Thank you
Thank you for your answer!
I am using the most current 7.10.7 SuiteCRM Version.
Well I have added a one-to-many relationship to Cases from Contacts,
so you can now choose a contact inside the case.
But as described above, the contact field is not dependent on the accounts field.
Hope this clarfies the issue.
The link you posted I already read, but its not clear enough for me sadly…and I am not sure if it there is my issue described.
I’m playing around but I haven’t found a way to make this work yet.
Any way, you probably don’t need a Relationship for this, you could simply go in Studio / Cases and add a relate field linking to Contacts. This uses a simpler UI and probably achieves what you want. It also adds quick search by default (we just need to find out where to configure that query…).
Hey and thank you so much for getting into a solution for this issue.
Initial Filter: yes I already implemented that one. But the quick search is of course still missing.
About the relationship definition - I guess it does not matter if I take a relationship or a related field,
in both cases the quick search query has to be customized so it takes the account field into consideration.
But as you said, it seems difficult - hopefully someone can enlighten us to get this done! I am not in fear to edit all the quicksearch js files to get this running!
Thank you for your help!
I am nowhere a full developer, but even if you link this customJS file,
there must be a place where you call the function customSqs()
from the customJS file…
only because you write it into Edit/DetailViewDefs - i am not thinking that it will call the function customSqs?
As said, I am no real developer, only trying to customize our CRM - and its really hard for me to debug the whole system and its functionalities…
really crossing my fingers someone come over to this thread with the same issue, and getting it done with a solution which works…
You are correct. Like you, I am approaching this issue with a clearly insufficient understanding of everything that’s going on, and og how these files are actually used.
Maybe your best chance is to post on that SugarCRM forum thread and hope the developer who posted that customSqs comes back and clarifies things…
@pgr you are correct on the way to add the file to a specific module view.
Now if you want to make your file available our javascript function anywhere, we need to modify file custom/include/SugarFields/Fields//EditView.tpl
and add similar to this:
Dont know If your looking for the same thing as me…
I’ve setup an initial_filter on a relative field wich work great, but the auto complete ignore that fitler, so my filter is useless if the user dont open the pop up, and directly type in the field.
Trying to apply that filter to the quick search. I’ve followed a lot of topic, tryed the “Adding QuickSearch to a Custom Field” on the sugar dev guid PDF (Page 594)
var formName='EditView_'; // form name
var fieldName= 'parent_name'; // field name to override SQS
var sqsId = formName + fieldName;
sqs_objects[sqsId]['conditions'] = [{
"name": "name",
"op": "like_custom",
// "begin": "%",
"end": "%",
"value": ""
}, {
"name": "account_type", // name of field to apply filter
"op": "like_custom", // Operator Equal ne marcher pas! Il fallait like_custom
"begin": "%",
"end": "%",
"value": "Fournisseur" // Value to compare
}];
sqs_objects[sqsId]['group'] = "and";
The main error on the link before was “op”: “equal”. I think in sugar CRM 6.5 (the one SuiteCRM use) we dont have that operator. I remplaced it by like_custom
Is this reported somewhere on GitHub? I think we have enough information to be close to a fix, but I would ask you to please open an issue if you don’t find any one already there.
I’ve dont opened an issue on github but I find how to correct my bug :
Delete my code from my custom.js file
C/C it in my view.edit.php like this :
$ScriptValidation = <<<EOT
<script type="text/javascript" language="JavaScript">
//Fait a partir de : https://community.sugarcrm.com/thread/28339
//custom QuickSearch. ca ma aidez un peut : https://web.archive.org/web/20171122132629/http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_6.5/Module_Framework/Metadata/Examples/Adding_QuickSearch_to_a_custom_field/
//Cooperative Parent -> Enfant
var formName='EditView_'; // form name
var fieldName= 'accounts_accounts_1_name'; // field name to override SQS
var sqsId = formName + fieldName;
sqs_objects[sqsId]['conditions'] = [{
"name": "name",
"op": "like_custom",
// "begin": "%",
"end": "%",
"value": ""
}, {
"name": "account_type", // name of field to apply filter
"op": "like_custom", // Operator Equal ne marcher pas! Il fallait like_custom
"begin": "%",
"end": "%",
"value": "Cooperative" // Value to compare
}];
sqs_objects[sqsId]['group'] = "and";
//Compte -> Cooperative
var formName='EditView_'; // form name
var fieldName= 'accounts_accounts_2_name'; // field name to override SQS
var sqsId = formName + fieldName;
sqs_objects[sqsId]['conditions'] = [{
"name": "name",
"op": "like_custom",
// "begin": "%",
"end": "%",
"value": ""
}, {
"name": "account_type", // name of field to apply filter
"op": "like_custom", // Operator Equal ne marcher pas! Il fallait like_custom
"begin": "%",
"end": "%",
"value": "Cooperative" // Value to compare
}];
sqs_objects[sqsId]['group'] = "and";
</script>
EOT;
// Echo du code
echo $ScriptValidation;
Now everything work ! I can create with ajax I think that was cause my custom JS file was fired too late after the ajax call or something… in view.edit.php everything work great, for now !