This topic contains 3 replies, has 0 voices, and was last updated by Nelliott 8 years, 8 months ago.

  • Author
    Posts
  • #2874

    QueenBee

    I’m trying to add a custom transaction column to our invoices to store values on the expcost and itemcost tabs.

    I’ve created the column and applied it to Sale Item.

    When I edit an invoice the column is not displayed on the expcost/itemcost tabs. This is actually OK as I don’t want to see it. It does display on the main item tab.

    In a before submit user event script when the event type is either create or edit I set the value using:

    nlapiSetCurrentLineItemValue(‘expcost’, ‘custcol_syn_sales_expense_category’, expenseCategoryId);

    When I’m returned to the invoice in view mode the custom column is displayed and the value is populated.

    Then if I submit the invoice for approval using a workflow button when I go back to viewing the invoice the values are cleared.

    The history of these lines is empty.

    Any ideas?
    This is a cached copy. Click here to see the original post.

  • #2875

    Nelliott

    A custom “transaction column field” is used on a sublist not on the main body of a record for that you would want a “transaction body field”

    The before submit functionality would kick in just before you save the record.

    You would, I believe, have already navigated away from the currently selected line so I don’t think that nlapiSetCurrentLineItemValue is appropriate because I don’t think that the system would know what the currently selected line is.

    I believe you would be better creating a client script and have your function fire on one of the line events such as “validate line function”.

    Without knowing more about the workflow it’s impossible to comment on it.

    I notice you mention the “values are cleared”, plural, you would have to loop through the lines to set each in turn if you need to set a value on multiple lines.

    Neil.

  • #2876

    QueenBee

    Originally posted by Nelliott

    View Post

    A custom “transaction column field” is used on a sublist not on the main body of a record for that you would want a “transaction body field”

    The before submit functionality would kick in just before you save the record.

    You would, I believe, have already navigated away from the currently selected line so I don’t think that nlapiSetCurrentLineItemValue is appropriate because I don’t think that the system would know what the currently selected line is.

    I believe you would be better creating a client script and have your function fire on one of the line events such as “validate line function”.

    Without knowing more about the workflow it’s impossible to comment on it.

    I notice you mention the “values are cleared”, plural, you would have to loop through the lines to set each in turn if you need to set a value on multiple lines.

    Neil.

    itemcost and expcost are sublists so transaction column field is the correct type of custom field.

    I use nlapiSelectLineItem to iterate through the lines so the system knows what the selected line is.

    As I said everything is working great and the values are set when returned to view the record. But once the record goes through the approval workflow the values are cleared.

  • #2877

    Nelliott

    My misunderstanding of course, I mistook the “tabs” as being that not sublists! If I get 5 I’ll have a think on this for you.

You must be logged in to reply to this topic.