Archive

Posts Tagged ‘event system’

Sample way of constructing email body in Syteline Event system

May 24th, 2014 No comments

Below are some sample ways of constructing email body in Syteline event system.

BODY( SUBSTITUTE(“We have a new customer. Please see customer number {0} for customer: {1}.”, FP(“custNum”), FP(“custName”) ) )

This uses the common SUBSTITUTE function and use object property as parameter value.

BODY( IF( P(“POCost”) > 10000, GC(StdApprovalMessageBody), GC(StdRejectionMessageBody) ) )

Notice the IF function and combine with Global Constant

BODY( FILECONTENTS(“X:\SL\Event\Message\Body\myPreparedMessage.txt”) )

This actually inserts a whole text file.  But static text file is not really useful.

BODY( FILECONTENTS(“X:\SL\Event\Message\Body\” + IDO() + EVENTNAME() “.txt”) )

This one provide a bit more flexibility, allow you to use differ text file for differ event.

BODY( DBFUNCTION( “MsgBodyFunction”, EVENTNAME(), IDO(), P(“RowPointer”) ) )

How to extract and/or copy Event metadata

November 18th, 2013 No comments

To extract the Event System metadata, please do the following:

  1. On the Syteline utility server, go to <install drive>:\program files\Infor\Syteline
  2. Double-click on AppMetadataTransport.exe
  3. On the first few forms of the wizard, enter the appropriate information (e.g., select to export the metadata to an XML file, pick the appropriate configuration, browse to enter an export file name)
  4. Next there will be several forms with different selection options starting with “IDOs to export”.  Skip these by clicking <Next> until you see the form for exporting Events.
  5. On the Events form, select the option “Export Event MetaData for this AccessAs value” and select (null) as the AccessAs value.  Note:  Most user-defined event handlers are setup with AccessAs = Null.  If this is not the case in your environment, then you would specify your AccessAs value when extracting.
  6. Then click through the rest until the last form.  Select <finish> on the last form.
  7. The metadata will be extracted to the xml file specified in the wizard.  If Infor Support requested the Event metadata, please send them that xml file.

If you need to copy the metadata to another environment, then you would use the same utility to import the metadata into another database, but instead select to import and reference the XML file you just created.  IMPORTANT NOTE:  This will overwrite all event handlers with the same AccessAs value in the target database.  Please see linked KB 953806 for related CER:  CER 135998 – Need utility to import/export single events that will also not overwrite existing events when importing.

Additional information on copying events from one environment to another:

1)  If you have just a few event handlers that need copying and want to preserve the events in the target environment, then there are a couple of options:

  • You can manually recreate the event handler records and then manually copy and paste the actions

or

  • You can export events from both the source and target environments into separate xml files.  Make a copy of the target xml and edit the copy.  Manually copy and paste the source event data into the target xml copy.  If the event handler’s event name is the same between the two files, then assign a unique sequence number to the one(s) you are adding to the xml.  Then import the target copy which now contains both the original events and the few that have been added.

2)  If you have a lot of events and want to copy all of them, you could edit the xml file from the source events and change the Access As value and then import that xml file.  The target Access As value would be the new one you assign.  Please note that you would need to not only change the Access As value at the top of the XML document, but also add a node: <AccessAs>value</AccessAs> to every Event, Event Global Constant, Event Trigger, Event Initial State, and Event Handler in the document.  Once you import it, if you have to make changes to any of the events you imported under the different Access As value, you will have to change the Access As value in the database, or you would need to reset the AccessAs value on the events in the appropriate Event related tables to their original value.

Sample way of constructing email body and subject in Event system

October 22nd, 2013 No comments

Below are some sample ways of constructing email body in Syteline event system. 

BODY( SUBSTITUTE(“We have a new customer. Please see customer number {0} for customer: {1}.”, FP(“custNum”), FP(“custName”) ) )

BODY( IF( P(“POCost”) > 10000, GC(StdApprovalMessageBody), GC(StdRejectionMessageBody) ) )

BODY( FILECONTENTS(“X:\SL\Event\Message\Body\myPreparedMessage.txt”) )

BODY( FILECONTENTS(“X:\SL\Event\Message\Body\” + IDO() + EVENTNAME() “.txt”) )

BODY( DBFUNCTION( “MsgBodyFunction”, EVENTNAME(), IDO(), P(“RowPointer”) ) )

Categories: Development Tags:

Calling a Synchronous Event within a SP Transaction and Handling Failure

March 20th, 2012 No comments

First, determine the current site, after which you must name a configuration, by convention:

DECLARE @Site SiteType
SELECT @Site = site FROM parms

Then determine the current SessionId:

 

DECLARE @SessionId RowPointerType
SET @SessionId = dbo.SessionIdSp()

Finally, add the procedure code:

 

BEGIN TRANSACTION
UPDATE coitem
SET due_date = dbo.CalcDueDate(@Parm1, @Parm2)
WHERE coitem.co_num = @CoNum
AND coitem.co_line = @CoLine
AND coitem.co_release = @CoRelease
SET @MyEventParmId = NEWID()
EXEC InsertEventInputParameterSp @MyEventParmId, ‘CoNum’, @CoNum
EXEC InsertEventInputParameterSp @MyEventParmId, ‘CoLine’, @CoLine
EXEC InsertEventInputParameterSp @MyEventParmId, ‘CoRelease’, @CoRelease

DECLARE
@anyHandlersFailed [tinyint],
@result [nvarchar](4000),
@Infobar [nvarchar](4000)
EXEC @Severity = FireEventSp
@eventName = SetCoitemDueDate’,
@configName = ‘SyteLine’,
@sessionID = @SessionID,
@eventTrxId = null,
@eventParmId = @MyEventParmID OUTPUT,
@transactional = 0,
@anyHandlersFailed = @anyHandlersFailed output,
@result = @result output,
@Infobar = @infobar output
IF @Severity > 0
BEGIN
EXEC RaiseError @Infobar, @Severity
ROLLBACK TRANSACTION
END

COMMIT TRANSACTION

Categories: Development, SQL Tags: ,

Site name must be the same as configuration name for event system to work

March 10th, 2012 No comments

Infor is really terrible sometime when it comes to documentation.  For example, for the application event system to work, you have to make your site name exactly match with your configuration name, and this basic and critical information is not listed in installation guide and event system guide.

You can only discover this when running Log Monitor on the Utility Server for event service (run  infor\Syteline\LogMonitor.exe, then filter with “MGEvent”).

Beside sigh, what can you do?