CRM create interaction log entry

I’ve a report which generates letters in response to samples requests. It’s a report rather than anything else because it picks up data from another table (we’ve defined a contact sample table). I’d like to record this interaction (printing the letter). I’ve modified the report to do it, but it’s not generating the interaction log entry entry no., and I can’t see what table it gets the next number from. Can anyone shed any light on the right way to get it filled in ?

This is how the Sales Quote (Report 204) is doing it. I guess that might help you. IF LogInteraction THEN BEGIN CALCFIELDS("No. of Archived Versions"); IF "Bill-to Contact No." <> '' THEN SegManagement.LogDocument( 1,"No.","Doc. No. Occurrence", "No. of Archived Versions",DATABASE::Contact,"Bill-to Contact No.", "Salesperson Code","Campaign No.","Posting Description") ELSE SegManagement.LogDocument( 1,"No.","Doc. No. Occurrence", "No. of Archived Versions",DATABASE::Customer,"Bill-to Customer No.", "Salesperson Code","Campaign No.","Posting Description") END;