Community

Add Purchase Order item Answered

Hello All,

is there a way that i can add this in a programatic way ?
I Merge at this time a value from a other place to the purchase order group.
But it was only added in "Background"  --> means, when i click on Add Purchse Order Item it is prefilled.

 

0

Comments

3 comments

  • Avatar
    Lars Urban

    No Idea ? =`(

    0
  • Avatar
    Adrian Enders

    Well, in the FCI demo there is a workflow stage called "Clear Line Items". This is backwards, it deletes. But there is an "AddNew" method. Perhaps this will get you going. Code below.

     

    if (Document.Field("Invoice Layout\\PurchaseOrder").Items.Count == 0)

    {

        for (int i = Document.Field("Invoice Layout\\LineItems").Items.Count - 1; i >= 0; i--)

        {

            IField  objDeleteField = Document.Field("Invoice Layout\\LineItems").Items[i];

            Document.Field("Invoice Layout\\LineItems").Items.Delete(objDeleteField);

        }        

    }

    0
  • Avatar
    Lars Urban

    Hi Adrian,

    thank you very much for pointing me in the right direction ;-)

    In the meantime we have added a script inside the Document definition --> Event Handler --> After document state changed

     

    using System;      


    if(Document.Field("Invoice Layout\\spec_Add_FL\\PurchaseOrderFL").Text != "")
        {    
            Document.Field( "Invoice Layout\\PurchaseOrder" ).Items.AddNew( 0 );       
        }


    // Check again the rules
    Document.CheckRules();   

     

    But one more question, you say "FCI demo" , i can not really find that in our installation ;-)

     

    0

Please sign in to leave a comment.