Author Topic: JavaScript in IRD strategies?  (Read 3320 times)

Offline vma

  • Full Member
  • ***
  • Posts: 235
  • Karma: 0
JavaScript in IRD strategies?
« on: January 25, 2012, 12:42:34 AM »
Hi,

 Is there anyway to call a Javascript in an IRD strategy? I mean can I create a function in Javascript (or any other script) and then call this function from IRD?

Mihai

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 6759
  • Karma: 56332
Re: JavaScript in IRD strategies?
« Reply #1 on: January 25, 2012, 01:22:01 AM »
no way. What for?? Can't a WS do what you want?

Offline kubikle

  • Full Member
  • ***
  • Posts: 140
  • Karma: 7
Re: JavaScript in IRD strategies?
« Reply #2 on: January 25, 2012, 09:36:38 AM »
in 8.x if it is needed. But Javascript function must be presented as separate subroutine.

Offline AudraDenise

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
  • I like cooking.
Re: JavaScript in IRD strategies?
« Reply #3 on: January 25, 2012, 02:37:59 PM »
in 8.x if it is needed. But Javascript function must be presented as separate subroutine.

How can we present JavaScript function as separate subroutine?

Offline vma

  • Full Member
  • ***
  • Posts: 235
  • Karma: 0
Re: JavaScript in IRD strategies?
« Reply #4 on: January 25, 2012, 04:30:45 PM »
My client has a connection to the data base that I don't really understand and I'm not sure I can do this from IRD. We were provided a server name and a port where we have to send an xml and we should receive back another xml with the needed data from the DB.
The only way I see is doing this with a JS or any other scripts.

Mihai
« Last Edit: January 25, 2012, 04:44:17 PM by vma »

Offline smile

  • Sr. Member
  • ****
  • Posts: 286
  • Karma: 6
Re: JavaScript in IRD strategies?
« Reply #5 on: January 25, 2012, 06:24:25 PM »
My client has a connection to the data base that I don't really understand and I'm not sure I can do this from IRD. We were provided a server name and a port where we have to send an xml and we should receive back another xml with the needed data from the DB.
The only way I see is doing this with a JS or any other scripts.

Mihai

imho the most simplest way is using something like "web services proxy", which will take connection from Genesys via SOAP, then execute request to customer backend (in any suitable format) and after that send response via soap to URS.
or another way is using custom server.
of course you can use orchestration in 8 release, so you can use even vb script...
With best regards and so on

Offline kubikle

  • Full Member
  • ***
  • Posts: 140
  • Karma: 7
Re: JavaScript in IRD strategies?
« Reply #6 on: January 26, 2012, 02:17:17 PM »
Ecma script in URS can be used for example if in CME in IRD application inOoptions in section default option 'tools_tuneup' set to value 'extended' (the same as for old 5.x Strategy Builder). Then IRD will allow creating of scripts that could be loaded on RP or invoked from other strategies with CallStrategy[ScriptName].

It will not help with described task however - script is execyed by URS and it is not able to do anything above URS able to do.The ways URS contact outside world: Custom server, DB server, HTTP(SOAP), HTTP(REST).

Orchestration platform in that respect changes nothing - even though it can run Ecma scriptts the only way it contacts outside world- HTTP (REST).

Smile is right I believe and only way it is using some sort of HTTP proxy (if client server doesn't have direct HTTP connection) or Custom server.


Offline enna

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Re: JavaScript in IRD strategies?
« Reply #7 on: March 24, 2017, 02:54:44 AM »
Hello,

It's too late, but after spending few time of searching and testing I've found how to call JavaScript / EcmaScript from the routing strategy, and it's interesting to share this with you (Unfortunately! no genesys documentation about how!!!!)

First, the JS / ES code must be prepared in a MACRO inside IRD as "complex macro". The macro can be defined with input parameters and , in the other side the result can be retrieved by using "ReturnData []" function juste after the macro bloc in routing strategy.

Here is an example JS which validates a regular expression on string and returns OK or KO according to the match of RegExp:
- Macro Definition

http://i64.tinypic.com/14o189d.jpg


- Strategy Integration

http://i67.tinypic.com/28qxil3.jpg

- Here URS logs:
18:05:31.807_I_I_350b029c2f5bd1f5 [09:05] >>>>>>>>>>>>resume interp(0), func:CallStrategy
    _I_I_350b029c2f5bd1f5 [09:04] ASSIGN: var_exp(LOCAL) <- STRING: "^[123]$"
    _I_I_350b029c2f5bd1f5 [09:04] ASSIGN: var_value(LOCAL) <- STRING: "2"
18:05:31.807_I_I_350b029c2f5bd1f5 [07:48] func will be continued(0,0000000031600006)
18:05:31.807_I_I_350b029c2f5bd1f5 [09:04] <<<<<<<<<<<<suspend interp(JUMPING), func:CallStrategy timers:00001
18:05:31.807_I_I_350b029c2f5bd1f5 [07:49] func is continued(0,0000000031600006)
    _I_I_350b029c2f5bd1f5 [07:43] call strategy *0x1*(TRAN-22)macroRegExp (level=2, crc=3774866085)
18:05:31.807_I_I_350b029c2f5bd1f5 [09:06] >>>>>>>>>>>>start interp()
    _I_I_350b029c2f5bd1f5 [07:46] no error mode for this call
    _I_I_350b029c2f5bd1f5 [09:04] ASSIGN: v:0:this(LOCAL) <- OBJECT:0000000001B8DBF0[Global]={"Class":"Global"}
    _I_I_350b029c2f5bd1f5 [09:04] ASSIGN: v:0:in_exp(LOCAL) <- STRING: "^[123]$"
    _I_I_350b029c2f5bd1f5 [09:04] ASSIGN: v:0:in_value(LOCAL) <- STRING: "2"
    _I_I_350b029c2f5bd1f5 [09:04] ASSIGN: v:0:regex(LOCAL) <- OBJECT:0000000002E4DB60[RegExp]={"source":"^[123]$","global":false,"ignoreCase":false,"multiline":false,"lastIndex":0}
    _I_I_350b029c2f5bd1f5 [09:04] ASSIGN: v:0:resultat(LOCAL) <- STRING: "OK"
18:05:31.807_I_I_350b029c2f5bd1f5 [07:48] func will be continued(0,0000000005600012)
18:05:31.807_I_I_350b029c2f5bd1f5 [09:04] <<<<<<<<<<<<suspend interp(JUMPING), func:ReturnEx timers:00001
18:05:31.807_I_I_350b029c2f5bd1f5 [07:49] func is continued(0,0000000005600012)
    _I_I_350b029c2f5bd1f5 [07:44] return to strategy *0x1*IXN_E-mail Pre-Route (level=1, crc=68874202)
18:05:31.807_I_I_350b029c2f5bd1f5 [09:05] >>>>>>>>>>>>resume interp(0), func:CallStrategy
    _I_I_350b029c2f5bd1f5 [09:04] ASSIGN: var_trace(LOCAL) <- STRING: "OK"


Offline antoni

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Re: JavaScript in IRD strategies?
« Reply #8 on: December 04, 2018, 06:07:44 AM »
Thank you very much!!
--
antoni