Integrations and APIs for Service

Get Involved. Join the Conversation.

Posts

  • Earl Taylor
    Synchronizing the SLA field with a Custom Object
    Topic posted December 11, 2018 by Earl Taylor, tagged Connect PHP, Custom Process Models - CPMs 
    Title:
    Synchronizing the SLA field with a Custom Object
    Summary:
    We want to change an existing script to sync with the SLA container for the orgs table
    Content:

    We have a script that updates our Custom Object fields from the Organization table. This has been working great, but now we need to add a field on the Custom Object and have the SLA container object synch with this new field. this new field is used to identify end user support status, when a partner opens an incident for the end user.

    We were hoping to just be able to add a line of code in this process to do this. The new field name in the CompanyName$CN Custom Object is "sup_tier"

    We have the SLA Container showing in the Oragnization Work space, but the value displayed is not actually present in the orgs table itself.

    Does anyone have an idea how this can be done? The SLA tables are a pain to deal with as it is. Any help would be appreciated.

    The current code is as follows:

    <?php

    /*
    * CPMObjectEventHandler: organization_create_update
    * Package: OracleServiceCloud
    * Objects: Organization
    * Actions: Create, Update
    * Version: 1.2
    * Purpose: Pushing Org data to CompanyName$CN CBO
    */

    // This object procedure binds to v1_2 of the Connect PHP API
    use \RightNow\Connect\v1_2 as RNCPHP;

    // This object procedure binds to the v1 interface of the process
    // designer
    use \RightNow\CPM\v1 as RNCPM;

    /**
     * An Object Event Handler must provide two classes:
     * - One with the same name as the CPMObjectEventHandler tag
     * above that implements the ObjectEventHandler interface.
     * - And one of the same name with a "_TestHarness" suffix
     * that implements the ObjectEventHandler_TestHarness interface.
     *
     * Each method must have an implementation.
     */

    class organization_create_update implements RNCPM\ObjectEventHandler
    {
        public static function apply($run_mode, $action, $obj, $n_cycles)
        {
            $debug = true;
           
                self::debugJsOutput($debug, $obj->ID, "***********\n");
                self::debugJsOutput($debug, $obj->ID, "***********\n");
                self::debugJsOutput($debug, $obj->ID, date("Y-m-d H:i:s") . "\n");
                self::debugJsOutput($debug, $obj->ID, "***********\n");
                self::debugJsOutput($debug, $obj->ID, "- " . __CLASS__ . "::" . __FUNCTION__ . "\n");
                self::debugJsOutput($debug, $obj->ID, "-- Action: " . ( $action === RNCPM\ActionUpdate ? "Update" : "Create" ) . "\n");
                self::debugJsOutput($debug, $obj->ID, "-- Cycle number: " . $n_cycles . "\n");
                self::debugJsOutput($debug, $obj->ID, "-- run_mode: " . $run_mode . "\n");
               
                if($run_mode == 1)
                {
                    $obj = RNCPHP\Organization::fetch($obj->ID);
                    self::debugJsOutput($debug, $obj->ID, "-- LookupName = " . $obj->LookupName . "\n");
                   
                    if(!is_null($obj->CustomFields->CompanyName->CN))
                    {
                        $CN = RNCPHP\CompanyName\CN::fetch($obj->CustomFields->CompanyName->CN->ID);
                        self::debugJsOutput($debug, $obj->ID, "-- CN = " . $obj->CustomFields->CompanyName->CN->ID . "\n");
                    }
                    else
                    {
                        $CN = new RNCPHP\CompanyName\CN();
                    }
                     
        if(!is_null($obj->CustomFields->c->sfdc_acctno))
                    {
                        $CN->SFDC_no = $obj->CustomFields->c->sfdc_acctno;
                    }
                    else
                    {
                        $CN->SFDC_no = 'FAKE-' . rand(100000,999999);
                    }
                       
                    $CN->Comp_name = $obj->LookupName;
        $CN->save();
                    self::debugJsOutput($debug, $obj->ID, "-- CN ID = " . $CN->ID . "\n");
                   
                    $md = $obj::getMetadata();
                    $cf_type_name = $md->CustomFields->type_name;
                    $md2 = $cf_type_name::getMetadata();
                    $obj->CustomFields->CompanyName = new $md2->CompanyName->type_name;
                    $obj->CustomFields->CompanyName->CN = $CN->ID;
                    //$obj->save();
        $obj->save(RNCPHP\RNObject::SuppressExternalEvents);
                   
                    self::debugJsOutput($debug, $obj->ID, "-- Saved.\n");
        
        $obj = RNCPHP\Organization::fetch($obj->ID);
                    self::debugJsOutput($debug, $obj->ID, "-- LookupName = " . $obj->LookupName . "\n");
                   
                }
           
            try
            {
                return true;
            }
            catch(Exception $e)
            {
                self::debugJsOutput($debug, $obj->ID, "-- Exception: " . $e->getMessage() . "\n");
            }
        } // apply()
       
        private static function debugJsOutput($debug, $id, $data)
        {
            if(!is_dir("/tmp/CompanyName"))
                mkdir("/tmp/CompanyName");
           
            ob_start();
           
            echo 'Org' . $id . ' ';
           
            if(is_object($data))
            {
                echo "<pre>";
                print_r($data);
                echo "</pre>";
            }
            else
            {
                echo $data;
            }
           
            if($debug)
            {
                echo ob_get_clean();
            }
            else
            {
                file_put_contents("/tmp/CompanyName/cpm_organization_" . date("Ymd") . ".log", ob_get_clean(), FILE_APPEND);
            }
      
        }
    } // class organization_create


    /*
    The Test Harness
    */
    class organization_create_update_TestHarness implements RNCPM\ObjectEventHandler_TestHarness
    {
        static $org_invented = NULL;
        static $CN_invented = NULL;
     
        public static function setup()
        {
            //$CN = new RNCPHP\CompanyName\CN;
      $org = new RNCPHP\Organization;
            static::$org_invented = $org;
            //static::$CN_invented = $CN;
            return;
        }

        public static function
        fetchObject( $action, $object_type )
        {
            // Return the object that we
            // want to test with.
            // You could also return an array of objects
            // to test more than one variation of an object.
            //return(static::$CN_invented);
      return(static::$org_invented);
        }

        public static function
        validate( $action, $object )
        {
            #return(!is_null(static::$CN_invented->ID));
            return $object;
        }

        public static function cleanup()
        {
            // Destroy every object invented
            // by this test.
            // Not necessary since in test
            // mode and nothing is committed,
            // but good practice if only to
            // document the side effects of
            // this test.
            return;
        }
    }

     

    Thanks

    Earl Taylor

    Version:
    Feb 2018 version
  • Padma Prabha Varadarajan
    Query in REST API Call1
    Topic posted December 6, 2018 by Padma Prabha VaradarajanRed Ribbon: 250+ Points, tagged Connect PHP, Custom Process Models - CPMs, REST 
    Title:
    Query in REST API Call
    Summary:
    Querying Currency code menu in Custom Object
    Content:

    Hi 

    We have a custom object and standard object related, and created a currency menu object (Standard object: Currencies) in the custom object. 

    Trying to fetch the currency lookupname using ROQL from the custom object.

    But we are getting the error saying "Currency is not a valid object"

    Able to fetch only the Currency ID and not the lookupname. 

    Also, when we try to use this field in standard object and do the ROQL the lookupname is fetched without any issue.

    Please provide some idea on the same 

     

    Thanks 

    Padma

    Version:
    Service Cloud 18B, 18C
  • Lorna Rickett
    CPHP add new menu item2
    Topic posted November 29, 2018 by Lorna RickettSilver Trophy: 7,500+ Points, tagged Connect PHP, Custom Process Models - CPMs 
    Title:
    CPHP add new menu item
    Content:

    We have a requirement to show a dropdown menu in an incident workspace which has a list that changes. The list is part of a CO menu; so basically not everything in the CO menu but some of them depending on a different CO field. My idea was to build a new menu dynamically from a CPM when the CO was created/updated, and just show that menu in the workspace. However, I keep getting CPM errors saying I can’t create a new menu item.

    Is this possible and I’m just doing something wrong or is it not a possibility?

    If it’s not possible... does anyone have any wonderful suggestions to do this?! cool

    Version:
    18B, CP 3.7
  • Jonathan Doringuez
    API for Application Level Menus
    Topic posted November 16, 2018 by Jonathan DoringuezBlue Ribbon: 750+ Points, tagged Connect PHP, Custom Process Models - CPMs, REST, SOAP 
    Title:
    API for Application Level Menus
    Summary:
    Importing and Exporting Workspaces API
    Content:

    Did someone found something like the API's or the command line interface (CLI) for Service Cloud? CLI should be applicable to both AD and Portal for the purpose of automating the migration of files to higher environment.

    I'm also looking for a documentation about command line interface for Oracle Service Cloud (CLI), where can I find it? This is for both AD and Portal pages, API for importing and exporting workspace

    In addition where can I find the API equivalent for all the application level menus and buttons?

    Version:
    18C
  • Padma Prabha Varadarajan
    CSS in PHP1
    Topic posted November 11, 2018 by Padma Prabha VaradarajanRed Ribbon: 250+ Points, tagged Custom Process Models - CPMs 
    Title:
    CSS in PHP
    Summary:
    Fontawesome CSS Usage
    Content:

    Hi,

     

    I am using font awesome package in file manager script to format mail message for our requirement. 

    when I try to invoke this in mail API, the formatting is not being applied and I couldn't view the font awesome icons in my output. 

    Please help me on how to proceed on this.

     

    Thanks

    Padma

    Version:
    Oracle Service Cloud, 18C
  • Mohammed Shanab
    Integration Push Data from Oracle Service Cloud2
    Topic posted November 9, 2018 by Mohammed Shanab, tagged Connect PHP, Custom Process Models - CPMs, REST, SOAP 
    Title:
    Integration Push Data from Oracle Service Cloud
    Summary:
    How to call an API or push data into a queue on trigger of a data change
    Content:

    Hi,

    We would like to know if we could make an API call or push a message to a JMS queue on trigger of a data change so that we could propagate the change to other applications in the enterprise. We have a middleware which can expose an API or JMS stack. 

    The current implementation is a pull model where a poller regularly polls Oracle Service Cloud for a change via a watermark custom field which populated on a change. 

    Thanks

    Shanab

  • Muthulakshmi Muthaiah
    Validate a field whether it already exists or not and throw...1
    Topic posted October 9, 2018 by Muthulakshmi MuthaiahBronze Trophy: 5,000+ Points, tagged Connect PHP, Custom Process Models - CPMs, REST 
    Title:
    Validate a field whether it already exists or not and throw an error in contact object
    Summary:
    Validate a field whether it already exists or not and throw an error in contact object
    Content:

    Hi All,

    I need to validate a custom field value whether it exists or not in contact level object. For example, in OSvC we have a validation for an email address, like that I need to achieve it for the custom field. If the value already exists, then it throws the error message.

    Could you please help me how to achieve this validation in OSvC?

    Thanks,

    Muthulakshmi

  • Pramod Vasudeva Murthy
    Skype Integration with OSvC
    Topic posted October 7, 2018 by Pramod Vasudeva MurthyBlack Diamond: 60,000+ Points, tagged Connect PHP, Custom Process Models - CPMs, REST, SOAP 
    Title:
    Skype Integration with OSvC
    Summary:
    Skype embodiment in OSvC Agent Desktop
    Content:

    Hi All,

    I have a requirement to integrate OSvC and Skype. There are two ways to go with:

    • Using APIs: Though this more like OSvC Chat APIs, we need to setup our own UI/UX. This is a long, tedious but sure shot process that will yield results.
    • Using Bots: There is a bot API available, but this more of a intermediary as bot answers customer first and then links agent. This is modern, technology ahead and time consuming. And not to mention, there are quite a few unknowns ahead.

    Are there any Connectors available for this? If Yes, please recommend a few.

    Thanks,

    VIP

    Version:
    18C
  • Senthil Krish
    calling cp model (custome script) code from CPM1
    Topic posted June 13, 2016 by Senthil KrishRed Ribbon: 250+ Points, tagged Custom Process Models - CPMs 
    Title:
    calling cp model (custome script) code from CPM
    Content:

    All,

    Can I call a method in my model class written in customer portal (or custom scripts) from CPM script (as shown in the code block)?

    Thanks in advance. 

    Senthil K

     

     

    Version:
    service cloud Feb-2016
    Code Snippet:

Filter by Date

< < December 2019 > >
S M T W T F S
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        

Filter by Type