Custom entity

hi

i have created a custom entity called event and created another called delegate and linked together

ive created a SSA field on the delegete entity called dels_eventid so when adding a delegate against the event it can tie the delegate record to the event, how do i get the dels_eventid field to autopopulate with the event in whose context im adding the delegate to?

at the moment its blank and the user has to manually select the event that they are adding to but we want to make it so that it autopopulates

any help is much appreciated