Options

How to create a new credit memo

erugalathaerugalatha Member Posts: 120
Hi,

I want to put a button on the Sales List form that, when clicked will fire-up the Sales Credit Memo form with a new blank Credit Memo.

How do I do it in Code?

Thanks for any help.

Comments

  • Options
    AlkroAlkro Member Posts: 115
    To open Form:

    In Bottom - OnPush
    FORM.RUN(XX);
    
    Where XX is Form Number (f.e. 52)

    To open with a blank line... i can't help you
  • Options
    erugalathaerugalatha Member Posts: 120
    Thank you for replying - it's the part of creating a new record and incrementing the No. Series that I am stuck on.
  • Options
    krikikriki Member, Moderator Posts: 9,090
    Try this:
    CLEAR(recSalesHeader);
    recSalesHeader."Document Type" := recSalesHeader."Document Type"::"Credit Memo";
    recSalesHeader.INSERT(TRUE);
    FORM.RUNMODAL(FORM::"Sales Credit Memo",recSalesHeader);
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Options
    erugalathaerugalatha Member Posts: 120
    Hi kriki,

    With this code ... it tells me FORM.RUNMODAL(...) is not allowed in write transactions.

    FORM.RUN seems to run fine.

    Might there be any issues when using FORM.RUN?
  • Options
    krikikriki Member, Moderator Posts: 9,090
    erugalatha wrote:
    Hi kriki,

    With this code ... it tells me FORM.RUNMODAL(...) is not allowed in write transactions.

    FORM.RUN seems to run fine.

    Might there be any issues when using FORM.RUN?
    Forgot that point a moment.
    It is better to use this:
    CLEAR(recSalesHeader);
    recSalesHeader."Document Type" := recSalesHeader."Document Type"::"Credit Memo";
    recSalesHeader.INSERT(TRUE);
    COMMIT;
    FORM.RUNMODAL(FORM::"Sales Credit Memo",recSalesHeader);
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.