General Technical Discussions for Service

Get Involved. Join the Conversation.

Comments

  • Varun Chandran

    Hi Suresh,

    If you are sending it to a Contact associated with RN, we have a standard functionality for it. You can use,

    RNCPHP\Mailing::SendMailingToContact(Contact, Incident_or_Opportunity, Mailing, ScheduledTime)

    Contact - Valid Contact object
    Incident_or_Opportunity - The Incident or Opportunity object that the mailing or survey should be sent for.
    Mailing - The id of the mailing that needs to be sent to the customer.
    ScheduledTime - The time at which the mailing needs to be sent out to the provided contact. This field needs to be in Unix Epoch time.

    Hope this helps.

    Regards,

    Varun

  • Scott Harwell

    If you omit the 5 lines above  $org->CustomFields->c->eligible_future_vacan = 0; then does that help?

    I think $org->CustomFields->c = new $md2->c->type_name; would need to be $org->CustomFields = new $md2->c->type_name; if you chose to instantiate the custom field object.  But, the organization object should have a CustomFields object since you are retrieving an existing record.  So, I think your assignment of a new custom fields object to $org->CustomFields->c is the cause of the issue.

  • Mark Bradley

    <?

    /*
    * CPMObjectEventHandler: progresscall_update
    * Package: CO2
    * Objects: CO2\ProgressCall
    * Actions: Update
    * Version: 1.0
    */

    // 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;

    class progresscall_update
    implements RNCPM\ObjectEventHandler
    {
      public static function
      apply( $run_mode, $action, $obj, $n_cycles )
      {
        try
        {
          $org = RNCPHP\Organization::Fetch( $obj->Application1->Organization->ID );
          
          progresscall_update::sustainable_job_offer($obj, $org);
          
        }
        catch (Exception $err) {
          print_r($err->getCode());
          print_r($err->getMessage());
        }
        return;
      }
     
      public static function
      sustainable_job_offer($obj, $org)
      {
        $progcal_prev = $obj->prev;
        $sustainable_prev = $obj->prev->Sustainable;
        $sustainable_new = $obj->Sustainable;
            
        if (( $sustainable_new != $sustainable_prev) && ($sustainable_new == 1)) {
          try
          {
            $md = $org::getMetadata();
            $cf_type_name = $md->CustomFields->type_name;
            $md2 = $cf_type_name::getMetadata();
            $org->CustomFields->c = new $md2->c->type_name;
            
            $org->CustomFields->c->eligible_future_vacan = 0;
            $org->save(RNCPHP\RNObject::SuppressAll);
          }
          catch (Exception $err) {
            print_r($err->getCode());
            print_r($err->getMessage());
          }
        }
        return;
      }
    }

    /*
    The Test Harness
    */


    class progresscall_update_TestHarness
    implements RNCPM\ObjectEventHandler_TestHarness
    {
      static $progresscall_invented = NULL;

      public static function setup()
      {
        $progresscall = new RNCPHP\CO2\ProgressCall;
        $application = RNCPHP\CO\Application::Fetch(1);
        $vacancy = RNCPHP\CO\Vacancy::Fetch(91);

        $application->Vacancy = $vacancy;
       
        $progresscall->Application1 = $application;
        $progresscall->Sustainable = 2;

        static::$progresscall_invented = $progresscall;
        return;
      }

      public static function
      fetchObject( $action, $object_type )
      {
        return(static::$progresscall_invented);
      }

      public static function
      validate( $action, $object )
      {
        $progresscall_invented->Sustainable = 1;
        return(static::$progresscall_invented);
      }

      public static function cleanup()
      {    
        return;
      }
    }

  • Mark Rhoads

    Do you mind sharing with us (or just me via email) an export of the entire custom process, including all handlers/scripts and mappings (use the export feature of the Process Designer)?

  • Alagappan Dhakshinamoorthy

    Hi Kevin,

    I believe this was the way it is working from the initial release of custom processes.

    Thanks,

    Alagappan

  • Mark Bradley

    Thanks for the response.

    I dont think there is an update recursion here. I should have mentioned that the Custom Process is indeed an update but it is attached to a Custom Object and not to Organization. I tested the SupressAll regardless but unfortunately still no joy.

    Also, Ive checked the logs and there is nothing in them.

    Any other suggestions?

  • Mark Rhoads

    If this is attached to an update event then most likely the handler is failing because the save() is inducing update-event recursion.  The handler does not handle this recursion within the limit (a max depth of 5) and so it is failed.  There's probably some error messages in the info log.

    Instead, pass RNCPHP\RNObject::SuppressAll to the save() method, or have the handler test $n_cycles parameter on the apply() method.

     

  • Kevin Browne

    Hi Alagappan,

    Thanks to you (and to Mark) for the reply, much appreciated.  I have a quick followup question.  To your knowledge, is this the way it has worked all along with Custom Processes or was this changed at some point after the initial release of the Custom Processes feature.  I'm curious if we will see this with all versions of the product to-date.

    Thanks,

    Kevin

  • Alagappan Dhakshinamoorthy

    Hi Kevin,

    I am able to see 1 workaround for this behavior by following the steps below.

    1. Making a change on the contact object.

    2. Save the object.

    3. Then call ConnectAPI::rollback()

    4. Refetch the contact object and then try retrieve all the custom fields of the contact object.

    Thanks to Mark Rhoads for this workaround...

    Another workaround is to retrieve the required custom fields specifically using ROQL query as in the forum post you mentioned above.

    Regards

    Alagappan

     

     

     

     

  • bin xiong

    Oh, It is an internal site provide by others.

    Somebody mentioned I can do it through HMS, can I transfer to HMS from the admin URL?

  • Bhagwan Singh Mer

    No. You will have to reach out to Oracle.Is it a live site or demo instance?

  • bin xiong

    You meant I can not have this module enabled through the admin console?

  • Bhagwan Singh Mer

    No. You need to first have this module enabled in your instance. The config URL you are pointing to will come later i.e. post enable

  • bin xiong

    Thank you for you reply! But can I set this by myself? I found these configs in RightNow, do you mean the value of "ATG_INTEGRATION_CSC_URL"?

  • Bhagwan Singh Mer

    ATG Commerce Service Center (CSC) must be enabled. You will have to contact your Oracle account manager.