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

Offline vma

  • Sr. Member
  • ****
  • Posts: 255
  • Karma: 0
JavaScript in IRD strategies?
« on: January 24, 2012, 03:42:34 PM »
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: 7636
  • Karma: 56330
Re: JavaScript in IRD strategies?
« Reply #1 on: January 24, 2012, 04:22:01 PM »
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, 12: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, 05:37:59 AM »
[quote author=kubikle link=topic=6910.msg30022#msg30022 date=1327451798]
in 8.x if it is needed. But Javascript function must be presented as separate subroutine.
[/quote]

How can we present JavaScript function as separate subroutine?

Offline vma

  • Sr. Member
  • ****
  • Posts: 255
  • Karma: 0
Re: JavaScript in IRD strategies?
« Reply #4 on: January 25, 2012, 07:30:45 AM »
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, 07:44:17 AM by vma »

Offline smile

  • Sr. Member
  • ****
  • Posts: 286
  • Karma: 6
Re: JavaScript in IRD strategies?
« Reply #5 on: January 25, 2012, 09:24:25 AM »
[quote author=vma link=topic=6910.msg30025#msg30025 date=1327476645]
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
[/quote]

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...

Offline kubikle

  • Full Member
  • ***
  • Posts: 140
  • Karma: 7
Re: JavaScript in IRD strategies?
« Reply #6 on: January 26, 2012, 05:17:17 AM »
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: 1
Re: JavaScript in IRD strategies?
« Reply #7 on: March 23, 2017, 05:54:44 PM »
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:
[b]- Macro Definition[/b]
[img width=640 height=407]http://i64.tinypic.com/14o189d.jpg[/img]
[url=http://i64.tinypic.com/14o189d.jpg]http://i64.tinypic.com/14o189d.jpg [/url]


[b]- Strategy Integration[/b]
[img width=404 height=480]http://i67.tinypic.com/28qxil3.jpg[/img]
[url=http://i67.tinypic.com/28qxil3.jpg]http://i67.tinypic.com/28qxil3.jpg [/url]

[b]- Here URS logs:[/b]
[table]
[tr]
[td]
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"
[/td]
[/tr]
[/table]


Offline antoni

  • Newbie
  • *
  • Posts: 6
  • Karma: 0
Re: JavaScript in IRD strategies?
« Reply #8 on: December 03, 2018, 09:07:44 PM »
Thank you very much!!
I took a screenshot of the reponse
[img width=386 height=480]https://img0.imguh.com/2020/03/19/Screenshot1d26459a72300450.png[/img]
« Last Edit: March 19, 2020, 11:06:43 PM by antoni »

Offline antoni

  • Newbie
  • *
  • Posts: 6
  • Karma: 0
Re: JavaScript in IRD strategies?
« Reply #9 on: January 29, 2024, 11:55:08 PM »
https://ibb.co/9nVWzRF
[img width=386 height=480]https://i.ibb.co/D48Qs3x/Java-Script-IRD.jpg[/img]