Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Email Address Handling #22

Open
yuki-consulting opened this issue Apr 28, 2020 · 4 comments
Open

Email Address Handling #22

yuki-consulting opened this issue Apr 28, 2020 · 4 comments

Comments

@yuki-consulting
Copy link

Hi there,

Try to import Leads with email address and encounter an issue. The lead records and the email address records are both created. However, they are not linked to each other.

Try using email1 field as well as an email array but both options do not work. Am I missing something?

Thanks in advance.

@ShadMickelberry
Copy link
Contributor

Can you post a sample you are sending? Here is a sample post that seems to be going through just fine.
{ "records": [ { "id": "47fecf72-b195-11e8-a6e1-06cd403c41f6", "first_name": "Test3", "last_name": "Test3", "user_name": "test3", "password": "test123", "email1": "test1@test.com" }, { "id": "47fed0f8-b195-11e8-9dde-06cd403c41f6", "first_name": "Test2", "last_name": "Test2", "user_name": "test2", "password": "test123", "email1": "test2@test.com" } ] }

In the config_override:
$sugar_config['bulk_import_settings']['modules']['Leads']['sugar_key_field'] = 'id'; $sugar_config['bulk_import_settings']['modules']['Leads']['external_key_field'] = 'id'; // REQUIRED - REST payload variable containing the external system unique key's value $sugar_config['bulk_import_settings']['modules']['Leads']['sql_query'] = 'select id from contacts where id = ?';

@yuki-consulting
Copy link
Author

Hi there,

Thank you for getting back to me. I have changed my code now so i don't have a sample handy. For me, i have tried the email1 field like you did as well as using an email array similar to example in https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_9.2/Cookbook/Web_Services/REST_API/PHP/How_to_Manipulate_Records_CRUD/#Request_Payload
but neither worked

I ended up changing the code to bulkimport them ass EmailAddresses and then use the relationship to link them.

By the way, it is very interesting that you are using the id as the external key. Does that mean we do not have to create another foreign key?

@ShadMickelberry
Copy link
Contributor

Hello.

That id was just for ease so I didn't have to create a field to test with. Generally, that wouldn't be the case but there is certainly nothing preventing from using that as the external key. If you had an external application creating UUIDs that would work just fine.

I'd investigate if there is some other process interfering with the email population. I have used this quite a bit and not run into that. Are you running into the same issue if you just use the regular create endpoint?

@yuki-consulting
Copy link
Author

Hello.

I did not have the same problem using the normal endpoint but it is much slower.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants