Solved

Custom Field - Enter Modified Date and User

  • 4 March 2022
  • 8 replies
  • 615 views

Userlevel 2
Badge +6

Hello all!

Hopefully this is a quick question that can lead into a lesson that is useful for others (including myself).

I’m creating a custom page and would like to add a custom field that will record a few instantaneous values but am struggling to find the right value to reference. We’d like fields to keep:

  1. User who creates the record
  2. Date/time at entry
  3. User who modifies a particular Boolean value in the table

I tried using SYSDATE and USER but of course that just pulls the date and user at the minute of viewing the record.

If I learn this lesson it opens a lot of opportunities for interesting metrics. Thanks to advance to anyone who is willing to help!

Using IFSAPP9 if that’s relevant.

icon

Best answer by andjor 14 March 2022, 16:24

View original

This topic has been closed for comments

8 replies

Userlevel 7
Badge +21

Hi @matthunter ,

 

I think you can accomplish what you’re asking one of two ways.

  1. Create a custom event against the custom table behind the custom page.  Set the event up to trigger on insert and update.   You could then create two custom actions one which fires when for the insert and you could store the username and datetime of the insert into the record.   The second custom action would fire on an update and you could specify a specific field to monitor and record the user and datetime of the update.
  2. Another option could be to utilize the IFS History Log under Solution Manager->Monitoring->History.   You could configure so your could record history on insert on the unique key named rowkey and the system would record the user and datetime.   You could also configure it to log update of a specific field and it will record the user and datetime.

 

Regards,

William Klotz

Userlevel 2
Badge +6

Ha! I had a feeling it might be a custom event. Thanks William.

The second approach is new to me but I’ll give it a shot.

Userlevel 2
Badge +8

Hallo

I did it for Custom LU CInstCompInstrument.

 

C_ICI_DATE_ENTERED

2020-06-23 FLESABRIW create - Show the Created Date (History Log) of the Installed Competitor Instrument

SELECT  hl.time_stamp

FROM    history_log_attribute_tab hla,

               history_log_tab hl

WHERE  hl.log_id = hla.log_id

AND       lu_name = 'CInstCompInstrument'

AND       hl.keys = 'OBJKEY=' || :rowkey ||'^'

AND       history_type = '1'

ORDER BY  hl.time_stamp DESC

FETCH FIRST ROW ONLY

 

 

C_ICI_USER_ENTERED

2020-06-23 FLESABRIW create - Show the Created User (History Log) of the Installed Competitor Instrument

SELECT  hl.username

FROM    history_log_attribute_tab hla,

              history_log_tab hl

WHERE  hl.log_id = hla.log_id

AND       lu_name = 'CInstCompInstrument'

AND       hl.keys = 'OBJKEY=' || :rowkey ||'^'

AND       history_type = '1'

ORDER BY  hl.time_stamp DESC

FETCH FIRST ROW ONLY

 

C_ICI_DATE_MODIFY

2020-06-23 FLESABRIW create - Show the Modified Date (History Log) of the Installed Competitor Instrument

SELECT hl.time_stamp

FROM history_log_attribute_tab hla,

 history_log_tab hl

 WHERE hl.log_id = hla.log_id

AND       lu_name = 'CInstCompInstrument'

 AND hl.keys = 'OBJKEY=' || :rowkey ||'^'

AND history_type = '2'

ORDER BY hl.time_stamp DESC

FETCH FIRST ROW ONLY

 

C_ICI_USER_MODIFY

2020-06-23 FLESABRIW create - Show the Modified User (History Log) of the Installed Competitor Instrument

SELECT hl.username

FROM history_log_attribute_tab hla, history_log_tab hl

WHERE hl.log_id = hla.log_id

AND lu_name = 'CInstCompInstrument'

AND hl.keys = 'OBJKEY=' || :rowkey || '^'

AND history_type = '2'

ORDER BY hl.time_stamp DESC

FETCH FIRST ROW ONLY

 

Setup History Log for C_INST_COMP_INSTRUMENT_CLT

 

 

I did it on IFS Apps 10 Update 10.

 

Best Regards,

André

Badge +1

that’s really good post

Userlevel 2
Badge +6

@andjor

Wow, that looks very helpful. Thank you so much for writing that all up! Are those attributes to the Custom LU? Or are they event actions?

Userlevel 2
Badge +8

@matthunter 

I didn’t need any event action for this. I use only custom field and the History Log.

Best Regards,

André

Userlevel 2
Badge +6

Could you send a screen shot of the custom field? Thanks André

Userlevel 2
Badge +8

My documents for the hole LU.