Getting last note in Alert Message

Hi all,

 

Does anyone know if it is possible to automatically get the last note as the alert message.

I tried using:

 

getearliernote(SELECT COUNT(*)-1 as NumberNotes FROM Metastorm.dbo.eEvent WHERE eEvent.eNotes IS NOT NULL AND eEvent.eFolderID = @FolderId)

 

But when testing this the message was displayed blank, and also tried casting and converting, but it didn't seem to work.

 

Any ideas?

 

Thanks,

Tagged:

Comments

  • The SQL you want is this, I think (without testing):

     

    SelectSql(null, "SELECT MAX(eEventId) as NumberNotes FROM Metastorm.dbo.eEvent WHERE eEvent.eFolderID = @FolderId AND eEvent.eNotes IS NOT NULL", SQLArg("@FolderId", ProcessContext.FolderId)).Integer

  • Hi Jerome,

     

    Thanks for your reply. It did work up to certain point.

    In our process we have a loopback action to add comments, so waht is happening is that it is assigning the EarlieNote as the previous one, due to the fact that it has not been written to the eEvent table and the alert message is calculated when the folder enters a stage.

     

    I'm assuming a different approach will have to be taken, any other suggestions?

  • try

     

    GetEarlierNote(AllNotes(ProcessContext.FolderId).Count - 1)

  • Mike's approach presumes the most recent note was in the last action.  If it is not, then you will have to determine which action number the note was last in, or do a query like what Jerome suggested ... which is the approach I've used in the past.

  • this is true - she did mention this is a note inserted by a loop back action...

     

    also for future searches - to get last alert message try

     

    GetEarlierMessage(ProcessContext.FolderActionCount-1)