Employee portal: Create new record

peterke1974peterke1974 Member Posts: 23
edited 2006-08-22 in Navision e-Commerce
Hello,
I want to do the following:
I want to show a list of contacts of a specific salesperson. It must also be possible to modify the contacts and create new ones (in the lines).

To do this, I have a created a header-line webpart. The header is my salesperson record, the line is the contact record.

When modifying or creating the record, I allways get the error that there is no record found in the filter. But the record is created or modified.

I created the necessary code in the codeunits 6823 en 6825.

Any idea what I do wrong?

Or is it better to create and modify in a card-window

Comments

  • IHateLinuxIHateLinux Member Posts: 223
    Hi,

    are you setting the Salesperson code during the insert?

    If not, the new record can not be found because the filter (head-line connection) will kick out this record.

    If this is not the error, please post your code (or send it to me as a message), otherwise it is nearly impossible to solve your issue.

    HTH,

    Rainer
  • peterke1974peterke1974 Member Posts: 23
    This is the code I added:


    LineRecordRef.OPEN(DATABASE::Contact,FALSE);

    // Init the Record
    LineRecordRef.INIT;
    // Set the Primarykey Fields
    LineFieldRef := LineRecordRef.FIELD(Contact.FIELDNO("Salesperson Code"));
    EPSupportFunctions.ModifylFieldRefOnInsert(DATABASE::Contact,Contact.FIELDNO("Salesperson Code"),
    EPDecodeXML.GetValueByFieldIDFromHeadData(XMLDocInHead,Contact.FIELDNO("Salesperson Code")),
    LineFieldRef);
    Salespersoncode := LineFieldRef.VALUE;
    //Salespersoncode := 'LIEVENB';
    EPSupportFunctions.CreateTempHeadFilterTable(Contact.FIELDNO("Salesperson Code"),
    Salespersoncode,GUID);

    LineRecordRef.INSERT(TRUE);


    // Insert Head Key fields for Answer
    EPSupportFunctions.CreateTempHeadFilterKeys(Contact.FIELDNO("Salesperson Code"),GUID);

    I receive this error when I use the "EPSupportFunctions.ModifylFieldRefOnInsert" Code
    Navision error (10500): Verkoper/Inkoper Code 'ERROR' does not exist.
    The contact is not created.

    When I put the salespersoncode filter fixed to LIEVENB, I get the follwing error
    Navision error (10500): You cannot enter 'SORTING() WHERE(=CONST(LIEVENB))' in FieldNo. The cursor is in front of the invalid character.

    Could It be a problem that salesperson code is not in the primary key?
    I use the "salesperson code"- key in the list.

    Hope you can help me

    Thanks
  • IHateLinuxIHateLinux Member Posts: 223
    Hi,

    a key is NOT the primary key!
    The first key in Navision is the primary key, but you can add up to 20 keys which can then be used for sortings.

    The primary key in NAV is the Contact No.

    You have to use this field to create a new contact.

    But you can set the value for the salesperson code when you create the record.

    HTH,
    Rainer
Sign In or Register to comment.