Hello,
Someboby has tried to insert , modify and delete "Interaction Log Entry" and works well?
I try to do this but I have problems I think because the key ("Interaction Log Entry") isn't a code but im not sure.
For example in code unit 6822 I write:
InsertInteraction(GUID : Text[50];VAR HeadRecordRef : RecordRef)
HeadRecordRef.OPEN(DATABASE::"Interaction Log Entry",FALSE);
HeadRecordRef.INIT;
HeadRecordRef.INSERT(TRUE);
// Build Records to Create the Filter for Answer (Filter for HEAD)
HeadFieldRef := HeadRecordRef.FIELD(Interaction.FIELDNO("Entry No."));
tmpInteractionNo := HeadFieldRef.VALUE;
EPSupportFunctions.CreateTempHeadFilterTable(Interaction.FIELDNO("Entry No."),FORMAT(tmpInteractionNo,0,2),GUID);
//I use format because de funcion need a string
// Build Records to Create the Key for Answer (Filter for HEAD)
EPSupportFunctions.CreateTempHeadFilterKeys(Interaction.FIELDNO("Entry No."),GUID);
The sharepoint works but insert the interaction lob entry number 0, don't insert the last+1 interaction.
I have similar problems with codeunit 6824. The code unit to delete 6826 works well.
Somebody has an idea ?
Thank you.
0
Comments
There is no code on the OnInsert() trigger in table 5065 - "Interaction Log Entry".
Your code will therefore always insert an "Interaction Log Entry" with "Entry No." = 0.
The reason the HeadRecordRef.INIT, HeadRecordRef.INSERT(TRUE) works for Customer, Vendor, SalesHeader, etc. in codeunit 6822 - "EP Insert Head Data Mgt." is that these tables have code in the OnInsert() trigger to populate the primary key.
To solve you problem you will have to find the last "Entry No.". You could try to add the below code to the OnInsert() trigger or create a function in the "Interaction Log Entry" table and call that function after the INIT call.
Regards
Claus
http://www.AcumenConsulting.co.nz
the interaction log table is something very specific. The entries in there are normally just created through some wizzard forms.
The number is calculated and then added +1 to get the next number because the primary key is just an integer and no code field (and therefore there is no number series for that).
Have a look in Codeunit 5051 - SegManagement there is the function LogInteraction which is normally called by the form.
To answer your question:
Add this code to your insert function and it should work:
- Create a local variable of type record linked to table "Interaction Log Entry" 5065 (here called rec5065)
- Create a local variable of type integer (here called LastEntryNo)
- Add this :
rec5065.LOCKTABLE;
IF rec5065.FIND('+') THEN
LastEntryNo := rec5065."Entry No." + 1
ELSE
LastEntryNo := 1;
rec5065.INIT;
rec5065."Entry No." := LastEntryNo;
rec5065.INSERT;
- Now remove the code for the RecordRef.Insert and set the value from the physical record
This should work.
HTH,
Rainer
I write your code and now I can insert , modify and delete interaction log entry.
Marta