Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SS1 record setFieldText and findLineItemValue. #12

Merged
merged 3 commits into from
Nov 23, 2018

Conversation

paulclarkaranz
Copy link
Contributor

@paulclarkaranz paulclarkaranz commented Nov 21, 2018

The setFieldText is NOT the same implementation as in NetSuite. There if you use setFieldText and then getFieldValue on an optionset field you will get an integer back, here you will get a string back. This is fine form my purposes though and is the same as the implementation in the SS2 module.

The findLineItemValue is very similar to the other *LineItem* methods but I thought I would add a test for it anyway for good luck.

I have taken ownership of some SS1 code with no tests around it so you might see some more contributions like this from me in the future, if you are open to them. I'm not actually aware of any trends regard SS2 vs SS1, should I be porting v1 code to v2?

edit: I pushed a couple of fixes for issues I ran across.

The `setFieldText` is NOT the same implementation as in NetSuite. There
if you use `setFieldText` and then `getFieldValue` on an optionset field
you will get an integer back, here you will get a string back. This is
fine form my purposes though and is the same as the implementation in
the SS2 module[1].

The `findLineItemValue` is very similar to the other *LineItem* methods
but I thought I would add a test for it anyway for good luck.

[1]: https://github.com/3EN-Cloud/netsumo/blob/0b4ff26c7645f2e5d531c314b06b550d7389def9/modules/SS2/Record.js#L86
Previously doing:

```
var record = nlobjRecord('customer', 1234)
record.selectNewLineItem('addressbook')
record.setCurrentLineItemValue('addressbook', 'attention', 'Sam')
record.commitLineItem('addressbook')
record.selectLineItem('addressbook', 1)
record.setCurrentLineItemValue('addressbook', 'attention', 'Tom')
record.commitLineItem('addressbook')
nlapiSubmitRecord(record)
```

Would have added to new address to the record instead of adding one and
then modifying it, what is what happens in NetSuite.
@benpf-pes benpf-pes merged commit f3a9cb8 into 3EN-Cloud:master Nov 23, 2018
paulclarkaranz added a commit to seequent/netsumo that referenced this pull request Nov 26, 2018
Similar to in 3EN-Cloud#12, add `setCurrentLineItemText` to set
line item list fields by display string.

And the same caveat applies, getting the value later won't return the
index like it would in NetSuite.
paulclarkaranz added a commit to seequent/netsumo that referenced this pull request Nov 26, 2018
Similar to in 3EN-Cloud#12, add `setCurrentLineItemText` to set
line item list fields by display string.

And the same caveat applies, getting the value later won't return the
index like it would in NetSuite.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants