Genesys Cloud - Main

 View Only

Sign Up

  • 1.  Only Future Dates Open Installments?

    Posted 20 days ago

     Scenario, the next installment information should play the OPEN status with the closest due date to the current date.
    I am receiving the following API array variables:

    Status (Array)

    DueDate (Array) – date format should be yyyy-MM-dd.

    I am a bit confused about how to compare the closest due date with the current date. Has anyone implemented this kind of scenario? Any ideas would be helpful.


    #ArchitectandDesign

    ------------------------------
    Srikanth k s
    ------------------------------


  • 2.  RE: Only Future Dates Open Installments?

    Posted 20 days ago

    Hello Srikanth, 

    One solution would be to implement a loop that iterates through your arrays and tracks the minimum data difference. 

    Cheers, 



    ------------------------------
    Cameron
    Online Community Manager/Moderator
    ------------------------------



  • 3.  RE: Only Future Dates Open Installments?

    Posted 6 days ago

    Hi Srikanth, 

    You can handle this by matching each Status with its DueDate using the same index array, then filtering only the OPEN items.

    Simple logic steps:

    1. Get today's date

    2. Loop through the arrays

    3. If Status = OPEN, check its DueDate

    4. Use DateTimeDiff to compare DueDate with today

    5. Keep the date with the smallest positive difference

    In Genesys Cloud, you can use DateTimeDiff like this:

    • DateTimeDiff(ToDateTime(DueDate[i]), GetCurrentDateTime(), "days")
      • You may need to augment the DueDate format to be compatible with the above logic, you can this within Genesys itself via updating the variables required. 

    This will return:

    • Positive number > future date

    • Zero > today

    • Negative number > past date

    So you can ignore negative values and from the remaining ones select the smallest value. That will give you the closest upcoming OPEN due date, even across month-end or year changes.



    ------------------------------
    Josh Coyle
    Senior Professional Services Consultant
    ------------------------------



  • 4.  RE: Only Future Dates Open Installments?

    Posted 2 days ago

    @Josh Coyle Thank you for explaining. I tried a similar method and achieved success. It was very helpful.



    ------------------------------
    Srikanth k s
    ------------------------------