Customer Portal

Get Involved. Join the Conversation.

Topic

    Scott Heidenreich
    Allow Customer to delete a task
    Topic posted June 11, 2019 by Scott HeidenreichBronze Trophy: 5,000+ Points 
    52 Views, 8 Comments
    Title:
    Allow Customer to delete a task
    Summary:
    Surface delete capability to customer using a report in CP
    Content:

    Hello,

    I have a report that shows a logged in contact a list of tasks assigned to the contact.  This report is surfaced in the customer portal.  I want to give the contact the ability to delete tasks they are no longer interested in doing.  When I add a delete link to the report in OSvC, it doesn't surface on the customer portal through the Grid widget.

    How do I allow a logged in contact to delete a task from the list? or even mark it for deletion, so I can filter it out of the report?

    Thanks,

    Scott

    Version:
    18D

    Comment

     

    • Sristy Arya

      Hi Scott,

      You can create an array of the Tasks & Delete them .

      User can select each task(checkbox) & delete / destroy the Task.

       

      if (isset($mytaskchk[0])) {
                 for ($i = 0; $i < count($mytaskchk); $i++) {
                   $task_id = $mytaskchk[$i];
                   $task = RightNow\Connect\v1_2\Task::fetch($task_id);
      $task->destroy();
                   echo "Task Object having ID {$task_id} is destroyed";
      }
      }
       
       
      Where task_arr contains all the tasks of the logged in agent fetched from report.
      <?php
       
      for ($i = 0; $i < count($task_arr); $i++) 
      {
      ?>
       <input type="checkbox" name="mytaskchk[]" id="mytaskchk_<?php echo $i; ?>" value="<?= $task_arr[$i]['Task ID']; ?>"  /
      <?php
      }
      ?>
       
      Thanks
      Sristy
    • Scott Heidenreich

      Thank you for the coding - how do I implement it?  Is this something that is a custom process, a custom script in the report, embedded in a widget, or put on a customer portal php page?

      • Sristy Arya

        Hi Scott,

        You can put the same on CP page which lists all the tasks of the logged in user.

         

        Thanks

        Sristy

    • Scott Heidenreich

      Ok. Thank you, I will try it.  I noticed there is a version identified for RightNow\Connect

      Does that mean I have to update that version each time Oracle does?

    • Scott Heidenreich

      Hi, I tried using the code, but it I couldn't get it to work.  I put it into the view.php page for the widget that manages the display of the logged in user's tasks.  On that view.php is a call to the reports/Grid widget that loads the report showing the logged in user's tasks.

      Thanks for trying.  I appreciate it.

    • Tushar Gupta
      Hi Scott, You can do this in two ways: 1.) Do it completely with the Connect PHP API without the standard Grid widget 2.) Or extend the standard Grid Widget and make the changes in the Controller of that widget along with the view and logic.js files. Thanks
    • Scott Heidenreich

      Hi Tushar,  If I extend a widget - is it to allow the native delete link function from the OSvC report to surface through the grid, or to create a different delete function in the widget itself?

      • Tushar Gupta

        It is not native to the existing Grid Widget.

        I have also made a similar functionality where I was editing multiple Incidents at one go using the checkbox column against each Object (Incident in my case).

        Similarly, you can delete multiple Tasks. Also, perform other actions if you want to do.