How to update specific fields from two different data sources?


How can I update a specific input data field?

Let’s say I have 2 HTTP requests pulling one from ERP and one from CRM, as I update, for example, the “CRM business value field” with the value of “ERP sales order” to update the business within CRM ?

I thank the attention!

Sorry, do not understand what you want to do. Can you please elaborate. Thanks!

Hello @jan ,

Sorry for the vague description of my question, I’ll try to explain below the process I’m trying to accomplish.

I need to create an automated update and registration process in my CRM according to the order data of my ERP.

This is my workflow that I’m trying to create, I take ERP orders and filter with the CNPJ field of the existing company within the CRM.

Then I tried to create an IF that compared the “CNPJ field” of the ERP with the CRM (because this field is common among the 2), to separate the registrations that have not yet been registered in the CRM.

And I came across another problem for some reason it does not separate the records that exist in CRM from those that do not have a record.

And finally, if there is a record in the CRM, I need to update the data with the ERP information, and if there is no record, I need to create the company record and create a new opportunity in the CRM.

Below are the JSON layouts for making updates and registration and I don’t know how to operate inside the tool.

BODY Raw ( PUT Update Deal)

            "rdstation_reference": null,
            "data_congelamento": null,
            "type_reference": 100,
            "reference": "[email protected]",
            "temperature": 1,
            "probability": 100,
            "account_id": 1,
            "pipeline_id": 1,
            "owner_id": 1,
            "stage_id": 1,
            "person_id": 11,
            "company_id": 94,
            "lost_reason_id": null,
            "origin_id": null,
            "started_in_stage_id": 1,
            "city_id": 3826,
            "created_at": "2020-02-28",
            "title": "Buffet Formatura",
            "description": "O esforço é incontável, por isso a vitória deve ser comemorada com toda intensidade. Agende sua formatura no thor e brinde sua conquista com o melhor da comida caseira.",
            "observation": "900 pessoas",
            "status": 0,
            "closed_at": "2019-12-28 22:27:42",
            "reason_close": null,
            "deleted": 0,
            "freezed": 0,
            "value": "1600.00",
            "order": 1,
            "updated_at": "2020-02-28 13:30:24",
            "last_stage_updated_at": "2020-02-28 13:30:24",
            "value_mrr": "1600.00",
            "probably_closed_at": "2020-02-28",
            "last_contact_at": "2020-02-28 14:05:08",
            "stage_changed_at": null

BODY Raw ( POST Create Companies)

    "cnae_id": null,
    "city_id": 1,
    "owner_id": 1,
    "manager_id": 1,
    "segment_id": 1,
    "name": "Piperun",
    "cnpj": "73.211.403/0001-53",
    "website": "",
    "email_nf": "[email protected]",
    "logo": "",
    "hash": "ccef1438a94a1987539f0767bbda403c",
    "observation": "O CRM de Vendas PipeRun é orientado para a automatização e o aumento de performance de vendas para empresas que atuam com vendas complexas e gestão de canais. ",
    "address_postal_code": "90560-002",
    "address": "Av. Cristóvão Colombo, 2948",
    "address_number": "12",
    "address_complement": "Av. Cristóvão Colombo, 2948",
    "company_name": "odig",
    "ie": "473.710.660.535",
    "district": "centro",
    "country": "Brasil",
    "facebook": "",
    "linkedin": "",
    "city": {
        "id": 1,
        "uf": "RO",
        "name": "Alta Floresta D'Oeste"
    "cep": "90560-002",
    "customer_at": "2020-02-19",
    "foundation_at": "1990-02-25",
    "company_type": 1,
    "company_status": 1,
    "company_situation": 1,
    "status_touch": 1,
    "nps_score": 20500,
    "social_capital": 20000,
    "is_brand": 0,
    "is_supplier": 0,
    "is_client": 0,
    "is_carrier": 0,
    "is_franchise": 0,
    "contact_emails": [
            "email": "[email protected]"
            "email": "[email protected]"
    "contact_phones": [
            "phone": "(51)3212-00-00"
            "phone": "(55)3212-00-00"
    "custom_fields": []

BODY Raw ( POST Create Deal)

            "rdstation_reference": "E-mail não informado",
            "data_congelamento": null,
            "type_reference": 3,
            "reference": "E-mail não informado",
            "temperature": null,
            "probability": null,
            "account_id": 1,
            "pipeline_id": 1,
            "owner_id": 1,
            "stage_id": 2,
            "person_id": null,
            "company_id": null,
            "lost_reason_id": null,
            "origin_id": null,
            "started_in_stage_id": 1,
            "city_id": null,
            "created_at": "2020-06-26 11:28:43",
            "title": "Deals teste",
            "description": null,
            "observation": null,
            "status": 0,
            "reason_close": null,
            "deleted": 0,
            "freezed": 0,
            "value": "0.00",
                 "id": 5,	

                    "id": 113,
                    "account_id": 1,
                    "user_id": 1,
                    "name": "Lead Quente 987456",
                    "color": "success",
                    "created_at": "2020-07-09 08:53:03",
                    "belongs": 1

Example of ERP data entry
example of CRM data entry

Have you tried to apply a merge step joining by key values?

This approach works for me with two different http requests to join output results by value (different key names, but same values).

Hello, @Miquel_Colomer thank you so much it worked!

1 Like


Enjoy n8n!