+2 votes

When scripting the OnInsertDetail event, we're not provided the (optional) relationKey parameter.
Consequently, it becomes a nightmare when you want to edit the newly inserted detail relation : I hoped the new detail would be the last one in the detailDataset but its position is not reliable.

This is to my mind a decent change request.

I've tried set the SELECTORDERBY clause of the SYSTABLEVIEWS to XXXXYYYY.D_CHANGE, but this isn't reliable.
=> I use a custom fied to know if a detail has been processed or not by my workflow :-(

Any comment is welcome.

asked in WorkFlow / Serverscript by (239 points)

1 Answer

+2 votes

Actually, there exists an "extended" version of OnInsertDetail that publishes the K_RELATION value.

The function is OnInsertDetailEx{Entity}{Detail}(EditHandle, Detail, DetailKey, K_Relation).

Also for deleting a relation, there is OnDeleteDetailEx{Entity}{Detail}(EditHandle, Detail, DetailKey, K_Relation).

The functions above are for adding or removing relations in an edit context of another entity.

For stand-alone adding and removing of links, you have similar extended functions:
OnBeforeDeleteEx{Entity}{Detail}(Key, DetailKey, K_Relation)
OnAfterDeleteEx{Entity}{Detail}(Key, DetailKey, K_Relation)

Note that when the event occurs both the standard and the extended versions of the scripts will be called (in that order).

It's probably useful that you add this information to the excellent Project Team Guide at https://help.efficy.com/edn/projectguides/workflow_events.

Cheers,
Robert

answered by (1.2k points)
1,231 questions
1,500 answers
1,835 comments
328 users