For some reason, this code is not changing the pos...
# suitescript
m
For some reason, this code is not changing the posting period on expense reports. Any idea why that would be? We're trying to script changing the period on expense reports if they're entered while AP is locked but the period is still open. For some reason, the "Default Posting Period when Transaction Date in Closed Period" does not apply in this instance because the period is not fully closed. Any thoughts?
Copy code
record.load({ type: 'expensereport', id: 11274100 })
     .setValue({ fieldId: 'postingperiod', value: 271 })
     .save();
a
Pretty sure posting period is determined based on
trandate
, change the tran date will change the posting period... hmm or I think if the period its currently in is locked you're not going to be able to change it out of a locked period
sorry its early and I didn't even read your question, this is a terrible answer given the context you've provided already... I have no idea 😄
c
@Mike Robbins Does the role executing the script have adequate permissions?
m
@Clay Roper Yes. I'm currently testing this in the Administrator role.
c
And you're able to make this same change in the UI?
m
No. In the UI, the field is disabled for some reason. I don't have a script or workflow that is disabling it.
I figured it out. We can't set the posting period until the
accountingapproval
box is checked. Once this is checked, I can set the period to any open period. Thanks for helping me work through it. 🙂
🌟 1
c
@Mike Robbins Great to hear, and I'll file that away for future reference