Sunday 17 May 2020

Invoke/Call a Publish Channel Conditionally - Automation Script | Maximo


Normally trigger point for the Publish channels is Event Listener, which is save/update any record. 

Question: Can we send the data using publish channel with a custom trigger point /condition ??

Answer: Yes you can. by using Maximo Automation Script. 
Below is the simple tricks to call a publish channel 

server = MXServer.getMXServer()
userInfo = mbo.getUserInfo()
whereClause = <CONDITION>
server.lookup("MIC").exportData("<Publish Channel Name>", "<External System Name>", whereClause, userInfo, 1000)
---------------------------------
Another example:
micSrv = MXServer.getMXServer().lookup("MIC")
server.lookup("MIC").exportData("MXPO", "LegecyApp", " ponum='"+vPONum+"' and revisionnum="+vREVNUM , micSrv.getNewUserInfo() , 1)


Note:

Mic is old service name for MIF, but still the same name


2 comments:

  1. Hello, i know this is quite an old post but stumbled across it while trying to configure a script to be run from a CRON task to pick up and send WO's over a publish channel.

    I've tried your various methods, using a few of the publish methods with no success. I've also tried the method detailed elsewhere but both methods return the same result. The message is not sent.

    I know it picks up one WO but it won't send. I can see in the logs it going through the process rules on the Publish Channel and satisfying every single one.

    My publish channel is on an External system with its listener disabled, channel enabled, ext sys enabled and an end point specified. Nothing.
    If i switch the listener on and touch the WO it sends it quite happily.

    I've tried my code in Nashorn and jython and both are the same. Tried this as seen weird things now and again.

    Any ideas?

    ReplyDelete
  2. Sorry i actually got this to work but only if you don't use Publish Json on the publish channel which is of no use to me.

    Tried the following as well with no luck
    PublishChannelCache.getInstance().getPublishChannel("").publish(mbo, "");

    ReplyDelete