Related to dropdown in email import popup not working

When opening emails and then importing them (whether individually or bulk) the popup window ‘IMPORT INTO SUITECRM’ has 2 fields for ‘Assigned to’ and ‘Related to’. When entering data into these fields, neither provide a dropdown list, forcing use of the advanced search.

This does work in other modules on my installation, such as in the ‘Calls’ module. I can start typing a contact or account name and a dropdown list appears.

Is this error unique to me? Does anyone have a fix for this please?

Many thanks
Using 7.14.6 on PHP8.2

On the Import Screen itself, if you start typing, does it not give you a suggested list of Matched Records ?

No it doesn’t. It’s what would expect but neither of the previous mentioned fields work.
I have tried to follow the code without success.
Any ideas?

Assigned to should give you list of users, while Related To should give you the Module Records that you have selected, If neither of them are working, Can you check your Browser Console (Press F11 on windows) to see if there are any JS errors.

Check out suitecrm.log file for any Fatal Errors.

Hi Cherub-chum

Thanks for sticking with me on this.

An interesting development is that if I import the email without completing the ‘Related to’ fields and then go to edit the email record, the dropdown lists work!

Suitecrm.log only has the following persisting errors;

2025-06-16 [3617290][1][FATAL] ImapHandler trying to use a non valid resource stream.
2025-06-16 [3617290][1][FATAL] ImapHandler trying to use a non valid resource stream.
2025-06-16 [3617800][1][FATAL] ImapHandler trying to use a non valid resource stream.
2025-06-16 [3617800][1][FATAL] ImapHandler trying to use a non valid resource stream.
2025-06-16 [3618509][1][FATAL] ImapHandler trying to use a non valid resource stream.
2025-06-16 [3618509][1][FATAL] ImapHandler trying to use a non valid resource stream.
2025-06-16 [3618509][1][FATAL] An Imap error detected: "IMAP setFlagFull error"
2025-06-16 [3618509][1][FATAL] ImapHandler trying to use a non valid resource stream.
2025-06-16 [3618509][1][FATAL] ImapHandler trying to use a non valid resource stream.

The console shows the following;

JQMIGRATE: Migrate is installed, version 3.4.0
sugar_grp1.js?v=2zRH2zgSCxRCt0twsabhUg:21 [Violation] 'setTimeout' handler took 83ms
sugar_grp1.js?v=2zRH2zgSCxRCt0twsabhUg:21 [Violation] 'setTimeout' handler took 54ms
sugar_grp1.js?v=2zRH2zgSCxRCt0twsabhUg:21 [Violation] 'setTimeout' handler took 248ms
Navigated to https://[my url]/crm/index.php?module=Emails&action=DetailView&record=962baa87-8edc-cab1-7d8e-684ff0ac1ca7
sugar_grp1_jquery.js?v=2zRH2zgSCxRCt0twsabhUg:6 JQMIGRATE: Migrate is installed, version 3.4.0
sugar_grp1.js?v=2zRH2zgSCxRCt0twsabhUg:21 [Violation] 'setTimeout' handler took 78ms
Navigated to https://[my url]/crm/index.php?module=Emails&action=index&parentTab=All
sugar_grp1_jquery.js?v=2zRH2zgSCxRCt0twsabhUg:6 JQMIGRATE: Migrate is installed, version 3.4.0
index.php?module=Emails&action=index&parentTab=All:1514 Uncaught TypeError: Cannot set properties of undefined (setting 'disable')
    at changeParentQSSearchView (index.php?module=Emails&action=index&parentTab=All:1514:33)
    at HTMLInputElement.<anonymous> (index.php?module=Emails&action=index&parentTab=All:1534:5)
    at r (sugar_grp1_yui.js?v=2zRH2zgSCxRCt0twsabhUg:5:30855)
    at Object._tryPreloadAttach (sugar_grp1_yui.js?v=2zRH2zgSCxRCt0twsabhUg:5:31099)
    at q (sugar_grp1.js?v=2zRH2zgSCxRCt0twsabhUg:779:6316)
changeParentQSSearchView @ index.php?module=Emails&action=index&parentTab=All:1514
(anonymous) @ index.php?module=Emails&action=index&parentTab=All:1534
r @ sugar_grp1_yui.js?v=2zRH2zgSCxRCt0twsabhUg:5
_tryPreloadAttach @ sugar_grp1_yui.js?v=2zRH2zgSCxRCt0twsabhUg:5
q @ sugar_grp1.js?v=2zRH2zgSCxRCt0twsabhUg:779
setInterval
later @ sugar_grp1.js?v=2zRH2zgSCxRCt0twsabhUg:779
startInterval @ sugar_grp1_yui.js?v=2zRH2zgSCxRCt0twsabhUg:5
onAvailable @ sugar_grp1_yui.js?v=2zRH2zgSCxRCt0twsabhUg:5
(anonymous) @ style.js?v=2zRH2zgSCxRCt0twsabhUg:112Understand this errorAI
Navigated to https://[my url]/crm/index.php?module=Emails&action=DisplayDetailView&folder_name=INBOX&folder=inbound&inbound_email_record=7bdc5847-66c9-b0f4-a207-657b9ca5e390&uid=114518&msgno=2815
sugar_grp1_jquery.js?v=2zRH2zgSCxRCt0twsabhUg:6 JQMIGRATE: Migrate is installed, version 3.4.0
Navigated to https://[my url]/crm/index.php?module=Emails&action=index&parentTab=All
sugar_grp1_jquery.js?v=2zRH2zgSCxRCt0twsabhUg:6 JQMIGRATE: Migrate is installed, version 3.4.0
index.php?module=Emails&action=index&parentTab=All:1514 Uncaught TypeError: Cannot set properties of undefined (setting 'disable')
    at changeParentQSSearchView (index.php?module=Emails&action=index&parentTab=All:1514:33)
    at HTMLInputElement.<anonymous> (index.php?module=Emails&action=index&parentTab=All:1534:5)
    at r (sugar_grp1_yui.js?v=2zRH2zgSCxRCt0twsabhUg:5:30855)
    at Object._tryPreloadAttach (sugar_grp1_yui.js?v=2zRH2zgSCxRCt0twsabhUg:5:31099)
    at q (sugar_grp1.js?v=2zRH2zgSCxRCt0twsabhUg:779:6316)
changeParentQSSearchView @ index.php?module=Emails&action=index&parentTab=All:1514
(anonymous) @ index.php?module=Emails&action=index&parentTab=All:1534
r @ sugar_grp1_yui.js?v=2zRH2zgSCxRCt0twsabhUg:5
_tryPreloadAttach @ sugar_grp1_yui.js?v=2zRH2zgSCxRCt0twsabhUg:5
q @ sugar_grp1.js?v=2zRH2zgSCxRCt0twsabhUg:779
setInterval
later @ sugar_grp1.js?v=2zRH2zgSCxRCt0twsabhUg:779
startInterval @ sugar_grp1_yui.js?v=2zRH2zgSCxRCt0twsabhUg:5
onAvailable @ sugar_grp1_yui.js?v=2zRH2zgSCxRCt0twsabhUg:5
(anonymous) @ style.js?v=2zRH2zgSCxRCt0twsabhUg:112Understand this errorAI
sugar_grp1_jquery.js?v=2zRH2zgSCxRCt0twsabhUg:2 [Violation] 'setTimeout' handler took 114ms
Navigated to https://[my url]/crm/index.php?module=Emails&action=DisplayDetailView&folder_name=INBOX&folder=inbound&inbound_email_record=7bdc5847-66c9-b0f4-a207-657b9ca5e390&uid=114508&msgno=2808
sugar_grp1_jquery.js?v=2zRH2zgSCxRCt0twsabhUg:6 JQMIGRATE: Migrate is installed, version 3.4.0
sugar_grp1.js?v=2zRH2zgSCxRCt0twsabhUg:21 [Violation] 'setTimeout' handler took 72ms
sugar_grp1_jquery.js?v=2zRH2zgSCxRCt0twsabhUg:2 [Violation] 'click' handler took 286ms

The errors appear as soon as I open the email module. Here it is singled out;

index.php?module=Emails&action=index&parentTab=All:1514 Uncaught TypeError: Cannot set properties of undefined (setting 'disable')
    at changeParentQSSearchView (index.php?module=Emails&action=index&parentTab=All:1514:33)
    at HTMLInputElement.<anonymous> (index.php?module=Emails&action=index&parentTab=All:1534:5)
    at r (sugar_grp1_yui.js?v=2zRH2zgSCxRCt0twsabhUg:5:30855)
    at Object._tryPreloadAttach (sugar_grp1_yui.js?v=2zRH2zgSCxRCt0twsabhUg:5:31099)
    at q (sugar_grp1.js?v=2zRH2zgSCxRCt0twsabhUg:779:6316)

I hope it means more to you :thinking:

Ok, so that last error appears as soon as email module loads and relates to function changeParentQSSearchView(field) in include>Sugarfields>Fields>Parent>SearchView.tpl

I added the following to line 74 (just after: var new_module = typeField.value;)

// Initialize sqs_objects[sqsId] if it doesn't exist
    if (typeof sqs_objects[sqsId] === 'undefined') {
        sqs_objects[sqsId] = {};
    }
// to here

This fixes the error when email module loads, but the original problem persists.

The JS Uncaught Type error is unable to Get the Module Parent which is why the error is thrown.

changeParentQSSearchView function would work with parameters in the other screens where you can load and have the related records populated. So it would be easier for you to debug and compare both logs on what is being passed in the working scenario VS the IMPORT screen.

Hi Cherub-chum

Maybe I didn’t explain my previous post very well…

That JS Uncaught Type error is thrown in multiple places. For example; it is also thrown when opening the ‘Calls’ module and a new call is logged.

Using Chrome’s AI, the following is the explanation;

## Explanation
Understanding the problem
The error Uncaught TypeError: Cannot set properties of undefined (setting 'disable') occurs because you are trying to access and set a property (disable) on an object that is undefined. Specifically, the line sqs_objects[sqsId]["disable"] = true; is causing the issue. The sqs_objects variable is initialized as an empty object {}, and then you are trying to access a property using sqsId as the key. Since sqs_objects is empty, sqs_objects[sqsId] is undefined, and you cannot set properties on undefined.

Suggested fix
You need to initialize the object at sqs_objects[sqsId] before attempting to set properties on it.

(Sorry about the non-wrap. Don’t know how to fix this)

Hence the fix in my previous post.

This however is unrelated to the original issue. Proof of this is that the error existed with the ‘Calls’ module, but the ‘Related to’ dropdown list worked as expected.
To reiterate… The ‘Related to’ dropdown list just does not work in the ‘emails’ module.

So, I am painstakingly continuing to try to make sense of things. I think I’m getting close…

The built javascript returned in variable $quicksearch_js in function createQuickSearchCode in SugarFieldParent.php may be the culprit.

Some progress…

The function ‘createQuickSearchCode()’ in include/SugarFields/Fields/Parent/SugarFieldParent.php has 2 parameters. The first parameter is $formName which defaults to a value of ‘EditView’. However in the emails import screen this is set to ‘EditNonImported’.

If I add a line of code near top of the above function to force $formName to value ‘EditView’, ie

$formName = ‘EditView’;

then the dropdown list for ‘Related to:’ works!!!

However the ‘Assigned to:’ does not.

Why and where does this parameter $formName get set to ‘EditNonImported’???

I have traced back through the callstack, but so far I have not made sense of it.

QUESTION PLEASE.

I have this same problem on 2 instances.
Am I the only one with this problem? I’m on 7.14.6 on php 8.2

Does this help?

https://github.com/search?q=repo%3Asalesagility%2FSuiteCRM%20EditNonImported&type=code

Hi pgr

Thanks for that. I had already done a search for ‘EditNonImported’ in VisualCode and came up with the same list.

I could be barking up the wrong tree. Maybe instead of looking to see where this is set, I should assume it is correct. The form is after all of non-imported emails.

I need to trace why it stops the dropdown from displaying. Not easy - in fact doing my head in :exploding_head:

I ASK AGAIN PLEASE
So that I know if this is a common error or just me, can someone (anyone) please confirm… when importing an email, does the ‘Assigned to:’ and the ‘Related to:’ dropdown lists appear???

This instance is slow but has some admin level privileges. You can try it out here.

https://www.softaculous.com/demos/SuiteCRM

Thanks pgr,

Unfortunately it does not load.

The softaculous instance takes about 1 or 2 minutes to warm up.

I usually open it, leave for a loooooong time, then check it again. Sometimes a refresh helps, but don’t keep hitting refresh frequently.

Eventually it spins up and the usage is not too slow. It is a very important test tool for SuiteCRM and I hope they never give up on keeping it :crossed_fingers: