I have a very simple script, it create credit memo...
# suitescript
s
I have a very simple script, it create credit memo but for some reason, it generate an error when saving This is the script (partial) var rec= record.create({type: record.Type.CREDIT_MEMO,isDynamic: true}); rec.setValue({fieldId: "entityid",value: 36459}); rec.setValue({fieldId: "location",value: 11 }); rec.save(); Then I get this error ""INVALID_FLD_VALUE","message":"You have entered an Invalid Field Value 11 for the following field: location","id":"","stack" The location number is 11. I don't know where to look anymore. Is it possible that a location belong to a "subsidiary" ? A customer ? A... I don't know Any idea ?
n
Yeah the location is filtered from the customer.
e
Is
11
a real and active
ID
for location? Try the same location in Credit Memo in the UI and the same customer as the CM
n
Notice how if i don't select a customer it doesn't give me any locations But if select one then i get the option to choose location
s
I can create the credit memo manually but cannot assign it in the script
I'm doing something wrong.. but I don't know what
b
start at creating the credit memo in the ui
whats the first field you set
s
It looks to be something related to the subsidiary
It's working fine in the UI. In the script I do the same thing, and it's not working. Very strange
b
same question, whats the first field you set in the ui
s
Custom Form: Customer:
b
whats the internal id of the customer field
s
I created a Scheduled Script var rec= record.create({type: record.Type.CREDIT_MEMO,isDynamic: true}); rec.setValue({fieldId: "entityid",value: 2666 }); rec.setValue({fieldId: "location",value: 14 }); rec.save(); I tried a different location, same issue
b
good, and how are you determining the internal id of the customer field
you clearly aren't setting Customer as the field id, so you know the label isnt the same as the internal id
1
s
not sure I understand the question. It's the ID that we see in the URL when looking at the customer
b
that the internal id of the customer
which is what you use for the value
s
sorry
b
however im asking for the internal id of the customer field
which is used as the fieldId
s
Cra.... The customer has 2 id. I was using the wrong one. Sorry. Thanks everyone for your help