Insertion through codeunit.

sabzamsabzam Member Posts: 1,149
When inserting a record through codeunit is it possible to automatically run the coding behind. For example in a sales header once the sell-to customer no is entered it is automatically retrieved the address along with vat no. and other info. Can this be achieved even when inserting through codeunit?

Comments

  • Arjan_SomersArjan_Somers Member Posts: 64
    To Run the code that is run when manually inserting code use:

    Rec.INSERT(TRUE); --- instead of --- Rec.INSERT;

    And

    VALIDATE(Rec.Field, 'NewValue'); --- instead of --- Rec.Field := 'NewValue';
  • sabzamsabzam Member Posts: 1,149
    Hi,

    Thanks for your prompt reply. I will test it out and let you know whether it works properly.

    Good evening.
  • sabzamsabzam Member Posts: 1,149
    Hi Everybody,

    I have got an issue with an insertion through validate. I am trying to use validate on a locatiop code in the Sales Header and it is not working. I am assuming that this is because it prompts a message which the user is to confirm. Is it possible to skip this step and force an insertion?
  • LeonhLeonh Member Posts: 8
    If there is a confirmation dialog box generated by the validation code then it should trigger as normal. Could you post your code?
  • diptish.naskardiptish.naskar Member Posts: 360
    Hi,

    Please don't go for the force insertion through the code in the location code. But use the validate as suggested. If possible use the debugger to see if the code that you have writtent is triggering or not.
    Diptish Naskar
    For any queries you can also visit my blog site: http://msnavarena.blogspot.com/
Sign In or Register to comment.