This is a public Forum  publicRSS

Topic

    Sérgio Braun
    Custom Object Add-In
    Topic posted August 14, 2018 by Sérgio BraunWhiz 
    73 Views, 4 Comments
    Title:
    Custom Object Add-In
    Content:

    Hi all!
    How can I access / update a custom object?

    Have this example:
    Custom object (CO$Correio);
    Fields: Numero (CO$Correio.Numero) and Servico (CO$Correio.Servico);
    This object is "Contacts" son;

    I need create a new register and link with a Contact.

    Answer

     

    • Robert Surujbhan

      Sérgio - there is sample code for this in the Desktop Add-Ins documentation under the section "Working with Custom Objects" - have you reviewed and tried that yet?  It shows you how to access a custom object record and the record's fields from a workspace.  Updating fields is just as easy.

      What is not working for you?

    • Sérgio Braun

      Hi Robert! 

      I need access the custom object via other object.
      For example:
      I'm in the contact object;
      I pressed a button;
      The event this button is: create a new register in the custom object and assign to active contact.

       

      I need to add some parameter besides "(" PACK $ OBJECT ");

    • Sérgio Braun

      Can someone help me?

    • Deepu Kolkkadan

      Hi Sergio,

      You can achieve this requirement with the help of a browser control and custom script.

      1. Assuming you are in Contact workspace

      2. Create a custom script, in which you need to write codes for creating new custom object with contact mapping.

      3. Write workspace rule like: When a button click then set browser url (custom script url)

      Sample Code:

               use RightNow\Connect\v1_4 as RNCPHP;
              $rma = new RNCPHP\CO\RMA();
               
              // fetch the Incident object for the RMA
              $rma->ContactID= RNCPHP\Contact::fetch(138);  
              $rma->RMANumber = "10218120";
              $rma->FullfillmentCenter = RNCPHP\CO\FullfillmentCenter::fetch('Seattle');
                              
              // use a ROQL query to get product by description
              $products = RNCPHP\ROQL::queryObject("SELECT CO.PurchasedProduct FROM CO.PurchasedProduct
                      WHERE CO.PurchasedProduct.ProductDescription = 'Deluxe Widget'")->next();
               
              // use the next method to navigate to first object of the query
              $rma->ProductID = $products->next();
              $rma->save();

       

      Regards

      Deepu