Hi! I am trying to change status on a Vendor Retur...
# suitescript
s
Hi! I am trying to change status on a Vendor Return Authorization (expense lines) from Pending Approval to Pending Credit in a SuiteLet script but I don't get it to work. Any ideas on how to do this? I have tried below e.g. but it doesn't work.
Copy code
transactionRecord.setValue({
    fieldId: 'orderstatus',
    value: 'F' //Pending Credit
});
b
dont expect to set the order status to something that you wouldnt be able to set in the ui
s
@battk In the UI I have the button "Approve Return" and if I click on that one it changes the status to Pending Credit. So it works in the UI
b
the equivalent to clicking a button in suitescript is the N/action Module
its supports a limited set of actions
important for the understanding of why it isnt working, setting a field value is not the same as clicking a button
they can do the same thing, but there are things buttons can do that setting fields cant, and setting fields can do things that buttons cant
s
That I understand too 🙂 But I don't know how to capture what's actually happening when I click the button in the UI if something is done in between
b
basic answer is you cant
you cant click that button in suitescript
and you can only set the field when you create it
if you are trying this clientside, you can use javascript to do the equivalent of clicking the button
s
And would that be with the N/action module?
b
with javascript, you can call the onclick function of the button, or you can get the button element and call its click method
s
My problem is that I must do this server-side
w
Have you tested with the other statuses? like 'B'?
s
Hi @Watz! yeah, but it doesn't work either. I don't get any error or anything, just that the status doesn't change