We have an issue with tracking numbers generation,...
# ask-stanley-ai
i
We have an issue with tracking numbers generation, where the field is populated with an API error message. Problem is, I’ve looked at the scripts that are running on Item Fulfillment and Package Contents records, and none of them is generating tracking numbers. We have one script that is receiving tracking numbers and saving them to the correct field, and when printing debug messages, it shows the context as “suitelet”. Is there any way to get additional information about the context it’s called from?
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems like you're dealing with a complex issue. The tracking numbers are not being generated by any of your scripts, but instead, an API error message is being populated in the field. You've also mentioned that the context shows as "suitelet" when printing debug messages. To get additional information about the context it’s called from, you can use the
executionContext
property of the script context object. This property returns a string representing the context in which the script is executing. For example, if the script is executing as a suitelet, it will return "SUITELET". Here is a sample code snippet:
Copy code
javascript
function yourFunction(context) {
    var execContext = context.executionContext;
    console.log('Execution Context: ' + execContext);
}
This will print the execution context to the SuiteScript logs, which can help you identify where the script is being called from. However, if the tracking numbers are being populated with an API error message, it's possible that the issue lies with the API or the process that's calling the API. You may need to debug the API call or check the API documentation to see if there are any known issues or limitations that could be causing this problem. Remember, the tracking numbers are usually stored in the
packagetrackingnumber
field in the 'package' sublist of the Item Fulfillment record. You can access this field using the
getSublistValue
method, as shown in the conversations. Here is a sample code snippet:
Copy code
javascript
var record = context.currentRecord;
var trackingNumber = record.getSublistValue({
    sublistId: 'package',
    fieldId: 'packagetrackingnumber',
    line: 0
});
console.log('Tracking Number: ' + trackingNumber);
This will print the tracking number to the SuiteScript logs, which can help you verify if the correct tracking numbers are being saved to the field. ****** 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.845816731
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.84320277
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.84234488
Please provide your feedback on this answer.
i
already done this, this is how i figured out the context was “suitelet”