Jozef Pietruniak Posted June 27 Share Posted June 27 I'm trying to create a Smart Event, that will populate a custom field on the line detail with a field from a related object. For example: I have a custom field on my detail line called STAT ACCOUNT. I want this field to be populated by a STAT ACCOUNT assigned to an Item. I can't figure out the API that would do this. Link to comment Share on other sites More sharing options...
Members Sterio, Louis Posted June 27 Members Share Posted June 27 @Jozef Pietruniak How are you doing? Long time! Can you provide a screen shot of the stat account field on the Item master record? I could not find a standard field in my demo company. Is this a custom field on the item master record as well as the PO line level? Link to comment Share on other sites More sharing options...
Jozef Pietruniak Posted June 27 Author Share Posted June 27 Doing good. Just got back from a 1 month vacation. The STAT ACCOUNT field is a Custom Field on the ITEM Object. I also added a STAT Account custom field on the PO Detail level. Link to comment Share on other sites More sharing options...
Members Sterio, Louis Posted June 27 Members Share Posted June 27 Got it. Object Type: Po Transaction Detail Transaction Definition: <Select proper TD> Action: API Events: Add+Set Condition: ("{!PODOCUMENTENTRY.STAT_ACCOUNT!}" != "{!PODOCUMENTENTRY.ITEM.STAT_ACCOUNT!}") API: <update> <PODOCUMENTENTRY> <RECORDNO>{!PODOCUMENTENTRY.RECORDNO!}</RECORDNO> <STAT_ACCOUNT>{!PODOCUMENTENTRY.ITEM.STAT_ACCOUNT!}</STAT_ACCOUNT> </PODOCUMENTENTRY> </update> Synchronous Smart Event = true name: UPDATE_PO_LINE Link to comment Share on other sites More sharing options...
Jozef Pietruniak Posted June 28 Author Share Posted June 28 Thanks Louis.. Works as expected. Can I use a trigger to update the field instead of a Smart Event? Link to comment Share on other sites More sharing options...
Members Sterio, Louis Posted June 28 Members Share Posted June 28 In this case it would not work because there is a current limitation with platform triggers and nexus path relationships like this: {!PODOCUMENTENTRY.ITEM.STAT_ACCOUNT!} Engineering has this on their roadmap to resolve but in order to solve this requirement today you would have to use smart events. Link to comment Share on other sites More sharing options...
Jozef Pietruniak Posted June 28 Author Share Posted June 28 Do Triggers fire off before Smart Events? The reason I am asking because I created a trigger to create a stats entry that posts to an associated stats account for the item. The other option would be to have the ITEM ID be the STAT account. Any thoughts? Link to comment Share on other sites More sharing options...
Members Sterio, Louis Posted June 28 Members Share Posted June 28 @Jozef Pietruniak I am not quite sure I understand, can you open up a case to work with partner enablement on this use case? Link to comment Share on other sites More sharing options...
Lee Savidge Posted July 1 Share Posted July 1 On 6/28/2024 at 4:07 PM, Jozef Pietruniak said: Do Triggers fire off before Smart Events? The reason I am asking because I created a trigger to create a stats entry that posts to an associated stats account for the item. The other option would be to have the ITEM ID be the STAT account. Any thoughts? Triggers fire immediately. Smart Events are pushed to the Smart Events queue for processing. The queue time is anywhere between almost immediately and around 9 minutes. This time can be affected by current system load. Link to comment Share on other sites More sharing options...
Members Sterio, Louis Posted July 1 Members Share Posted July 1 @Lee Savidge This is true unless you "tick" the synchronous checkbox within the smart event properties. This will ensure the smart event executes within the context of the save/real time. Link to comment Share on other sites More sharing options...
Lee Savidge Posted July 2 Share Posted July 2 22 hours ago, Sterio, Louis said: @Lee Savidge This is true unless you "tick" the synchronous checkbox within the smart event properties. This will ensure the smart event executes within the context of the save/real time. I recall a tick box that said synchronous or asynchronous but checking just now, I can't find that tick box any more. There is one on triggers for running offline which puts the trigger into a queue type thing like smart events (at least I think it does). On a side note, I have never figured out the point of the timeout field on the smart event, but more to the point, the tick box you mentioned, no longer appears to be there. Link to comment Share on other sites More sharing options...
Members Sterio, Louis Posted July 3 Members Share Posted July 3 This only shows up for API type of smart events not any other type. Link to comment Share on other sites More sharing options...
Lee Savidge Posted July 3 Share Posted July 3 (edited) 5 hours ago, Sterio, Louis said: This only shows up for API type of smart events not any other type. Hi @Sterio, Louis You're right. the field is only available if you choose API type as the action for the smart event. It doesn't exist for the other types. Edited July 3 by Lee Savidge Link to comment Share on other sites More sharing options...
Recommended Posts