How can i attach multiple different documents against each employee?

Nav_ilNav_il Member Posts: 30
edited 2018-07-22 in NAV Three Tier
Dear Experts

I am trying to use table 5064-Interaction Template in Nav 2009 R2 classic with sql server to attach multiple different files/documents to for each employee in the employee. When i attach a document, it indicates YES, meaning it has been attached. When i go to a new line to attached another different file to the same employee, it replaces the previous attachment. So, it is accepting only one attachment per employee in the employee card.

Is it possible to attach multiple different documents against each employee? What am i not doing right to get many, documents attached for each employee? Thanks.

Answers

  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    It seems that the functionality you are talking about is a bespoke development. You need to ask the partner who developed it for you.

    If you are developing it then be more specific please, describe your solution, maybe include some code.
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • Nav_ilNav_il Member Posts: 30
    Hi Slawek_GUzek, thanks for response to the question. I am actually trying to develop it. I have not don't any development on it other than linking the interactive template form to the Employee card some that one can be attaching documents(multiple) against each employee. Right now, it only attaches one document and if you trying to attach another document, it replaces the previously attached document. I did not want that. I want to be able to attached multiple different documents on each line of the form against each employee. I have no idea how to program it if it needs developing. Can you please put me through on how to develop this?
  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    I cannot say much without seeing your code, how you attach the documents to the Employee record.

    The only thing I can say at this stage is that the documents (the actual document files) are normally stored in T5062 Attachment table, which usually works in conjunction with the T5065 Interaction Log Entry table. You can find a set of useful functions in the Attachment table which you could use to import document files, or view already imported ones.

    Using table 5064 Interaction Template for that does not seem right here. It can be a part of your solution where you could group all documents related to Employee table under single template code, but since you have not revealed any details I can't really tell much about your design and use of the Interaction Template table

    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • Nav_ilNav_il Member Posts: 30
    edited 2018-07-23
    Documentation()

    OnInsert()

    OnModify()

    OnDelete()
    InteractTmplLanguage.SETRANGE("Interaction Template Code",Code);
    InteractTmplLanguage.DELETEALL(TRUE);

    OnRename()

    Code - OnValidate()

    Code - OnLookup()

    Interaction Group Code - OnValidate()

    Interaction Group Code - OnLookup()

    Description - OnValidate()

    Description - OnLookup()

    Unit Cost (LCY) - OnValidate()

    Unit Cost (LCY) - OnLookup()

    Unit Duration (Min.) - OnValidate()

    Unit Duration (Min.) - OnLookup()

    Information Flow - OnValidate()

    Information Flow - OnLookup()

    Initiated By - OnValidate()

    Initiated By - OnLookup()

    Attachment No. - OnValidate()

    Attachment No. - OnLookup()

    Campaign No. - OnValidate()

    Campaign No. - OnLookup()

    Campaign Target - OnValidate()

    Campaign Target - OnLookup()

    Campaign Response - OnValidate()

    Campaign Response - OnLookup()

    Correspondence Type (Default) - OnValidate()
    IF NOT Attachment.GET("Attachment No.") THEN
    EXIT;

    ErrorText := Attachment.CheckCorrespondenceType("Correspondence Type (Default)");
    IF ErrorText <> '' THEN
    ERROR(
    Text003+ErrorText,
    FIELDCAPTION("Correspondence Type (Default)"),"Correspondence Type (Default)",TABLECAPTION,Code);

    Correspondence Type (Default) - OnLookup()

    Date Filter - OnValidate()

    Date Filter - OnLookup()

    No. of Interactions - OnValidate()

    No. of Interactions - OnLookup()

    Cost (LCY) - OnValidate()

    Cost (LCY) - OnLookup()

    Duration (Min.) - OnValidate()

    Duration (Min.) - OnLookup()

    Language Code (Default) - OnValidate()
    IF NOT InteractTmplLanguage.GET(Code,"Language Code (Default)") THEN BEGIN
    IF CONFIRM(Text004,TRUE,InteractTmplLanguage.TABLECAPTION,"Language Code (Default)") THEN BEGIN
    InteractTmplLanguage.INIT;
    InteractTmplLanguage."Interaction Template Code" := Code;
    InteractTmplLanguage."Language Code" := "Language Code (Default)";
    InteractTmplLanguage.Description := Description;
    InteractTmplLanguage.INSERT;
    END ELSE
    ERROR('');
    END;
    CALCFIELDS("Attachment No.");

    Language Code (Default) - OnLookup()
    InteractTmplLanguage.SETRANGE("Interaction Template Code",Code);
    IF FORM.RUNMODAL(0,InteractTmplLanguage) = ACTION::LookupOK THEN BEGIN
    "Language Code (Default)" := InteractTmplLanguage."Language Code";
    END;

    Wizard Action - OnValidate()

    Wizard Action - OnLookup()

    Ignore Contact Corres. Type - OnValidate()

    Ignore Contact Corres. Type - OnLookup()

    Table Name - OnValidate()

    Table Name - OnLookup()

    Line No. - OnValidate()

    Line No. - OnLookup()

    The above is the code in the interactive template table.

    I am using the Interaction Template table to store the documents associated to each employee. I use the interactive template form and link it to the employee card. I use the interactive template form to import the documents to attach them to each employee, but it is only attaching one file to each employee and does not allow more than one file/doc. to be attachment to each employee. My question is how can i have this form attach more than one document to each employee?
  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    I was asking about the code/solution responsible for attaching the document to the Employe. How do you link both records (Employee and Interaction Template?
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • Nav_ilNav_il Member Posts: 30
    I linked the Interactive Template to the employee through the employee Menu button. I added it as a menu item to the employee card and each employee can have only on attachment to them, but I wanted to be able to do multiple attachments to each employee.
  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    It's not exactly what I have asked for. By "How do you link both records?" I wanted to know which field in the Interaction Template field holds the Employee No. to create a link between two tables.

    From your answers/symptoms I am guessing that you link records in those tables by storing Employee No. in the Interaction Template table in Code field.


    The trouble with this solution is that the Interaction Template table has a simple primary key - the Code field alone. If you do link Employee and Interaction Template by storing Employe's No. in the Code field in Interaction Template table you are creating 1 to 1 relation between these two tables. One Employee record = one Interaction Template record. It is not going to be any different.

    You need to use a different table to store many documents against one Employee record, and probably a bit of C/AL coding skills to link the two things together
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • Nav_ilNav_il Member Posts: 30
    edited 2018-07-25
    What you have guessed from my previous response to you is what I have done. I link the two forms as follows:
    Field Type Value
    Code CONST
    Code FIELD Employee No.

    which results to the follow:

    RunFormLink = Code=CONST(),Code=FIELD(Employee No.)

    You are right, my solution creates a one to one relationship between the two tables. So any hints on how to code this then? Thanks.
  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    You could use the Interaction Log Entry table, or the Attachment table. But the solution is not going to be as simple as linking two tables together.

    The Interaction Log Entry table has already Document No. field which you could use. The Interaction Log Entries page offers you Show function to view attached documents, but you would need to write part inserting a new document into Attachment table, and linking it to the new Interaction Log Entry record.

    The Attachment table has no 'front end' - you would need to add a page showing linked entries.

    Look into both tables, analyse code in them, learn how they work, how they handle standard NAV interactions/attachments and you will be able to reuse a large part of existing code.
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • Nav_ilNav_il Member Posts: 30
    Thanks Slawek_Guzek for your valuable suggestions. I will do what you said. Thanks.
Sign In or Register to comment.