How to save a reference value to another record in NetSuite - netsuite

I've created a custom Transaction Body Field named "Created From" of type List/Record - Transaction
That I want to be have like the native NetSuite Created From fields. I have added this custom field to the Customer Refund form and when entering (or editing) the refund if I give a value of "Sales Order #1234" it saves correctly and becomes a link to the sales order. But when I try to set it using code
customerRefund.setFieldValue("custbody_ifx_created_from", "Sales Order #" + salesOrderId);
id = nlapiSubmitRecord(customerRefund);
This error is generated
Error: INVALID_KEY_OR_REF
Invalid custbody_ifx_created_from reference key Sales Order #81388396.
How can I create a valid key or reference to another record?

The type of your custom field is list/record->transaction. You need to populate it with the internal id of a transaction record. That will allow you to submit the record. When viewed through the UI, it will display the 'Sales Order# XXX' text as expected.
customerRefund.setFieldValue("custbody_ifx_created_from", salesOrderInternalId);
id = nlapiSubmitRecord(customerRefund);

Related

Creating subtabs in netsuite only for given transaction types

I have a tab that i would like to show ONLY on purchase orders and not other transaction types. That tab essentially has an associated custom record's fields on it.
First I made a custom TRANSACTION subtab called "PO Acknowledgement Tab".
Next I have a custom record that I would like to be related to purchase orders only. I made a custom record (call it PO Acknoledgement) that has a number of fields (one of which is a field that is a 'parent transaction' ("record is parent" setting on the field is checked) field that points to the transaction. and of this parent field on the bottom is select that new tab I created. The rest of the fields have no tab set.
This shows just as I would like but the issue is I see it on ANY transaction since the "parent" record field is a Transaction and I cant figure how to filter to only show this tab on PO screens. How would this need to be done to accomplish that?
First is a screen shot of the field inside the custom PO Ack record
And below is the full PO Acknowledgment Record
WS Was correct it seems. "In your custom field, in the Sourcing & Filtering, can you add a filter Filter Using = Type with Compare Type = equal to Value Is = Purchase Order and see if that restrict it to only the PO form? –
W.S"

Link Employee to User in API

Using version 21.210. I am able to create a user via the Contract-Based REST api and I am able to create an employee. How can I link the employee to the user? So, I want to do the equivalent of selecting a "Linked Entity" on the Users screen (SM201010).
I see a ContactID field in the Employee/ContactInfo entity but, it doesn't appear to be mapped to anything. Also, it doesn't show on the entity when I query any employee using a GET and $Expand. I'm thinking that I could use the ContactID from the Employee to plug into the "LinkedEntity" field on the User.
Any thoughts would be great.
TIA!
It is linked by the UserID field on the Contact record(that is linked to the Employee via the Employee.DefContactID field). Users.ContactID is a virtual field but in the RowSelecting event it is populated by selecting a contact record where Contact.UserID is equal to Users.PKID.
So you would need to set the UserID field on the employee's Contact record to the user's PKID value. In addition there is also Employee.UserID that you would want to set equal to the Users.PKID value. The virtual field is populated using that Contact.UserID value but in the RowUpdating handler Acumatica is updating both the Contact and Employee records when Users.ContactID is changed.

NetSuite - Sublist field as link

I have two custom records. They share parent-child record relationship. Child record is shown as sublist view. On Child record, there is a field called Delivery Order. It is a list/record field, But not having hyperlink to open that record. This field is list of a custom record of same name.
There is also a field called Sales Order#, it is a list/record field of Transaction. But it is shown as link which is right.
I want to have hyperlink for Delivery Order. I know that if I use a custom view, I can give a formula(text) field to show that field as a hyperlink, But I want to go with Default View only. I think because of Delivery Order is a custom record, they are not giving hyperlink.

Custom Record For suitelet Sublist -Netsuite

I have a requirement where i should display the details(values) of the custom record in the suitelet sublist.
Now i have to create a custom Record with two fields. One field would be bill payment and other field will have list of bills related to bill payment.
When i create a custom record what should be my field vaues's type?
Appreciate any help.
I would suggest to keep one field of type List/Record and Record option to "Transaction", and second field of type Multiple Select with record option to "Transaction".
Since, the fields can hold reference to any transactions I would recommend writing a user event script which would fire on create/edit and validate that the fields value are always correct.

Fields not transfered in workflow

I created workflow that will send an automatic email and create case record when user create order. The email sends and a case record is created but I have problem that some fields not transferred.
For example, I tried to pass the 'Order Requested Delivery Date' field to the new case 'Description' field. The case record created but the description field is empty.
I would check 3 things.
1) is the "Order Requested Delivery Date" populated on the source record (order)? Sometimes field names can get mixed up easily or you can be pulling the correct field name but from the wrong table
2) What does the audit history of the created record say? Was the field set on creation and then subsequently removed for one reason or anything?
3) Are specific fields on the target record not ever populating? Data type mismatches could be the culprit here.

Resources