Hi,
I have to create a Dynamics Variable in a PureCloud Script that have the value of the Agent Call Start time + 1 hour
Thanks
Sergio
Hi,
I have to create a Dynamics Variable in a PureCloud Script that have the value of the Agent Call Start time + 1 hour
Thanks
Sergio
The only way I can think to do this is to use data actions to retrieve the conversation data and then do your calculation based on that.
Thanks Tim
Do you know If PureCloud Scripts support Dynamics Variables in Date format? Because I tought that I create a Dynamics Variable that store a new Date with scripter.AgentCalStartTime with some calculations
Thanks
Sergio
The API communicates dates in ISO-8601 format, so I assume it should be able to be parsed as a date variable. But I haven't tested it.
How Can I do calculation in my Custom Action?
I create the Custom Action from API: /api/v2/date to retrieve the current date/time
now I would do my calculation in "successTemplate" in the Custom Action
I checked this at https://help.mypurecloud.com/articles/velocity-macros-data-actions/#JavaStringMethods but I don't understand how modify the string to add 1 hour to current datetime variable
Thanks
Sergio
I apologize for the confusion here. This isn't as straightforward as I thought. I assumed scripts had the same types as Architect, but unfortunately, Scripts lack a DateTime data type (only string, number, boolean). Because of this, there's no way to do a calculation on the date. To get this data in a script, you have two options:
Ok, Thanks for your explanation
So I don't do date math in my custom action using
Java string method macros
Use Java string methods in Velocity templates to manipulate string variables, such as changing the case of a value or extracting a value from a string. For more information, see the Java documentation about Class String.In the following example, the toUpperCase() method converts the string value of variable $a to upper case. The split() method splits the variable $b into an array of strings. Variable $d concatenates values from variable $a, variable $b, and the first item in the array for variable $c.
Template example
#set($a = ${input1.string1} )
#set($a = $a.toUpperCase() )
#set($b = ${input1.string2} )
#set($c = $b.split("+") )
#set($d = "We are using ""${a}"" ""${b}"" ""$c[1]"" to render this." )
$d
Template example resultsInputs Resolved templates
input.string1 = value1input.string2 = value1+value2
We are using “VALUE1” “value1+value2” “value2” to render this.
Thanks
Sergio
@Jason_Mathison Do you have any thoughts on this? You're way better at the JSON path stuff than I am. Is it possible to do date math in a data action's config? Scripts can't handle it and looking for any solution to avoid adding a middleware component.
AFAIK there is no way to do what you are asking for in a successTemplate. The capabilities for the success template are all string manipulation. You could break a string apart or put strings together, but there is no concept of math or datetimes.
just out of curiosity, what is the end result you're looking for? You mention dynamics, which has the capabilities you're looking for built in (https://technet.microsoft.com/en-us/library/dn832103.aspx). If you're trying to schedule some task for an hour in the future, you could write the data time from PureCloud to a separate field recording when the original call took place, then use the calculated field to add the hour to that time.
Hi Richard, for this implementation I have to schedule a callback an hour in the future but I don't use Dynamics 365 for this.
I wanted retrieve the current date by api/v2/date, in the Custom Action calculate 1 hour in the future and store It in a variable. After I use this variable in scripter.createcallback.
Do you have any idea to do this?
Thanks
Sergio
Sorry, the title of your post lead me to believe you were attempting to do this with Microsoft Dynamics. Re-reading this thread, I see that was my mistake.
I don't believe there is a good way to do this with what is currently available. You might check to see if there are APIs that are available to calculate time in the future. This one seemed to fit the bill: https://www.programmableweb.com/api/chrono I'm sure there are other open APIs for determining the time (and manipulating it by some offset).
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.