Skip to main content

Hi,

 

I managed to create a custom field, read only type, with a select statement.
The custom field shows how many days are in between today and the expiration date.

 

 

I would like to know if its possible to create a custom event that triggers when my custom field changes.

 

I can’t find the custom field that i created in any tables in this page.

 

Hi ​@MHRDonato 

 

Just check the INVENTORY_PART_IN_STOCK_CFT table.


Another alternative is to check: INVENTORY_PART_IN_STOCK_CFV


@THMOBR INVENTORY_PART_IN_STOCK_CFV is a view. We can’t set a trigger for views. This view has the INVENTORY_PART_IN_STOCK_TAB and the INVENTORY_PART_IN_STOCK_CFT tables.


@hhy38 

I did change the table for INVENTORY_PART_IN_STOCK_CFT, however it only shows the rowkey attribute.

 It doesn’t show the CF$_DIAS_PARA_VENCIMENTO.


@MHRDonato when using %CFT tables in the event you should see all the PERSISTENT Custom Fields CF$_% and the rowkey. Then if you need to use some standard field in your Event Action you would need to create Custom Attributes in your Event and call the GET functions using the rowkey (which is common between CFT and TAB tables)

Now, in your case, your field is Read-Only and it executes the Select statement dynamically whenever you open the Inventory Part In Stock page. You cannot use a read-only CF to trigger an event cause nobody is changing/inserting value in that field. It’s an automatically calculated field.

I hope this makes sense. 

 


Hi ​@Marcel.Ausan,

It did make sense.

So I need to build a PERSISTENT custom field.

I created this DIAS_ATE_VENCER , as a persistent, in the preview it shows the info from the read only (CF$_DIAS_PARA_VENCIMENTO), however when I add it to the Part in Stock page it doesn’t show any information.

Would this method work, or are there any restrictions?

 


@MHRDonato In my opinion, you have to set a trigger for the source table. 


@MHRDonato, since you say “The custom field shows how many days are in between today and the expiration date”, that custom field will change just from time passing. Even if the underlying expiration date is not changed in the inventory parts in stock table, it would show a day less tomorrow than today, right. You could trigger on change of expiration date, but it probably won’t help you, since there’s no event for “time passing”.

Possible alternatives:

  1. Use a lobby element instead for “stock with X days left” or something, and just let users monitor that.
  2. Use a migration job querying on INVENTORY_PART_IN_STOCK_CFV where your custom field is less than X days or something, and use something like Command_SYS.Mail to sent e-mail alerts (provided that’s what you want to do).
  3. Make it a persistent field and update e.g. nightly using a scheduled migration job. That way you can put a custom event on the field.

I am unsure what exactly you are trying to solve with these custom fields and events but this sounds like it may be a bad approach to solving the problem at hand and might fall under “I can do this but should I”? The read only field seems like it should be enough to monitor through lobby elements as ​@AussieAnders suggested and don’t overcomplicate the process.


I did what ​@AussieAnders suggested and it worked, I built a lobby element that shows the information that I required.

Thank you for the responses.


Reply