how to reflect a date extracted from json to a script

Dear, I have a problem to extract a string with a date inside a json to reflect it in a date / time input of a script, how can this process be done?

Hi 0989528c245897ad45e0,

Is this a string being returned by a Data Action?

What have you tried that hasn't worked?

--Jason

This can be done by binding a variable containing an ISO datetime string to the datetime input widget. Create a string variable like "DateTimeInputVar" below and select it as "Value" in the datetime widget settings.

You mention JSON so I assume this is coming from a Data Action. You'll need to create the Action first, then (for example) call the data action when a Button is pressed on the script. You'll need to enable "Data Action" in the Script properties too (the Data Action call is an optional script feature). Bind the output of the Data Action to the same variable that is bound to your datetime input.

I haven't done this in awhile so I made a quick example - see the script and data action linked below. The data action uses a mock endpoint that returns a static datetime string. The script has a button that uses the data action to GET the string. The string is saved in a variable displayed in both a datetime widget and a simple text field (added for testing).

image

the problem is a response that brings a json which is cunsume by a webservice that initiates session with a token which I manage through the integrations, actions and script of purecloud. In which the traspazo of the date field (string) is not reflected in the date / time entry (calendar), greetings

HI,

Can you provide an example of a JSON response, along with the data action and script that you are working on?

--Jason

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