Supported Methods in 3CX XML template?

Status
Not open for further replies.

paoloLac

Free User
Joined
Jan 22, 2021
Messages
51
Reaction score
8
Hi,

It is mentioned here https://www.3cx.com/docs/server-side-crm-template-xml-description that we can use Method invocation in the xml template. Can we use any C# methods and wrap it in square brackets? I am asking for we want to generate a timestamp in the outputs.

Thanks in advance!
You can use any method from the existing object. For example, the variable [Number] is a string, so you can use any method from System.String, for example:
[[Number].Replace("+","%2B")]

Or, the [CallStartTimeUTC] is a DateTime object, so you can use any method from System.DateTime, for example:
[[CallStartTimeUTC].ToString("yyyy-MM-dd")]

However, you can't execute any C# code there. Only methods applied to the objects returned by variables.

If you want to generate a timestamp, maybe you can do it based on the [CallStartTimeUTC] variable. For example, using the Ticks property:
[[[CallStartTimeUTC].get_Ticks()].ToString("F0")]

(please note that when using C# properties, the compiler generates a pair of get and set methods for it, that's why you need to use get_Ticks() instead of just Ticks)
 
Thanks @edossantos ! Got it. I think this is good for this ticket for now. :
)
 
  • Like
Reactions: edossantos
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
112,324
Messages
591,897
Members
165,475
Latest member
lastshadow