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?



Parents
  • 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

    $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,
                'reportable' => true,
                'unified_search' => false,
                'calculated' => false,
                'len' => '100',
                'size' => '20',
                'studio' => [
                    'recordview' => true,
                    'wirelessdetailview' => true,
                    'listview' => false,
                    'wirelesseditview' => false,
                    'wirelesslistview' => false,
                    'wireless_basic_search' => false,
                    'wireless_advanced_search' => false,
                    'portallistview' => false,
                    'portalrecordview' => false,
                    'portaleditview' => false,
                ],
            ],
        ],
        'indices' => [
            'sync_key' => [
                'name' => 'idx_' . strtolower($table_name) . '_skey',
                'type' => 'unique',
                'fields' => ['sync_key'],
            ],
        ],
    ];

    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

Reply Children