Implementing New Flow Plugin but Unable to Get the Triggered Data
Package Edition of Nebula Logger
Unlocked Package
Package Version of Nebula Logger
v4.14.12
New Bug Summary
I am trying to implement email notification when Log__c is created, so I am trying to use Flow plugin using the following document:
First, I create the following custom metadata.
Secondly, I created flow with the following parameter
But triggerNew value is always empty.
I already tried Apex plugin, but i cannot save the apex class even if I use the example class provided in your wiki.
Hi @JiradaWi thanks for reporting this!
For Flow: I think your setup looks correct, this does seem to be a bug with data not being correctly passed to the Flow plugins. I'll see if I can fix it this week.
For Apex: That doc page in the wiki for the Apex plugin is incredibly out of date - they refer to the old, first version of the plugin framework that no longer exists. v2 of the plugin framework was released in v4.7.1, about 2+ years ago. Sooo... that page is... very behind 😨 I'll work on updating + expanding the wiki content for plugins to reflect the current implementation.
In the meantime, here's an updated example that you can use for an Apex plugin
public class ExampleTriggerablePlugin implements LoggerPlugin.Triggerable {
public void execute(LoggerPlugin__mdt configuration, LoggerTriggerableContext input) {
// Example: only run the plugin for Log__c records
if (context.sobjectType != Schema.Log__c.SObjectType) {
return;
}
List<Log__c> logs = (List<Log__c>) input.triggerNew;
switch on input.triggerOperationType {
when BEFORE_INSERT {
for (Log__c log : logs) {
log.Status__c = 'On Hold';
}
}
when BEFORE_UPDATE{
// TODO add before-update logic
}
}
}
}
@JiradaWi I had some time earlier today to review the Flow plugin issues with @jamessimone , and from what we saw, I think fixing the issues will be a bit more involved than I originally anticipated. Some of the design of how Flow plugins are built will need to be changed, and I'll need to do some extra tinkering to figure out the best way to move forward. My hope is to continue working on it some over the coming weeks/months, but I don't have an exact timeline on when I'll have a fix ready for Flow plugins.
In the meantime, Apex plugins should work - if that's an option for you to use for now, let me know if you have any other questions about how to implement it that way.
@jongpie Now I decided to use Apex class to send out email notification. It working as expected now. We already pushed it to UAT. Thank you for the answer!
That's great, glad to hear it! I'll keep this issue open to track progress on fixing Flow plugins, but I'm really glad to hear that you've already been able to move on to UAT with an Apex plugin 🥳