Skip to main content
Solved

How to use column of another table into a custom event on another table?

  • November 13, 2024
  • 6 replies
  • 137 views

Forum|alt.badge.img+2
  • Do Gooder (Customer)
  • 5 replies

I am creating a custom event on a table active_work_order_tab and I want to use a custom column from a custom table into it to get the run time value into the condition like ‘&NEW:METER_READING’. This column belongs to a custom table. How it is possible?

Best answer by JoDe

Hi @ishtiaq,

This is possible with some limitations. You cannot select the new/old value from the custom event screen. You will have to retrieve them by either SQL or workflows in the event action.

in regards to SQL, this only works if the record is changed. If during the creation step we want to use these values we will have to create a script creating a background job for AFTER the commit has been done since you cannot query your own transaction.

View original
Did this topic help you find an answer to your question?

6 replies

Forum|alt.badge.img+10
  • Hero (Customer)
  • 84 replies
  • Answer
  • November 13, 2024

Hi @ishtiaq,

This is possible with some limitations. You cannot select the new/old value from the custom event screen. You will have to retrieve them by either SQL or workflows in the event action.

in regards to SQL, this only works if the record is changed. If during the creation step we want to use these values we will have to create a script creating a background job for AFTER the commit has been done since you cannot query your own transaction.


Forum|alt.badge.img+2
  • Author
  • Do Gooder (Customer)
  • 5 replies
  • November 13, 2024

Hi @JoDe
Thanks for your precious reply. The main strategy I'm using is to retrieve a value from a table using an SQL query, but I need the value that the user has entered at runtime. Please suggest a solution for how I can obtain this runtime value.


Forum|alt.badge.img+10
  • Hero (Customer)
  • 84 replies
  • November 13, 2024

@ishtiaq,

you can pass the NEW ROWKEY and then do a select CF$_…. from active_work_order_CFT WHERE ROWKEY = ‘&NEW:ROWKEY’. 

Again, please note that if it's a newly passed record, the record in the CFT will not exist yet since it's the current transaction. 

if it IS the same transaction and you would like to use the new value you might have to amend the script to create a job in the background jobs. This way the sql statement executes AFTER the transaction has been committed.


Forum|alt.badge.img+2
  • Author
  • Do Gooder (Customer)
  • 5 replies
  • November 13, 2024

@JoDe,

I don’t want to commit the transaction coz I want to implement a check on the pre-commit value. It means this method is not possible for the uncommit data.


Forum|alt.badge.img+10
  • Hero (Customer)
  • 84 replies
  • November 13, 2024

Hi Ishtiaq,

This unfortunately isn't possible. As a work around you can make the field only editable AFTER the record has been created (which isn't Ideal, I know).

For these validations where you want to check other values from the same transaction you might have to use workflows.

There you can get all values from the current transaction to do validations on. 

Please note however there is a big array of issues with workflows which are still unresolved and because of that I personally would recommend against it (at least until 25R1, perhaps 25R2). 

If you plan on using MobileWorkOrder, migration jobs etc. prepare to run into many many issues. 


Forum|alt.badge.img+2
  • Author
  • Do Gooder (Customer)
  • 5 replies
  • November 13, 2024

@JoDe,

Thanks for your support.

Best Regards,


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