This topic contains 3 replies, has 0 voices, and was last updated by Nelliott 8 years, 8 months ago.
-
AuthorPosts
-
March 3, 2016 at 12:01 pm #2874
QueenBeeI’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. -
March 4, 2016 at 3:38 am #2875
NelliottA 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.
-
March 4, 2016 at 8:23 am #2876
QueenBeeOriginally 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.
-
March 16, 2016 at 6:56 am #2877
NelliottMy 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.
-
AuthorPosts
You must be logged in to reply to this topic.