Hi all,
While posting Sales Credit memo I am trying to update the Reason Code field of "Sales Invoice Header" table through code,but its not getting updated and the same is happening with partner license. Is there any way to do this without partner license.
0
Comments
what's your code?
http://www.BiloBeauty.com
http://www.autismspeaks.org
i have written the following code:
IF SalesInvHeader.GET("Applies-to Doc. No.") THEN BEGIN
SalesInvHeader."Reason Code":=Rec."Reason Code";
SalesInvHeader.MODIFY;
END ELSE BEGIN
MESSAGE('Invoice No. not Found');
END;
I've added the message field so you can see when the value exists.
If you try it again you'll see if you use the lookup to get the Invoice number- your code doesn't work.
But if you copy the invoice number and paste it into the "Applies-To Doc. No." it will!
the lookup is not triggering the OnAfterValidate.
OnAfterValidate()
IF SalesInvHeader.GET("Applies-to Doc. No.") THEN BEGIN
SalesInvHeader."Reason Code":= "Reason Code";
MESSAGE('%1',"Applies-to Doc. No.");
SalesInvHeader.MODIFY;
END ELSE BEGIN
MESSAGE('Invoice No. not Found');
END;
But with a regular customer license you should then get an error saying you're not allowed to modify the Sales Invoice Header Table. Then (for me) I would then have to edit CU391 to allow me to change that field.
http://www.BiloBeauty.com
http://www.autismspeaks.org
how can we do this??
SalesInvoiceHeaderEdit(SalesInvoiceHeader : Record "Sales Invoice Header")SalesInvoiceHeader2 := SalesInvoiceHeader;
SalesInvoiceHeader2.LOCKTABLE;
SalesInvoiceHeader2.FIND;
SalesInvoiceHeader2."Reason Code" := SalesInvoiceHeader."Reason Code";
SalesInvoiceHeader2.MODIFY;
SalesInvoiceHeader := SalesInvoiceHeader2;
I know this makes the field editable but not sure if updating it thru code from another form will work. Testing is needed & your partner should help.
I'm guessing it should still crash on -> SalesInvHeader.MODIFY;
Ever thought about using the Credit & order Comments?
http://www.BiloBeauty.com
http://www.autismspeaks.org