Comments

  • Rasheed Ahamed

    You can convert the data into base64 and send in the request like this.

    {
    "answerType": {
        "id": 1
        },
    "language": {
        "id": 1
        },
    "solution": "The FishPhone is water resistant to 10 meters, or 33 feet.",
    "fileAttachments": [
        {
          "fileName": " SampleFileAttachment.txt ",
          "data": " c2FtcGxlIGNvbnRlbnQgZm9yIGZpbGUgYXR0YWNobWVudA=="
        }
      ],
    "summary": "How deep can I get my FishPhone?"
    }

     

     

  • Rasheed Ahamed

    Hi,

    I think you can delete them using Custom Script. Here instead of Incident object you can try giving your Custom Object path.
     

    <html>
    <head>
    <title>Delete Incident Records</title>
    </head>
    <body>
    <form method="post">
    <label>Enter Incident ID from <label/><input type="text" name="from"/><label> To </label><input type="text" name="to"/><label> <label>Delete Incidents</label><br/>
    <input type="submit" name="submit"/><br/>
    </form>
    </body>
    </html>
     
    <?php
    require_once(get_cfg_var("doc_root") . "/ConnectPHP/Connect_init.php");
    use RightNow\Connect\v1_2 as RNCPHP;
    initConnectAPI("username","password");
     
    if(isset($_POST['submit']))
    {
    $from = $_POST['from'];
    $to = $_POST['to'];
     
    for($i=$from;$i<=$to;$i++)
    {
       $incident = RNCPHP\Incident::fetch($i);
       $incident->destroy();
       RNCPHP\ConnectAPI::commit();
       echo "<br/>";
       echo("Incident Deleted with ID -> ".$i);
       echo "<br/>";
    }
    }
    ?>
  • Rasheed Ahamed

    Hi Jens,

    Thanks for your valuable advice, we had to solve this through the Add-In (BUI Extension) and  by setting hidden fields as flags and wrote workspace rules when the named event fires based on the value  fetched from Organization custom field.

    Thanks,
    Rasheed

  • Rasheed Ahamed

    Thanks a ton, Mary and Sebastiaan. If not for me, I'm sure your solutions will greatly be helpful to someone else.
    But I got my issue resolved by OSvC Tech Support team. Here is what they have suggested and it worked like a charm for me. 

  • Rasheed Ahamed

    Hi Mary and Sebastiaan,

    I have tried the above steps and no luck. Also the strange fact is that we do not have any Add-ins in this brand-new production interface. So, I'm more confused now that when there are no Add-Ins in the instance, how can it show the error is because of Add-In.

    Thanks,
    Rasheed

  • Rasheed Ahamed

    No Sebastiaan, I have neither checked the Execute Asynchronously checkbox nor the Can Suppress checkbox.
    I can share my CPM codebase here, in case if you wanted to try on this use case. Kindly let me know the results if you tried. 
    Note: If in case you/anyone wanted to try this. Create two custom text fields with this column names selected_product_level and selected_category_level.

     

    <?php
    /*
    * CPMObjectEventHandler: incident_handler
    * Package: RN
    * Objects: Incident
    * Actions: Create, Update
    * Version: 1.3
    * Purpose: On Save, System stores the product category hierarchy in 2 CustomFields which will be used in Message Template.
    * Author : Rasheed Ahamed 
    */
     
    // This object procedure binds to v1_3 of the Connect PHP API
    use \RightNow\Connect\v1_3 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 incident_handler implements RNCPM\ObjectEventHandler{
     
        public static function apply( $run_mode, $action, $obj, $n_cycles )
        {
            if($n_cycles>1) return false;
            try{                
                    $prodName = $obj->Product->LookupName;
                    $catName = $obj->Category->LookupName;
     
    echo "<pre>";
    $lastProdLevel = $obj->Product->LookupName;
    $numberOfProducts = count($obj->Product->ProductHierarchy);
    $productHierarchy = "";
    for($i=0; $i<$numberOfProducts; $i++)
    {
    $productHierarchy = $productHierarchy.$obj->Product->ProductHierarchy[$i]->LookupName;
    $productHierarchy = $productHierarchy." > ";
    }
    $productHierarchy = $productHierarchy.$lastProdLevel;
    print_r($productHierarchy);
    $obj->CustomFields->c->selected_product_level = $productHierarchy;
     
     
    echo "<pre>";
    $lastCatLevel = $obj->Category->LookupName;
    $numberOfCategories = count($obj->Category->CategoryHierarchy);
    $categoryHierarchy = "";
    for($i=0; $i<$numberOfCategories; $i++)
    {
    $categoryHierarchy = $categoryHierarchy.$obj->Category->CategoryHierarchy[$i]->LookupName;
    $categoryHierarchy = $categoryHierarchy." > ";
    }
    $categoryHierarchy = $categoryHierarchy.$lastCatLevel;
    print_r($categoryHierarchy);
    $obj->CustomFields->c->selected_category_level = $categoryHierarchy;
     
     
     
                    $obj->save();
                    echo "Incident ID : ".$obj->ID;
                    echo "Incident Product : ".$obj->CustomFields->c->selected_product_level;
    echo "Incident Category : ".$obj->CustomFields->c->selected_category_level;                
                }
                catch(Exception $err)
                {
                    print_r($err);
                }
            return;
        } // apply()
     
     
     
    /*
    The Test Harness
    */
     
     
    class incident_handler_TestHarness implements RNCPM\ObjectEventHandler_TestHarness
    {
        static $con_invented = NULL;
     
        public static function setup()
        {
            try{
                $incident = new RNCPHP\Incident(); 
                $incident->PrimaryContact = RNCPHP\Contact::fetch(31);
                $incident->Subject = "Incident Created By Test Harness Method";        
                $incident->Product =  RNCPHP\ServiceProduct::fetch(113);        
                $incident->Category = RNCPHP\ServiceCategory::fetch(32);
                //$incident->CustomFields->c->fault_type->ID = 755;
                $incident->save();
                // $inc->save(RNCPHP\RNObject::SuppressAll);
            }
            catch(Exception $err){
                echo $err;
            }
     
            static::$con_invented = $incident;
            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.$incident
            return(static::$con_invented);
        }
     
        public static function validate( $action, $object ){
        // Add one note.
        return true;
        }
     
        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.
        static::$con_invented->destroy().
        static::$con_invented = NULL;
        return;
        }
    }
  • Rasheed Ahamed

    Yeah, it looks like this..

  • Rasheed Ahamed

    Hi Sebastiaan, 

    I have removed the event handler and triggered it from Business Rules and kept it in first place still I could not see the product category hierarchy in the email.
    PFA Rule Screenshot. Please let me know if there are changes required in the rule condition.

  • Rasheed Ahamed

    Hi Sebastiaan,

    I created two custom text fields and wrote a CPM which will store the product and category hierarchy data in the respected fields on Incident Save. It is working fine, I previewed it in the Message Template and I tested it by adding those fields to the Workspace. But however in the e-mail, I got the product, category as empty values. I think it is because of the reason that e-mail is triggered first and then the CPM runs and sets the value so in the e-mail I'm getting the empty values. Kindly share your thoughts on any workaround in this case.

    Thanks,
    Rasheed.

  • Rasheed Ahamed

    Hi Sebastiaan,
    Thanks for taking time and writing such a detailed comment sir. Appreciate it. Currently Access Level is something which haven't came into picture. For some reason the client's business architecture is in such a way that they have to consider every building in which their services has been provided/installed as a separate Organization. So the number of Organizations that will be created inside Service Cloud will be huge (approx 3352404). The total no.of SLAs is approximately 10. So the current ask is that SLAs has to be applied at Org Level which means Incidents created for that Org should have the same SLA instance as per the Org. How to write Incident rule to apply SLA instance for this many number of Organizations. As I mentioned in my point #3 taking up Org.Name in the IF condition doesn't seem to be a right approach for me. Any inputs from you will help me paint a clear picture.
    Thanks,
    Rasheed

  • Rasheed Ahamed

    With regard to that, when I create a new SLA and assign it to the Organization, I know the Contacts of that Organization will be inheriting the same, but I'm not seeing the same at the SLA Instance field in the Incidents created by the Contacts of that Organization.

  • Rasheed Ahamed

    Are you able to see this kind of popup when you try to delete an SLA?
    If you select Yes then that SLA will be permanently deleted.
     

  • Rasheed Ahamed

    This issue has been identified as a product bug.
    PFA

  • Rasheed Ahamed

    Hi Tushar, 

    Thanks for your input. Two things to understand here.
    1.While opening an old Incident, I don't want to run this script. In old incidents case I just wanted to open the Incident Workspace directly which I have done in the Workflow. PFA
    2.This script will be running only when a New Incident is created. For me, in the Agent Desktop when I choose a contact, the FirstName displays and when I change to different contact also, the corresponding name displaying and the report data is changing which is the expected behavior. But this thing is not working in the BUI. That is the issue. Let me know if there is any AgentScript Rule that I'm missing.

    Thanks,
    Rasheed

  • Rasheed Ahamed

    No. You cannot copy an existing SLA. It is also not recommended. Best Practice is to create a new SLA with proper Response Requirements settings.

    Thanks,
    Rasheed.