Vedachalam Mahadevan
04/21/2025, 4:08 PMCeligo AI
04/21/2025, 4:08 PMAI generated answer (using internal Slack threads):To customize the Billable Time list in the Invoice Item tab, you can follow these steps: 1. Go to the customize link on the bill/po record. 2. Navigate to the “sublists” tab and move the items sub tab to the top and save it. You will see Items subtab first and Expenses next. 3. If you want to rearrange the columns in these two sublists, that is also possible via the customize link only. Go to “sublist fields” and select the columns you want to move and drag and drop them off wherever you want to. In addition, you can use SuiteScript to automate the process of setting the 'Billable' checkbox. Here is a sample script that was shared in the thread:
javascript
/**
* @NApiVersion 2.x
* @NScriptType ClientScript
* @NModuleScope SameAccount
*/
define(['N/search'],
function(search) {
/**
* Function to be executed when field is changed.
*
* @param {Object} context
* @param {Record} context.currentRecord - Current form record
* @param {string} context.sublistId - Sublist name
* @param {string} context.fieldId - Field name
* @param {number} context.lineNum - Line number. Will be undefined if not a sublist or matrix field
* @param {number} context.columnNum - Line number. Will be undefined if not a matrix field
*
* @since 2015.2
*/
function fieldChanged(context) {
var rec = context.currentRecord;
var changeFieldid = context.fieldId;
//detect when the Customer entered on a time line
if (changeFieldid == 'customer'){
var currCustomer = rec.getCurrentSublistValue({
sublistId: 'timeitem',
fieldId: 'customer'
});
//find the time item for this Customer record
var defaultItemId = getCustomerItemDefault(currCustomer);
if (defaultItemId) {
//if there is an item, populate it to the line
rec.setCurrentSublistValue({
sublistId: 'timeitem',
fieldId: 'item',
value: defaultItemId
});
rec.setCurrentSublistValue({
sublistId: 'timeitem',
fieldId: 'isbillable',
value: true
});
//we need to commit the line so that is billable populates.
rec.commitLine({
sublistId: "timeitem"
});
}
}
}
//returns the service time item for this client.
function getCustomerItemDefault(custId){
var customerSearchObj = search.create({
type: "customer",
filters:
[
["internalidnumber","equalto",custId]
],
columns:
[
"custentity_default_time_item"
]
});
var searchResultCount = customerSearchObj.runPaged().count;
log.debug("customerSearchObj result count",searchResultCount);
customerSearchObj.run().each(function(result){
var columns = result.columns;
itemId = result.getValue(columns[0]);
});
return itemId;
}
return {
fieldChanged: fieldChanged,
};
});
This script listens for changes in the 'customer' field and sets the 'isbillable' field to true for the current line item.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
04/21/2025, 4:09 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.824234426
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.822039664
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.808038175
Celigo AI
04/21/2025, 4:09 PM