This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Time period ticket custom field with API

I built a frontend for our ticket system that allows the categories to be searched textually as the dropdown system wasn't cutting it for our clients.  There is a custom ticket field of the type Time Period that I can't seem to handle.

- source code in the assist page for the dropdown refers the the units of time as id 0-5 for mins, hrs, days, weeks, months, years

- the api returns the duration as a number and the unit as the textual representation

- the database stores the duration as a float and the unit as a float(appears to be 0.0000-5.0000)

Could someone point me in the right direction as to what JSON to use to update this field?  I've tried every combination I could think of but have only had success with updated the duration field and not the unit field. 

Thank in advance,

Jerry

  • It's minutes in case someone else runs across this.  The PHP code below will provide a suitable value that can be passed to the api.

    $duration = $value[0];
    if ($value[1] == 0) {
      //min
      $amount = $duration;
    } elseif ($value[1] == 1) {
      //hr
      $amount = $duration * 60;
    } elseif ($value[1] == 2) {
      //day
      $amount = $duration * 1440;
    } elseif ($value[1] == 3) {
      //week
      $amount = $duration * 10080;
    } elseif ($value[1] == 4) {
      //month
      $amount = $duration * 43829;
    } elseif ($value[1] == 5) {
      //year
      $amount = $duration * 525948;


    }