Anyone know how to set the value of a WF field fro...
# suitescript
j
Anyone know how to set the value of a WF field from inside a WF custom action script?
b
im not sure thats a thing you can do.. you can return a value from the workflow action script
and then set the value of the field from the workflow
you can try sharing the ss1 code that you received and i might be able to tell if there is a ss2 equivalent
j
The reason I'm trying to do it this way is because they told me to, because there's a defect when I try to return the value to a non-stored WF field
Hi Jennifer, Good Day! This is Brian from the SuiteBuilder team and I will be assisting you with this case moving forward. I have reviewed the case and If I understood the concern correctly it would be as follows. Concern: It seems that the issue happens specifically for the workflow fields having List/Record types and the Store Value = F When the Store Value is set as TRUE, there are no issues When the Store Value is set as FALSE, we're encountering an "Invalid Reference Key" because the value being used is a decimal Investigation: Upon reviewing the script, and the Custom Action, we're using the "Store Result In" field on the Custom Action component to set the value of the field. Given that this is generating an error, we've tried to use a different approach. Instead of setting the value of the field via the "Store Result In". I've made a copy of the script, wherein the we'll set the value of the field using the function nlapiSetFieldValue. Updated the Script Record and removed the parameters Results: The workflow was able to set the value of the workflow field The workflow was also able to use the value of the field and use it as a parameter for other actions without any errors. Assessment: We do agree that there is a disconnect on the functionalities. However, given the business used case for this case, the urgency level for this concern would be less likely to be prioritized. That said, what I recommend for now is if we can just update the scrip and utilize the nlapiSetFieldValue function to set the value of the workflow field instead so that we can set the property "Store Value = F" on our workflow fields. Kindly let me know your thoughts on this. Regards, Brian
basically I'm trying to return a customer ID, and put it into a non-stored WF state field
I get this error about Invalid Reference Key as it adds ".0" on the end of the value. E.g. if customer id is 4013, it returns the right value, but the error thinks it's "4013.0"
and throws an error
b
i dont suppose you have tried returning it as a string
j
I've had similar issues elsewhere
Yes, I'm rounding it, parseInt, format to INTEGER
doesn't help
b
huh
j
it's been fun
I really REALLY don't want to have to store the value. This causes us all sorts of grief down the road
b
rounding, parseInt, format arent ways to make it a string
j
I don't want it to be a string
I've tried everything to keep it NOT a string
the format trick works elsewhere in SuiteScript
b
are you doing math on it or something?
j
no
it's literally just an ID
works perfectly if the field it's going into has "store value" ticked
b
return the string
netsuite probably wont interpret it as a number if its a string
j
return param should be a List/Record though
hm
let me try
well f*ck me it works
So to force something to not be a turned into a string, I make it into a string
that's terrible
b
ask for whatever ss1 code they used to test
i want to see how they set the field