I am not able to edit an item fulfillment record ....
# suitescript
a
I am not able to edit an item fulfillment record . When i run a script on it it shows the following error {"type":"error.SuiteScriptError","name":"INSUFFICIENT_PERMISSION","message":"You do not have permissions to edit this transaction.","stack":["anonymous(N/serverRecordService)","takeAction(/SuiteScripts/Webhive/ma_asn_value_assign_script(1 time).js:52)"],"cause":{"type":"internal error","code":"INSUFFICIENT_PERMISSION","details":"You do not have permissions to edit this transaction.","userEvent":"beforeload","stackTrace":["anonymous(N/serverRecordService)","takeAction(/SuiteScripts/Webhive/ma_asn_value_assign_script(1 time).js:52)"],"notifyOff":false},"id":"","notifyOff":false,"userFacing":false} How can i solve this issue ? can anyone guide
b
the error looks accurate, you are missing the edit button from the item fulfillment, so yor role probably lacks permission to edit the fulfillment
what does your code look like? Keep in mind that its generally a terrible idea to modify records during beforeLoad
a
Its only showing for some specfic item fulfillment records .. I can edit many other Item fulfillment records , only some records have this issue
I can edit this one .. This is also an item fulfillment record
It seems like the item fulfillment records created before a certain date are all not editable .. One's that are after the date are editable
b
is the accounting period closed?
a
i think that might be the issye
*issue
var id=resultset[result].id;                 var fulfillment = record.load({                   type: record.Type.ITEM_FULFILLMENT,                   id: id                                 });               var asn_sublist_count=fulfillment.getLineCount({sublistId: 'custpage_asnsublist'}); asn_sublist_count is returning -1. how can i solve this issue .. I am trying to fetch item fulfillment records from saved search and checking the sublist count but it should return 1 .. its returning -1 always
b
what sort of script are you using
a
i am using scheduled script .
b
the custpage tells you that the sublist was added via a user event script beforeLoad
make sure that whichever user event script is adding the sublist has an audience that includes your scheduled script
a
I just want to get its line count .. For each record from saved search i want to get this sublist line count
b
you are getting -1 because the sublist does not exist
a
so that means its not available on record.load
b
its likely that it doesnt exist because the user event script that creates the sublist is not running for your scheduled script
find the user event script that adds the sublist and find out why it isnt running
a
Its part of SPS .. I don't think i can edit that userevent script ..
The scheduled script was working fine in sandbox environment
when i made it live only then its not working
b
its a custom sublist added by a user event script, you would need to understand how the script works to see why its not adding the sublist
a
Understood . Thanks for help sir