November 20, 201510 yr Greetings, Your expert advice and solution would be greatly appreciated. Based on the Invoice Starter Solution, is it possible to have a script that will automatically add all products from a specific category into an invoice?Of course not everything in one line item but each product in its own line item? The trigger will be set by checking a check box. The process should also not duplicate the item if it already exists. Many thanks for your support. Kunal
November 20, 201510 yr Yes, you could script some logic like: get a list of product IDs for selected category get a list of existing line item product IDs use a custom function like AntiFilterValues to get the product IDs that don't already exist Loop through the IDs to create the records Does that make sense?
November 20, 201510 yr Author Thank you! it does make sense. I just need a pointer as to how to create the loop and creation of those record. Edited November 20, 201510 yr by Kunal Oogorah
November 20, 201510 yr Off the top of my head, assuming you have the product ID list and you're on the Invoice: Set Variable[$invoiceID;Invoice ID] Set Variable[$IDcount;ValueCount($idList)] Set Variable[$i;0] Go to Layout( some layout based on Invoice Data table ) // aka Line Items Loop Set Variable[$i;$i+1] Exit Loop If[$i>$IDcount] New Record // hate their field names Set Field[PRODUCT ID MATCH FIELD; GetValue($idList;$i) ] Set Field[INVOICE ID MATCH FIELD;$invoiceID] End Loop Go to Layout(original)
November 22, 201510 yr Author How did you get the variable $idlist? IDlist would be the list of all items with category "X" right? How did you get this value?
November 23, 201510 yr You said earlier you needed help with the loop (step 4). Now you're saying you need help with the whole thing. I will help, but first tell me, how do YOU think you'd do it? What have you tried?
Create an account or sign in to comment