This is a public Forum  publicRSS


    Dheeraj Eshwar Bangera
    Delete Contact SLAs using Connect PHP
    Topic posted July 11, 2018 by Dheeraj Eshwar BangeraExplorer 
    64 Views, 2 Comments
    Delete Contact SLAs using Connect PHP

    I am using Connect PHP to Update SLAs on a Contact record and the sequence of steps are -

    1. Delete the existing SLAs on the Contact record (function - deleteSLAInstance)
    2. Associate the new set of SLAs to the Contact record (function - saveSLAInstance)

    The functions used in the above two steps are provided for reference.

    The SLA Delete and new SLA association works as expected but I see that the Array Index of SLAInstances keeps growing and is not re-set on deleting the SLAs (using offsetUnset). See attached screenshot (Contact_SLAInstances.JPG).

    Is this the expected behavior? Can the Delete function be modified so that the SLAInstances is re-set to the initial state i.e. with no Array elements.


    Code Block:



    • Allan Schrum

      Yes. The old SLAInstance objects are in an expired / invalid state when "deleted" but remain as a reference for those objects created that used those SLAInstances. I agree it complicates things a bit in that the old ones hang around. What would you suggest as a better way to manage these invalidated instances? Perhaps move them to a Contact->ServiceSettings->InvalidatedSLAInstances?

      Or is protecting the history of the old SLAInstances and how they are used not important?



    • Dheeraj Eshwar Bangera

      Thanks for the response, Allan.

      History of SLAs is not important for us. SLA that is currently Expired (or Inactive) can be associated back to the same Contact at a later point in time.

      I was thinking of tweaking the approach to -

      Match the new SLA to the existing SLAs associated to the Contact (irrespective of their State), based on the SLAName.

      a. If Match Found - On the SLA Instance, update State to "Active" and ActiveDate to Today(). So the Expired/Inactive SLA Instance becomes Active.
      b. If no Match Found - Associate the new SLA to the Contact record i.e. create a new SLA Instance record.

      Can you please provide me some guidance on how I can check if an SLA is already associated to a Contact, using a connect PHP script.