Can't set a sync key value for a record using the API

Hi,

Trying the integrate endpoint 

/integrate/<module>/:record_id/:sync_key_field_name/:sync_key_field_value

explained here,

I keep getting "error_message": "Could not find a route with 5 elements".

I can confirm that the record ID exists when I log in to the UI. the "name" field also exist in this record. 

Things I tried: 
 - Changing the version (v11_10 is not working at all)
 - Trying different modules with different records

The requested URL I'm using is:

PATCH/PUT https://{{base_url}}.demo.sugarcrm.com/rest/v10/integrate/Calls/{{record_id}}/name/Test

Can anyone spot what I'm doing wrong?



  • Hi 

    Does it work fine if you use the default "sync_key" field provided, instead of using the name field?

    The sync_key fields are "special", and they need some specific know-how to add a new sync_key field type. You would not be able to use the "name" pre-existing field as a sync_key field.

    Here is the template of what a sync_key field type should look like (and its database index) to help you get started

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    $vardefs = [
    'fields' => [
    'sync_key' => [
    'is_sync_key' => true,
    'name' => 'sync_key',
    'vname' => 'LBL_SYNC_KEY',
    'type' => 'varchar',
    'enforced' => '',
    'required' => false,
    'massupdate' => false,
    'readonly' => true,
    'default' => null,
    'isnull' => true,
    'no_default' => false,
    'comments' => 'External default id of the remote integration record',
    'help' => '',
    'importable' => 'true',
    'duplicate_merge' => 'disabled',
    'merge_filter' => 'disabled',
    'duplicate_on_record_copy' => 'no',
    'audited' => true,
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    In addition to that, here https://github.com/esimonetti/sugar-new-sync-key-field you can find a sample Sugar installable package on how to add new sync_key type fields.

    Hope it helps!

    --

    Enrico Simonetti

    Sugar veteran (from 2007)

    www.naonis.tech


    Feel free to reach out for consulting regarding:

    • API Integration and Automation Services
    • Sugar Architecture
    • Sugar Performance Optimisation
    • Sugar Consulting, Best Practices and Technical Training
    • AWS and Sugar Technical Help
    • CTO-as-a-service
    • Solutions-as-a-service
    • and more!

    All active SugarCRM certifications

    Actively working remotely with customers based in APAC and in the United States

  • Hi Enrico,

    Thanks for you reply. I tested the operation using the keyword "sync_key", however I still get the same error message: "Could not find a route with 5 elements"

  • What Sugar version do you have? 10.2? (About page, after clicking on your profile picture on the top right of the screen)

    --

    Enrico Simonetti

    Sugar veteran (from 2007)

    www.naonis.tech


    Feel free to reach out for consulting regarding:

    • API Integration and Automation Services
    • Sugar Architecture
    • Sugar Performance Optimisation
    • Sugar Consulting, Best Practices and Technical Training
    • AWS and Sugar Technical Help
    • CTO-as-a-service
    • Solutions-as-a-service
    • and more!

    All active SugarCRM certifications

    Actively working remotely with customers based in APAC and in the United States

  • Hi Enrico, it's version 10.1.0 (Version 10.1.0 (Build 201 E) (Q3 2020))

  • That's the issue then. The api is only available since version 10.2

    --

    Enrico Simonetti

    Sugar veteran (from 2007)

    www.naonis.tech


    Feel free to reach out for consulting regarding:

    • API Integration and Automation Services
    • Sugar Architecture
    • Sugar Performance Optimisation
    • Sugar Consulting, Best Practices and Technical Training
    • AWS and Sugar Technical Help
    • CTO-as-a-service
    • Solutions-as-a-service
    • and more!

    All active SugarCRM certifications

    Actively working remotely with customers based in APAC and in the United States

  • Hi Kian,

    In addition to Enrico's reply, the  Upsert EndPoint  and sync key is the new field introduced in all modules from Q4 2020 release(10.2 SugarCRM version).

  • Thank you for looking into this