cAN YOU ACCess landedcost tab on Item receipt via ...
# ask-stanley-ai
r
cAN YOU ACCess landedcost tab on Item receipt via suitescript
c
AI generated answer (using internal Slack threads):
Based on the conversations provided, it appears that you can access and manipulate the landed cost tab on an Item Receipt via SuiteScript. However, there are a few things to note: 1. You need to load the item receipt record in your script. Here's a sample code snippet:
Copy code
code
var item_receipt = record.load({
    type: 'itemreceipt',
    id: itemReceiptId
});
2. You can check if a landed cost sublist subrecord exists on a specific line of the item receipt:
Copy code
code
var existing_sublist = item_receipt.hasSublistSubrecord({
    sublistId: 'item',
    fieldId: 'landedcost',
    line: lineId
});
3. If the landed cost sublist subrecord exists, you can get it and set its values:
Copy code
code
var existing_landed_cost = item_receipt.getSublistSubrecord({
    sublistId: 'item',
    fieldId: 'landedcost',
    line: lineId
});

existing_landed_cost.setSublistValue({
    sublistId: 'landedcostdata',
    fieldId: 'landedcostcategory',
    value: 1,
    line: lineId
});
4. It's important to note that this approach works in both standard and dynamic modes. However, you need to ensure that your line numbers and field IDs are correct. 5. If you're encountering unexpected errors, it might be due to the absence of a landed cost subrecord. In such cases, you might need to create a sublist subrecord. ****** 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.838146448
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.838018298
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.837463439
Please provide your feedback on this answer.