Using data templates to modify records

DekitoDekito Member Posts: 19
Hi everyone,

Here is the issue:
I'm trying to apply a data template (through coding) to a customer record.
Here's part of the code:
RecRef.GETTABLE(Customer);
    TemplateManagement.UpdateRecord(DataTemplateHeader,RecRef);
I get the Data Template Header from a setup table, and the 'Customer' variable is already filled with a customer record.

I get the following error/notification:
Another User has modified the record for this Customer after you retrieved it from the database.
Enter your changes again in the updated window, or start your activity again.
but I'm sure that no one has modified it.

This only appears when I use the Template Management Codeunit, if I statically apply the currently entered fields in the template, to the Customer record, everything is OK.


ANY SUGGESTIONS?

Thanks in advance
Dekito

Answers

  • DekitoDekito Member Posts: 19
    Problem solved:
    I added Customer.FIND('='); //get the rec. again
    before my code:
    RecRef.GETTABLE(Customer);
    TemplateManagement.UpdateRecord(DataTemplateHeader,RecRef);
    and it works ](*,)
    Dekito
Sign In or Register to comment.