This function/query is being used on a `UserEvent ...
# suitescript
a
This function/query is being used on a
UserEvent Script
on
beforeSubmit
, the script runs as
Administrator
and it works perfectly fine for Admins, however, with other roles, I'm getting this error: • "type":"error.SuiteScriptError","name":"SSS_SEARCH_ERROR_OCCURRED" • "message":"Search error occurred: Field 'creditholdoverride' for record 'Customer' was not found." Which does not make any sense on my mind? I'm missing something? is this a NetSuite bug?
If I make a POST request to a Suitelet running as Administrator and available without login, I get the query data back without any issues. Does this means that
UserEvents
on
beforeSubmit
do not fully run AS Administrator?
šŸ¤” 1
a
I've never heard of something like that (before submit as admin being weird) , I'm thinking its something else about the way the users are executing it vs. you as admin that's causing the different results... sorry I can't even make a reasonable guess as to what that would be though. my first thought was it was an inline edit XEDIT event and so you weren't getting those fields... but all you're using here is the customer id from the record, which is never not available.
a
This is deployed to the Sales Order record and only runs on CREATE and EDIT.
a
you've tried specifically with the same sales order?
and therefore same customer id, and get different results depending on role?!
a
People with these roles are unable to create the Sales Order... it does not pass the beforeSubmit CREATE...
I already tried adding many permissions to the roles (even if it does not make sense)... and still no go.
a
right... but can you make a sales order with THAT customer and it runs ok?
and you've isolated it to this function? there's not other code that's running that might be causing this?... oh n/m the error message is actually pretty clear for once šŸ˜„
a
Yep, isolated to this function.
a
... okay so I'm not sure why or how this would explain what you're seeing... I checked the record browser and that field
creditholdoverride
is listed as a select type in the fields section, but a checkbox in the search column section that seemed odd. So I tried to do a UI saved search using the field and my plugin to help with that showed some interesting results...
none of that to say query can't work different from search, and it certainly doesn't explain why its ok for admin but not for non-admin, but I thought it was weird enough to share šŸ™‚
šŸ‘ 1
i
Oh I think i've ran into this issue before.....
It's a user preference setting
I'm pretty sure that if Custom Credit Limit Handling is set to Ignore then it doesn't show up for the user in anything. Very off but I've ran into it once before.
a
@alien4u did Isaac's solution resolve this?
a
@Anthony OConnor No chance to test it yet, but even if that solves it, I will probably stick with the middle-man Suitelet because it would not be easy to maintain setting something for each individual user. I still will test it as soon as I have a chance because it would be very interesting to see that working, those settings as far as I understand them are to show the warning pop-up when creating the SO in the UI and they are driven by a company wide setting (which we are using)...