Ui action condition

Rosy14
Tera Guru

Hi

below code is not working worknotes is journal input type

current.work_notes=="Report generated"

1 REPLY 1

p_kanczugowski
Tera Guru

Hi @Rosy14, as you mentioned, the work notes are actually kept in another table called [sys_journal_field]. If you need to do an exact check like the one you provided, you'll probably need to use that table in the condition directly (i.e. via a Script Include).

 

That being said, there's a getJournalEntry method that will give you a string such as this:

 

2024-03-12 07:06:56 - System Administrator (Work notes)

Report generated

 

 

If you're fine with a CONTAINS instead of a match, you can use a condition such as this:

 

current.work_notes.getJournalEntry(1).indexOf('Report generated') !== -1

 

It will return true if the last work note contains string "Report generated". If you want to check all of the work notes (instead of the last one), use getJournalEntry(-1). You could also play with the string a little bit more and remove the first line, but to be precise, I would then recommend simply running a GlideAggregate against the actual [sys_journal_field] records.

 

PS Instead of using a "magic string" in the condition, I would extract it and use a property instead.

 

Please mark this response as useful and the issue as solved if I've been able to help you. Thanks!