Question

Custom Fields and Standard Fields in the same event

  • 4 June 2020
  • 4 replies
  • 1207 views

Badge +2

Hello,

I have been asked to set up a Custom Event that should notify or stop the user (info message / error message) when they try to save a new object based on the values in one custom field, and another standard IFS field. Both exist in separate tables, as you would expect (e.g. NCR_TAB and NCR_CFT). 

I get this to work on existing objects, either through querying the field directly in the event action, or through the custom attributes in the event. 

 

However, in this case I want the event to be triggered when the new object is created, which means that the row does not yet exist in either table / view. Upon testing this this is what I’ve observed:

  • If it is a new object (row), I get no value from the custom attribute
  • If it is NOT a new object, and I have changed the CF$_SOME_FIELD value, I get the previous value
  • If it is NOT a new object, and I have NOT changed the CF$_SOME_FIELD value, I get the correct one

It makes sense to me that it works like this, but I am just wondering if anyone knows if there is a work-around for this?

In short, can I get values for custom fields and standard IFS fields on new objects in a Custom Event? 


4 replies

Userlevel 2
Badge +6

Hi,

This should be implemented as 2 event/event actions. One on Standard table and the other on Custom Table (CFT).

As you mentioned records are created separately. Core record first. There is no way you can pick the custom table value, as it is not created at that point in time

Badge +2

Hi,

This should be implemented as 2 event/event actions. One on Standard table and the other on Custom Table (CFT).

As you mentioned records are created separately. Core record first. There is no way you can pick the custom table value, as it is not created at that point in time


I see. In this case the error message should only show up based on the values in both the custom field and the standard field, so I guess that is not possible.

Thank you for the answer :slight_smile:

Userlevel 7
Badge +18

For new records, the base table _TAB record gets created before the custom field table _CFT record. Users outside this transaction won’t see that distinction, but inside this transaction, the order matters.

 

Try putting the event on the CFT table and read the values from the base table. By the time the CFT event fires, the base table will have been settled. You can’t read old values this way, but for new records, they’ll just be null anyway.

Userlevel 3
Badge +7

For new records, the base table _TAB record gets created before the custom field table _CFT record. Users outside this transaction won’t see that distinction, but inside this transaction, the order matters.

 

Try putting the event on the CFT table and read the values from the base table. By the time the CFT event fires, the base table will have been settled. You can’t read old values this way, but for new records, they’ll just be null anyway.

I assume this will end up with event mutating issue. So hope this cannot be done online.

Reply