Hey All !! I want to set value field: "taxcode" in...
# suitescript
h
Hey All !! I want to set value field: "taxcode" in withholding tax subtab through restlet(script) . i tried using record.load/record.setvalue but that did not work. is there any other way to do that?
objRecord.setValue({
            
fieldId: 'custpage_4601_witaxcode',
            
value: taxcode
        
});
n
What's the issue that you are facing?
which record are you loading?
h
I am trying to save invoice from restlet. Issue is that even when I try to set tax code in withholding tax subtab from restlet no value is entered in it when we actually open the saved invoice.
c
@humzariaz don't you have to call .save() ?
Untitled
load / setValue / save
n
Yeah, my question too. are you saving the invoice after setting the field value?
h
function Post(body) {
        
var internalid = body.internalid;
        
var objRecord = record.load({
            
type: record.Type.INVOICE,
              
id: internalid,
            
isDynamic: true,
        
});
            
objRecord.setValue({
            
fieldId: 'custpage_4601_witaxcode',
            
value: 61
        
});
        
taxcode = 'taxcode: ' + taxcode
        
objRecord.selectLine({
            
sublistId: 'item',
            
line: 0
        
});
        
objRecord.setCurrentSublistValue({
            
sublistId: 'item',
            
fieldId: 'custcol_4601_witaxapplies',
            
value: true,
            
ignoreFieldChange: false
        
});
        
objRecord.commitLine({
            
sublistId: 'item'
        
});
            
var recordId = objRecord.save({
                
enableSourcing: true,
                
ignoreMandatoryFields: false
            
});
        
return JSON.stringify(recordId);
    
}
Yes i am saving record and it will return Internal id Properly but values are saved in that "TaxCODE" Field
NotSaved*
s
@NickSuite I think these are temporary fields as its prefix is "custpage" which is used in fields created using user event scripts instead of "custbody" which are by default the prefix for body fields. Am I right?
n
@Salman Afzal, yes, you have a valid point. @humzariaz can you confirm if this field is being created using Userevent? Since the ID should start with custbody instead of custpage. Also, please recheck the field Id - if it is a custom field created using SuiteBuilder, then it should start with custbody
s
I believe its a part of a "withholding tax" bundle provided by netsuite. Are you familiar with that bundle? @NickSuite
c
There are all the tax related fields on the invoice record
Where is your field coming from? It's not standard
n
@Salman Afzal, I am not familiar with it. @Craig it is a custom field.... but as @Salman Afzal stated, it might be created via UE instead of SuiteBuilder.
c
Custom fields are called custbody
custpage I think comes from a custom field added by a frontend suitelet
h
As @Salman Afzal Said it is part of the "withholding tax " Bundle. Not sure if the fields are created from UE or suite-builder
n
@humzariaz then you cannot set it via loading and saving.
c
No because that field doesnt' exist on the record
h
okay thank you all
c
Update us on your solution, always keen to see how people are solving NS issues
You could consider creating a field on the record and saving your data there
h
@Craig but that would not provide the required GL Impact. Really in a bind here not sure of the solution.
will update you if i find a solution
c
awesome thanks
n
@humzariaz you can create a Markup item and add it to the lines. It will have the GL Impact.