can I set a field value on saveRecord for a Client...
# suitescript
j
can I set a field value on saveRecord for a Client Script? I've been trying but keep getting errors. Would it better as a user event?
j
you can set field values during that stage. what errors are you seeing?
j
message has been deleted
var rec = context.currentRecord; var dateTime = "01/01/2019 4:20 pm"; rec.setValue({ fieldId: custbody_recdatetimetext, value: dateTime});
@jarens
j
What's the bit of your code that you're running the toLowerCase function?
j
I have no idea, I think it's something to do with context.currentRecord
@jarens the rest of my code is just hardcoded values for now until I get it working
b
you use setText for datetime string
you use setValue for a Date
j
still getting the same error with setText
b
you may also want to set ignoreFieldChange to true to ignore other client scripts
if for some reason you are doing sourcing on your date time field, you should set forceSyncSourcing to true
j
nevermind I was being stupid
missed the quotes off the field id
thanks for the help though @jarens @battk