This message was deleted.
# suitescript
s
This message was deleted.
m
There is an
orderline
field you can use to match the fulfillment line back to salesorder line
👍 1
c
@michoel it looks like orderline is not always populated
I can see an SO without any values
I also see a TO where this value is populated
and this TO doesn't have it set.
I'm transforming SOs and TOs but I need to remove specific lines from the fulfilment if they don't have c checbox selected. Before the fulfilment is saved, I am setting noreceive as true.
Another way I could do this is to not use record.transform() and instead just hand populate each required field into a standalone fulfilment record then set the 'created from' mainline field to link back to the parent transaction. That's a lot more effort than using transform though.
m
orderline
would be on the fulfilment record. You can't create a standalone fulfilment, nor can you you manually set createdfrom
c
message has been deleted
This field looks like a better candidate for matching
m
What are you trying to match? That field would have different values on the two records
c
I can see that the field has same values across TO and IF
I haven't checked against an SO yet
m
Huh that doesn't make sense
It's called unique for a reason
c
Left is SO, right is IF
Unless this plugin doesn't work side by side in the same session and it might just be showing the same thing!
Which might be the case.
m
Yeah that's probably it
c
haha
damn
back to the drawing board
Copy code
let lineuniquekey = so.getSublistValue({sublistId: 'item', fieldId: 'lineuniquekey', line: i});
var lineNumber = invoice.findSublistLineWithValue({
    sublistId: 'item',
    fieldId: 'lineuniquekey',
    value: lineuniquekey
});
invoice.removeLine({sublistId: 'item', line: lineNumber});
That means this code is broken then!
But it's been in prod for a year
m
🙈
c
I hope those invoices haven't been wrong for 12 months
This particular customer has lots of requirements that mandate removing lines from transformed records.
and the only way to do that is to findSublistLineWithValue
so there needs to be a field that matches between both sets of item sublists, the field has be unique to the line but not unique across sublists if that makes sense.
There's a chance that the lineuniquekey is actually the same in the SO and the IF until the point you .save() the IF. So as long as you do your processing before .save(), you should be safe.
m
Hmm could be. I'd expect the lineuniquekey to be generated by DBMS so until you save if there is a value on IF it would make sense that's just carried over from the SO
c
Other than that field, I've tried orderline but it didn't look like it was always set
and findSublistLineWithValue would fail when using the orderline as the value.
I wish the transform function was more fine grained and let me specify a list of what I actually want to transform.
it assumes you want everything.
Also, orderline isn't actually in the record browser
I was also under the impression that you could do record.create() fulfilment then set the createdfrom(so_id) then .save(). .. maybe not possible with IF?
m
Pretty sure that's not possible
c
So doing a transform then removing lines is the only option
m
In general NetSuite won't allow you to set createdfrom manually
Also there is no such thing as a standalone IF
c
When I say standalone, I just mean it hasn't been saved. I know this isn't possible in the UI, I thought SS might be different but could be wrong.
d
Might be able to help with
orderline
. for SO-IF-Invoice matching, you get SO
line
=== IF and Invoice
orderline
for TO-IF-IR matching, you get SO
line
=== IF
orderline - 1
=== IR
orderline - 2
i.e. a matching line across TO/IF/IR will be
line
1,
orderline
2,
orderline
3
👍 1
c
@David B this is only after the IF has been saved right?
If I've got the resulting IF record from a transform() I assume the orderline hasn't yet been set?
In which case, the line should match the order (SO or TO) and the fulfilment UNTIL the fulfilment is saved?