I’m trying to inject a custom HTML `<select>...
# ask-stanley-ai
m
I’m trying to inject a custom HTML
<select>
dropdown inside each line of the Item sublist on a Sales Order. • The dropdown should list all Project Tasks linked to the header-level
job
field. • When a user selects a task, the value should be written into the real line-level field
custcol_task_project
. My script logs show:
✅ SELECT injected in item_row_1
, etc. But I don’t see anything visually in the UI. The field just doesn’t appear. I’m injecting the dropdown using raw DOM into the table
#item_splits
, in the first
<td>
of each line. Here is my full script below (or attached). Can you confirm: 1. Is DOM injection like this allowed in the sublist? 2. Should I use a different container? (
#item_splits
seems correct but maybe wrong?) 3. Is there a way to force the sublist to re-render or ensure it doesn't override the injected HTML?
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems that injecting HTML into a sublist using DOM manipulation is not officially supported by NetSuite and can lead to unpredictable results. Here are the answers to your questions: 1. DOM injection like this is not officially supported in the sublist. While some users have reported success with this method, it's not guaranteed to work and can lead to unpredictable results. 2. The
#item_splits
container seems to be the correct one for manipulating the Item sublist. However, as mentioned above, this method is not officially supported and may not work as expected. 3. There's no official way to force the sublist to re-render or ensure it doesn't override the injected HTML. Some users have reported success with using
setTimeout
to delay the execution of the code until after the sublist has finished loading, but this is more of a workaround than a solution. Here's a snippet from one of the conversations that might be helpful:
Copy code
javascript
let table = document.getElementById('item_splits')
for (let i = 0; i < table.rows[2].cells.length; i++) {
    table.rows[2].cells[i].style.setProperty("background-color", "#00CC00", "important")
}
This code attempts to change the background color of the cells in the third row of the sublist. However, as mentioned above, this method is not officially supported and may not work as expected. ****** 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.826321781
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.818712234
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.815654933
Please provide your feedback on this answer.