Legacy Dev Forum Posts

 View Only

Sign Up

Dynamics variable in script

  • 1.  Dynamics variable in script

    Posted 06-05-2025 19:15

    Lucas_POUILLY | 2023-10-08 19:50:07 UTC | #1

    Hello, I'm trying to format variable values in a specific format:

    In a script, I have my variable Sortant.CHAMPS_LIBRES_1 in the format string DD/MM/YYYY, and my variable Sortant.CHAMPS_LIBRES_2 in the format string HH:MM. I would like to have the following result in the variable RDV_FINAL: YYYY-MM-DDTHH:MM:SS+0200.

    I tried this, but it doesn't work:

    format(date({{Sortant.CHAMPSLIBRES1}}, 'DD/MM/YYYY'), 'YYYY-MM-DDTHH:mm:ssZ') + {{Sortant.CHAMPSLIBRES2}}

    Do you have any idea how to do this? Thank you.


    Artur_Dishunts | 2023-10-10 17:25:40 UTC | #2

    1. First of all, make it one string so it includes date and time.
    2. Then you have to convert that string to milliseconds using dateToMilliseconds({{your_var}}) function.
    3. Finally convert this to ISO format (I think this is the one you described) using formatDateISO() function.

    `formatDateISO(dateToMilliseconds({{date}}+{{time}}))`

    For more information use the link below: https://help.mypurecloud.com/articles/additional-functions-to-use-in-dynamic-variables/


    system | 2023-11-10 17:25:46 UTC | #3

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 22412