how can i make the checkbox mark sub-assemblies ph...
# ask-stanley-ai
h
how can i make the checkbox mark sub-assemblies phantom on workorder run on only assemblies with no quantities
c
AI generated answer (using internal Slack threads):
To make the checkbox "Mark Sub-Assemblies Phantom" on work order run only on assemblies with no quantities, you would need to create a SuiteScript that checks the quantity of the assembly before marking it as phantom. Here is a general idea of how you could approach this: 1. Use a search to find all assembly items. 2. For each assembly item, check if the quantity is zero. 3. If the quantity is zero, update the assembly item to mark the sub-assemblies as phantom. Here is a pseudo-code example:
Copy code
javascript
var assemblySearch = search.create({
   type: search.Type.ASSEMBLY_ITEM,
   filters: [],
   columns: ['internalid', 'quantityonhand']
});

assemblySearch.run().each(function(result){
   var quantity = result.getValue('quantityonhand');
   if(quantity == 0){
      var assemblyId = result.getValue('internalid');
      var assemblyRecord = record.load({
         type: record.Type.ASSEMBLY_ITEM,
         id: assemblyId
      });
      assemblyRecord.setValue('custitem_mark_sub_assemblies_phantom', true);
      assemblyRecord.save();
   }
   return true;
});
Please note that this is a simplified example and may not cover all edge cases. You would need to adjust this to fit your specific needs and thoroughly test it before deploying. ****** 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.81053853
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.795340836
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.791804254
Please provide your feedback on this answer.