Hello all!
I have a new issue that I would definitely need some help with.
Lets say I object “Engine” that is linked to object “Car”. I want to send a notification to a user everytime an Engine changes status, by changing the status from “Operating” to “Dead” or the other way around, for example.
In automate this would be pretty easy, we just need to set an automate to catch any modification to the Engine Object Set, and then send a notification on those.
However, if I want to just track the Engines that are connected to Cars that are on the road (by being Live), this cant be done in Automate:
How would you approach this issue?
My initial thoughts are not ideal, but it is basically having a function execute on any change to the Engine object and then the typescript backend filter the action to just send the notification if the Engine is connected to a Live Car. But I’m not sure if that would be too inefficient if we have thousands of engines being tracked…
Hey Pedro, long time no talk, hope you’re well!
Approach 1: easy mode
My intuition tells me you should rely on Saved object set instead of Dynamic object set. The name is a bit counter-intuitive as it implies the objects are set-in-stone, but you can see it more as a “saved exploration”.
I would use an “On object Add” to the saved exploration “cars linked to a dead engine”. The limitations you’re facing with the dynamic object set should disappear:
-
save your templated object explorer exploration, where you’re going from “Dead” Engines to Car (or whatever object contains the foundry user ID/email you want to notify)
-
create an “on object add” automation
-
in the saved object set category, select this exploration
Approach 2: over-engineer mode
Create an intermediate “tracker” object type that gets created/updated whenever an Engine changes status AND that Engine is linked to a Live Car, for instance. Plug this to automate.
Approach 3: Black Magic
The typescript function route. I’m doing this by head so pardon my poor TS skills:
// filters to only process Engines linked to Live Cars
const engine = Objects.search.engines.all([engineId]);
const linkedCars = engine.linkedCars.all();
if (linkedCars.some(car => car.status === "Live")) { // send notification }
With thousands of Engines, this could be inefficient. Consider using execution grouping in Automate to batch process modifications rather than running once per object.
Approach 4: Data Engineering-heavy
De-normalize your Ontology to make this filtering easier
Hope this helps. Cheers!
10x Partners
2 Likes
Always a pleasure to see you Antoine!
The 1st approach, sadly, also does not work. That was actually the first thing I tried, but Foundry picks up that the saved exploration has a search around and throws the same error.
I was leaning into the second approach as well, with some helper objects. But after speaking with the SME, I realise that in truth there shouldn’t be many changes to Engines that arent linked to “Live Cars”, meaning that the automate on modify wont trigger too often for irrelevant engines if I do the “black magic” approach. The increase cost of “empty” triggers is probably smaller than having to maintain the pipelines+objects for the helper objects!
1 Like
That’s rather strange… I could successfully create an automation backed by a saved exploration containing at least one search around. It executes properly on my side.
Note: it’s an “On object add” automation. In the example you gave above, configuring “added to saved exploration” will produce the same results “edited inside of a dynamic set”, but I don’t know all of the intricacies.
If ever, the “On object add” automation also allows for direct function backing, in case this leads to a different outcome:
Cheers!
Ah right! I think I misread your message, as my use case really needs the “objects modified in set”, instead of objects added. This is what causes the limitation to search arounds, unfortunately. I have other automates with objects added that search around without any issues