Skip to main content

Custom Event trigger on a custom field


Forum|alt.badge.img+4

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.

 

10 replies

hhy38
Superhero (Customer)
Forum|alt.badge.img+16
  • Superhero (Customer)
  • 318 replies
  • December 4, 2024

Hi ​@MHRDonato 

 

Just check the INVENTORY_PART_IN_STOCK_CFT table.


Forum|alt.badge.img+2
  • Sidekick (Customer)
  • 8 replies
  • December 4, 2024

Another alternative is to check: INVENTORY_PART_IN_STOCK_CFV


hhy38
Superhero (Customer)
Forum|alt.badge.img+16
  • Superhero (Customer)
  • 318 replies
  • December 4, 2024

@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.


Forum|alt.badge.img+4
  • Author
  • Sidekick (Customer)
  • 11 replies
  • December 4, 2024

@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.


Marcel.Ausan
Ultimate Hero (Partner)
Forum|alt.badge.img+22
  • Ultimate Hero (Partner)
  • 1142 replies
  • December 4, 2024

@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. 

 


Forum|alt.badge.img+4
  • Author
  • Sidekick (Customer)
  • 11 replies
  • December 4, 2024

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?

 


hhy38
Superhero (Customer)
Forum|alt.badge.img+16
  • Superhero (Customer)
  • 318 replies
  • December 4, 2024

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


Forum|alt.badge.img+10
  • Hero (Partner)
  • 115 replies
  • December 4, 2024

@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.

spetkus27
Do Gooder (Customer)
Forum|alt.badge.img+6
  • Do Gooder (Customer)
  • 25 replies
  • December 5, 2024

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.


Forum|alt.badge.img+4
  • Author
  • Sidekick (Customer)
  • 11 replies
  • December 6, 2024

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings