This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to send the values from history table for an asset in an email

Dears,

I need to send an email to my customer for verification of some important columns.Example as below.

I have already enabled the history on the needed columns. which ever column is updated with that transactions need to highlight and send as an email.

Please let me know.

  CurrentValue Previous Value
HostName ABC  
Application Owner Indra Kumar
Appliaction Name CTS CBS
Criticality Critical  

Thank you.

Regards,

Indra 

  • 0

    Please review the History table structure via Designer application.  Since the "link" to this table from the context table is in reverse (ie. n-1), use of the 'ID of link Referenced object (lHistObjId)' with the context table primary key will help identify which history table records to pull into the email notification.  The context table elements with "Keep history" attribute enabled can be identified by the respective SQLName stored under 'Field or link (Field)' of history table.

  • 0 in reply to 

    Please let me know how to write the same query inside the messaging, for example if i write [Computer.tcpiphostname] it will get the value of host name. if i write [History.PreviousVal] it will give the previous val of the last updated column in the table for this record, but i need to show all the columns. could you share any example if you have.

    Thank you.

    Regards,

    Indra

  • 0 in reply to 

    This is why I wrote about the link in reverse.  By changing your context to start from amHistory you will be able to identify ALL relate history table records.

    Sorry, I do not have an example, but you could also leave context alone and change your messaging action to a script type action, then use amQueryExec(), amGetField*(), and amActionMail()...these functions are defined in the programmer's reference guide.

  • 0 in reply to 

    Dear Mark,

    Thank you for your inputs, Im trying this option and now im facing the new issue, if i use this method it will return whole history for this portfolio item. I want to restrict only for the latest transactions, could you give some insights on this.

    Thank you.

    Regards,

    Indra

  • Verified Answer

    +1 in reply to 

    Include in WHERE clause...

    h.Field IN ('BOB_InternetFace','BOB_Hostname','BOB_AppOwnerName','BOB_ApplAdditionalInfo','BOB_AdditionalRemarks') AND MAX(h.dtLastModif)

  • 0 in reply to 

    Or you can change the SELECT to "SELECT DISTINCT h.Field...WHERE MAX(h.dtLastModif)..."