Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Joe Bordes
    @joebordes
    I tested the code I uploaded to the project: it is working
    the post URL looks wrong
    it should be only one webservice.php
    Morgan
    @morganbigot
    ok you did almost all of the work :)
    thank you
    Joe Bordes
    @joebordes
    :-)
    Morgan
    @morganbigot
    is it working on your coreBOS Webservice Development tool?
    Morgan
    @morganbigot
    you may have identified a pb: why the cbURL contains webservice.php?
    Capture d’écran 2019-12-05 à 22.36.25.png
    do you have the same?
    Joe Bordes
    @joebordes
    I tested it with the WS Devel tool
    let me check the URL for you
    FireShot Capture 203 - coreBOS Webservice Development - localhost.png
    Morgan
    @morganbigot
    When testing upsert.js i get the error : VM777:1 POST https://archireport.corebos-crm.fr/webservice.php/webservice.php 500 (Internal Server Error)
    Morgan
    @morganbigot

    all tests have webservice.php/webservice.php

    so i don't think this caused the pb

    Morgan
    @morganbigot

    When testing upsert.js i get the error : VM777:1 POST https://archireport.corebos-crm.fr/webservice.php/webservice.php 500 (Internal Server Error)

    I will check the server log and keep you informed.

    Morgan
    @morganbigot
    Hi Joe, here is the log
    is that the user parameter that is missing?
    Morgan
    @morganbigot
    Hi Joe, here is the log
    PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function vtws_upsert(), 
    4 passed in /var/www/html/crm/arc/include/Webservices/OperationManager.php on line 138 and exactly 5 expected in /var/www/html/crm/arc/include/Webservices/upsert.php:16\nStack 
    trace:\n#0 /var/www/html/crm/arc/include/Webservices/OperationManager.php(138): vtws_upsert('Contacts', Array, 'email', Object(Users))\n#1 /var/www/html/crm/arc/webservice.php(180): 
    OperationManager->runOperation(Array, Object(Users))\n#2 {main}\n  thrown in /var/www/html/crm/arc/include/Webservices/upsert.php on line 16, 
    `
    Joe Bordes
    @joebordes
    execute all corebos updates
    EVERY time you update your coreBOS install you must load and apply all changesets
    give that a try and let me know
    Morgan
    @morganbigot
    got it
    i now have
    {"success":false,"error":{"code":"MANDATORY_FIELDS_MISSING","message":"Assigned To (assigned_user_id) does not have a value"}}
    no more error 500
    Joe Bordes
    @joebordes
    great!
    add that field
    Morgan
    @morganbigot
    sorry what field is it ?
    Joe Bordes
    @joebordes
    it is trying to create the record
    assigned_user_id
    Morgan
    @morganbigot
    ah you mean that field is missing in my corebos ?
    Joe Bordes
    @joebordes
    no, it is missing in the array of values you send in
    it can't find any contact with that email and is trying to create a new record
    but the assigned to field is mandatiry for the creation
    and you are not giving it a value in the input $element array
    Morgan
    @morganbigot
    ok that's clear now.
    As i told to Gerald, once in production for our company Archireport, i will write an article explaining how and why we switched from Hubspot to Corebos (if you agree)
    Joe Bordes
    @joebordes
    absolutely!!
    sounds great
    Morgan
    @morganbigot
    Here is the updated working sample code:
    ***************************************
    JS UPSERT V2
    ***************************************
    //upsert using doInvoke
    var params = {
        "elementType":"Contacts",
        "element":JSON.stringify({
            "email":"toto@yopmail.com",
            "firstname":"JSTest upsert firstname",
            "lastname":"JSTest upsert lastname",
            "mobile":"02220303030",
            "leadsource":"archireport",
            "assigned_user_id":"19x5"
        }),
        "searchOn":"email",
        "updatedfields":"email,firstname,lastname,mobile,leadsource"    
    };
    
    
    cbconn.doInvoke(afterUpsertRecord, 'upsert', params, 'POST');
    
    function afterUpsertRecord(result, args) {
        if(result) {
            console.log(result);
            outputmsg('Record Id = ' + cbconn.getRecordId(result.id));
        } else {
            outputmsg('<p style="color:red">Upsert failed</p>');
        }
    }
    just don't know how to explain in the comments how to get a user id from the CRM
    Joe Bordes
    @joebordes
    looks good. glad you got it working
    when you login, the "success" response gives you the userid of the user you connected with
    normally you will use that one
    doDescribe will return the list of user you can assign
    as it depends on the security settings of each corebos
    and there are some undocumented methods to retrieve that information directly also
    Morgan
    @morganbigot
    👍