suitescript inventoryTransfer.setValue({ ...
# ask-stanley-ai
r
suitescript inventoryTransfer.setValue({ fieldId: 'location', value: requestBody.curLoc // Transfer from location }); the internal id is 6 but when requestBody.curLoc = 6 get error "INVALID_FLD_VALUE
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems like the issue is related to setting the 'location' field in an inventory transfer record. The error 'INVALID_FLD_VALUE' usually occurs when the value provided for a field is not valid or does not exist in the system. In the context of setting the 'location' field, it's important to ensure that the location with the internal id '6' actually exists in your NetSuite account. If the location does not exist or is inactive, you will get the 'INVALID_FLD_VALUE' error. Here is a sample code to check if a location exists:
Copy code
javascript
var locationRecord = record.load({
    type: record.Type.LOCATION, 
    id: 6,
    isDynamic: true,
});

if(locationRecord){
    log.debug({
        title: 'Location Exists',
        details: 'The location with internal id 6 exists.'
    });
} else {
    log.error({
        title: 'Location Does Not Exist',
        details: 'The location with internal id 6 does not exist.'
    });
}
If the location with internal id '6' exists and is active, but you're still getting the error, it might be due to the context in which you're trying to set the 'location' field. If you're trying to set the 'location' field in a user event script or a scheduled script, you should be able to do so without any issues. However, if you're trying to set the 'location' field in a client script, you might encounter issues due to permissions or restrictions on the client side. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.837995052
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.834893644
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.833678901
Please provide your feedback on this answer.