This topic contains 6 replies, has 0 voices, and was last updated by karenn 7 years ago.
-
AuthorPosts
-
November 1, 2017 at 12:29 pm #17841
karennHello all
Another 1.0 to 2.0 conversion issue.
We need to be able to allow editing of the cost column in the item list of an estimate while adding an item for a specific item. In 1.0 we used
nlapiDisableLineItemField(‘item’, ‘costestimaterate’, false);
Documentation says objField.isDisabled = false; is the equivalent but I have had no luck in getting a valid objField.
How do I enable or disable a field in the current sublist line?
Thanks!
This is a cached copy. Click here to see the original post. -
November 2, 2017 at 5:32 am #17842
JohnCColeIn the context of a custom sublist field the below has worked for me, I’m assuming would work for costestimaterate. Also, I think you would likely want this code to run happen after the item field on sublist changes and on line init
Code:
var rec = scriptContext.currentRecord;
var sItem = rec.getCurrentSublistValue({sublistId:’item’,fieldId:’item’});
// Check the item is set to prevent exception
if(sItem.length > 0){
var fld = rec.getSublistField({sublistId:’item’,line:rec.getCurrentSublistIndex({sublistId:’item’}),fieldId:’costestimaterate’});
if(fld != null)fld.isDisabled = false;
} -
November 2, 2017 at 5:39 am #17843
karennYeah that is what I was trying and I was afraid the error was because we need to be able to do this as the line is being created. We need to be able to add a cost for this one SPECIAL item as the item is being added to the Sales Order.
It is becoming very annoying not being able to do things we used to be able to do in 1.0. 2,0 is taking steps backwards
JohnCCole replied on 11/02/2017, 06:07 AM: I was revisiting my post while you were commenting, see the revision above. If you check for the existence of the item on the sublist and run the code on fieldChange of the sublist item field and on lineinit it still doesn’t work?
-
November 2, 2017 at 6:35 am #17844
karennNo joy.
still same error
undefined(postSourcing)
JS_EXCEPTION SSS_INVALID_SUBLIST_OPERATION CurrentRecord.getSublistField
JohnCCole replied on 11/02/2017, 11:19 AM: Hmmm, have you tried the same kind of operation on a custom column field or maybe even say the amount field as a test. My own experience has been a custom record with a custom sublist and had no issue. I will do a small test on an estimate and see if I get the same kind of error you are.
-
November 2, 2017 at 12:30 pm #17845
karennSame error with other column field
-
November 2, 2017 at 1:16 pm #17846
JohnCColeOk I had to chance to look and custom record with custom sublist things work fine but built-in item sublist this code seems to fail on SS 2.0. I think it’s a bug, but I did remember that SuiteScript 1.0 and 2.0 are running at the same time so this code in postSourcing while not recommended seems to work.
Code:
if(scriptContext.sublistId==’item’){if(scriptContext.fieldId == ‘item’){
setTimeout(function(){window.nlapiDisableLineItemField(‘item’, ‘amount’, true);},10);
}
}
-
November 2, 2017 at 1:28 pm #17847
karennLooks like that might work. Guess we have to do what we have to do sometimes. Thanks so much for all the help!
-
AuthorPosts
You must be logged in to reply to this topic.