Hey guys! I'm hoping someone can help me figure t...
# suitescript
j
Hey guys! I'm hoping someone can help me figure this one out. I am trying to assign the proper shipcarrier etc. while creating an item fulfillment record carrierform, shipcarrier and shipmethod. When assigned these items as a default value, I get an "invalid transform" error. The code is: var ifRecord = r.transform({ fromType: r.Type.SALES_ORDER, fromId: PODetail.createdfromSO, toType: r.Type.ITEM_FULFILLMENT, isDynamic: true, defaultValues: { carrierform:carrierform, shipcarrier:shipcarrier, shipmethod:shipmethod } I search in NS and couldn't find a related suiteanswer article. I did however find this article which originally helped resolve the issue: https://stackoverflow.com/questions/55361487/changing-ship-method-on-fulfillment-in-suitescript I was able to use the suitescript 2.0 method for submitField to update the itemFulfillment record after saving, which worked fine initially but apparently created a secondary issue that we were not aware of where ship notifications that are sent through one of the installed bundles are apparently only created properly when those fields and the shipbox record are all created initially. I'm being asked to set the fields during creation. It seems that you can't simply use setValue etc. to set these fields either. This would also be much more efficient than initially saving and then using record.submitField and then reloading the record in order to set the appropriate values, and then saving again.. Is there some other way that I'm not aware of to get those three fields set properly prior to saving the item fulfillment record initially? There must be some solution to this, I just can't find any articles about it other than the one linked above.
e
Wouldn't a beforeSubmit script do the job?
j
Hey ec, thanks for the reply, I didn't get a notification. No unfortunately not. Its really strange you can't use record.setFieldValue for setting the shipping form, nor can it be specified as a default value. The only luck I've had is to save the record, then use record.submitFields to update the form, then reload the record. That works, but its creating issues with other scripts that do things on initial save.