Genesys Cloud - Developer Community!

 View Only

Sign Up

Expand all | Collapse all

Add Number to DNC from Script

  • 1.  Add Number to DNC from Script

    Posted 08-07-2025 02:20

    Hi all,

    i have an outbound campaign, Preview, i have a button on my script to insert a number into a DNC list, this all works fine, but how can i include the ExpirationDateTime into the button to insert? Need to insert number together with current date and time + 24 as ExpirationDateTime. Required format of date and time to insert is - yyyy-MM-ddTHH:mmZ


    #Implementation

    ------------------------------
    Reginald
    ------------------------------


  • 2.  RE: Add Number to DNC from Script

    Posted 08-07-2025 09:35

    Hi Reginald,

    I am going to move this to the Genesys Cloud Developer Community to see if they can help you with this.



    ------------------------------
    Sam Jillard
    Online Community Manager/Moderator
    Genesys - Employees
    ------------------------------



  • 3.  RE: Add Number to DNC from Script

    Posted 08-07-2025 09:39

    Thanks Samuel



    ------------------------------
    Reginald
    ------------------------------



  • 4.  RE: Add Number to DNC from Script

    Posted 08-08-2025 02:32

    Hi Reginald,

    in core your question is about adding dates, correct? Please take a look into this documentation: Additional functions to use in dynamic variables - Genesys Cloud Resource Center under "Date Functions" is erverything you need. For the current date time you can use 

    {{Scripter.Customer Call Start Time}}

    Please note some problems occuring with that:

    a) different time zones from the server time. Under some circumstances you will have to add / substract the difference to your timezone. If you are talking about 24 days some hours should make no difference.

    b) script language affects time format. If you encounter strange problems with adding times this could be the case.



    ------------------------------
    Christoph Domaschke
    Leiter Service Center (Cronbank)
    ------------------------------



  • 5.  RE: Add Number to DNC from Script

    Posted 08-08-2025 02:41

    Hi Christoph, yes it is to add Expiration date to the DNC List, i look at Script functions and the built in script option, the problem is the format the date is in, DNC List requires the date in this format yyyy-MM-ddTHH:mmZ



    ------------------------------
    Reginald
    ------------------------------



  • 6.  RE: Add Number to DNC from Script

    Posted 08-08-2025 02:45

    Hi Reginald,
    please have a look in the documentation i linked. There a various options to manipulate the format. (formatDate()-Function)



    ------------------------------
    Christoph Domaschke
    Leiter Service Center (Cronbank)
    ------------------------------



  • 7.  RE: Add Number to DNC from Script

    Posted 08-08-2025 03:10

    hi thanks, just need assistance and guidance to get the date format from 

    08/08/2025 9:07:26 am (+02:00) to yyyy-MM-ddTHH:mmZ


    ------------------------------
    Reginald
    ------------------------------



  • 8.  RE: Add Number to DNC from Script
    Best Answer

    Posted 08-08-2025 03:25

    Hi Reginald,

    understood. Please have a closer look under formatDateISO(date) and dateToMilliseconds(date) in the documentation. A combination of both should work.

    Without having tried this out: formatDateISO(dateToMilliseconds({{Scripter.Customer Call Start Time}}) + 2 * 60 * 60 * 1000) should to the trick.

    In case you have a switch between summertime and wintertime you will have to finde a solution for that, too. For my case that was precise enough.



    ------------------------------
    Christoph Domaschke
    Leiter Service Center (Cronbank)
    ------------------------------



  • 9.  RE: Add Number to DNC from Script

    Posted 08-08-2025 04:11

    thanks for your assistance Christoph, the below did the trick

    slice(formatDateISO(dateToMilliseconds({{Scripter.Customer Call Start Time}}) + 0 * 60 * 60 * 1000), 0, 16)+"Z"



    ------------------------------
    Reginald
    ------------------------------



  • 10.  RE: Add Number to DNC from Script

    Posted 08-11-2025 08:42
    Edited by Christian Karpp 08-11-2025 08:43

    Btw, when these expressions become more complex, it can be helpful to use additional variables inside the expressions: 
    s = dateToMilliseconds( {{Scripter.Customer Call Start Time}} );
    d = durationToMilliseconds( {{Scripter.Customer Call Duration}} );

    formatDateISO( s + d ) 



    ------------------------------
    Christian Karpp
    Principal Implementation Consultant
    ------------------------------



  • 11.  RE: Add Number to DNC from Script

    Posted 08-12-2025 04:45

    I'm using a Workflow to add the data into the DNC table

    The Data Action looks like this:
    {
       "flowId": "9f169196-fd64-462b-a2ef-e9a6a6334969",
       "inputData": {
          "Flow.inPhone1" : "${input.Phone1}",
          "Flow.inPhone2" : "${input.Phone2}",
          "Flow.inPhone3" : "${input.Phone3}",
          "Flow.inDNCListID":"2a5bfc87-f1ab-4235-84e3-8557c8cb391a"}
    }

    The Workflow contains one toolstep to calls a second Data Action which insert the expiration time:
    Left(ToString(AddHours(GetCurrentDateTimeUtc(),12)),16) + "Z"

    Inputs are:
    DNCListId:  Flow.inDNCListID  (bottom line first DA)
    Expiration DateTime:  Left(ToString(AddHours(GetCurrentDateTimeUtc(),12)),16) + "Z"
    Phone1: Flow.inPhone1
    Phone2: Flow.inPhone2

    Phone3: Flow.inPhone3

    We use a 12 hour and 72 hour window based on specific regulation conditions.
     



    ------------------------------
    Ruud Reinold
    BNP Paribas Personal Finance UK
    ------------------------------