This topic contains 1 reply, has 0 voices, and was last updated by kreylingj 7 years, 6 months ago.
-
AuthorPosts
-
May 16, 2017 at 1:16 pm #6404
kreylingjI have a process that retrieves an order fulfillment transaction, creates an external ASN document and then updates a custom checkbox on the fulfillment to reflect the ASN was created.
When I do this, NetSuite attempts to compare and update a number of fields. Can this be prevented? I am getting errors on protected fields.
Below is my code:
tsr = webService.search(tsb)
‘ Update Centerstone ASN Created Flag
If tsr.status.isSuccess And Not tsr.recordList Is Nothing And tsr.recordList.Length > 0 Then
Dim iff As ItemFulfillment = DirectCast(tsr.recordList(0), ItemFulfillment)
For i = 0 To iff.customFieldList.Length – 1
If iff.customFieldList(i).scriptId = “custbody_centerstone_asn_created_flag” Then
‘ Set Centerstone ASN Created Flag to True
Dim asnc As BooleanCustomFieldRef = New BooleanCustomFieldRef
asnc.scriptId = “custbody_centerstone_asn_created_flag”
asnc.value = True
iff.customFieldList(i) = asnc
asnc = Nothing
‘ Update Item Fulfillment
Dim response As WriteResponse = webService.update(iff)
‘ Exit Loop, update performed
Exit For
End If
Next
End If
This is a cached copy. Click here to see the original post. -
May 16, 2017 at 1:55 pm #6405
kreylingjI just realized that I don’t have to pull down the item fulfillment to update it. I just create a new item fulfillment and only specify the one field I wan to update. It appears that since I was populating all the fields it had to compare everything.
Is this the correct way to do updates?
If Not internalId Is Nothing Then
Dim iff As ItemFulfillment = New ItemFulfillment
‘ Set Internal Id
iff.internalId = internalId
‘ Set Centerstone ASN Created Flag to True
Dim asnc As BooleanCustomFieldRef = New BooleanCustomFieldRef
asnc.scriptId = “custbody_centerstone_asn_created_flag”
asnc.value = True
iff.customFieldList = New CustomFieldRef() {asnc}
asnc = Nothing
‘ Update Item Fulfillment
Dim response As WriteResponse = webService.update(iff)
End If
-
AuthorPosts
You must be logged in to reply to this topic.