Skip to main content
Question

FSM Mobile Serialized Part Usage


Forum|alt.badge.img+2

I have previously posted a question on this but had no response. 

 

I need to record the serial number of a part when necessary. This requires a data transaction to 2 tables. This is my code. It doesn’t error but it also doesn’t record anything. Any advice at all would be appreciated

 

if (initialValuesHaveChanged()){
      var taskTrans = generateDataTransaction("part_usage", "INSERT","");
      taskTrans = addToDataTransaction(taskTrans, "task_id", taskId);
      taskTrans = addToDataTransaction(taskTrans, "part_id", partId);
      taskTrans = addToDataTransaction(taskTrans, "part_line_code", line_code);
      taskTrans = addToDataTransaction(taskTrans, "line_code_type", line_type);
      taskTrans = addToDataTransaction(taskTrans, "quantity", quantity); 
      
      var taskTrans2 = generateDataTransaction("part_usage_serial", "INSERT","");
      taskTrans2 = addToDataTransaction(taskTrans, "serial_id", serial);
      
      saveDataTransaction(taskTrans, "Save Part Used Entry");
      saveDataTransaction(taskTrans2, "Save Part Used Serial Entry");
 
      

      alert("Part usage successfully saved");
      goToScreen("PartUsedEntryVTH", true);
      return true;
      }

 

If I remove the second data transaction I get an error saying 

“The number of serial IDs selected does not match the quantity.”

How do you go about sending data to 2 tables to avoid this error?

6 replies

shalikakk
Hero (Employee)
Forum|alt.badge.img+7
  • Hero (Employee)
  • 37 replies
  • April 25, 2025

Hi ​@jamesking ,
 

Did you use a custom screen or a baseline screen for this function?

Thanks


Forum|alt.badge.img+2
  • Author
  • Do Gooder (Customer)
  • 6 replies
  • April 25, 2025

Hi ​@shalikakk 

 

We’re using a custom screen. 

 

 


Forum|alt.badge.img+2
  • Author
  • Do Gooder (Customer)
  • 6 replies
  • April 25, 2025

The script is attached to the save button


Forum|alt.badge.img+2
  • Author
  • Do Gooder (Customer)
  • 6 replies
  • April 25, 2025

The crux of the question is can I send a data transaction to 2 tables at the same time from mobile. 

 

With XML we can nest the part_serial_usage within the part usage transaction

 

   <update_part_usage regex_validated="true">
<part_usage>
<request_id>13429116</request_id>
<task_id>7562609</task_id>
<unadj_list_price>0</unadj_list_price>
<billing_status>IDLE</billing_status>
<unit_price>0</unit_price>
<price_adj_pct>0</price_adj_pct>
<unit_cost>0</unit_cost>
<extracted_to_fin>N</extracted_to_fin>
<count_as_usage>Y</count_as_usage>
<auto_created>N</auto_created>
<bin_id>LOCATION</bin_id>
<part_line_code>PB</part_line_code>
<part_id>VT-670REARCAM</part_id>
<quantity>1</quantity>
<place_id_from>MK</place_id_from>
<location>GOOD</location>
<work_dt>2025-04-24</work_dt>
<person_id>JKING</person_id>
<billing_currency>GBP</billing_currency>
<created_by>JKING</created_by>
<created_dttm>2025-04-24T16:56:27.6632521</created_dttm>
<adjust_stock>Y</adjust_stock>
<product_id>4048285</product_id>
<part_usage_serial>
<serial_id>VTR31</serial_id>
</part_usage_serial>

<insert is_initialized="False" />
</part_usage>

 

    </update_part_usage>


Forum|alt.badge.img+2
  • Author
  • Do Gooder (Customer)
  • 6 replies
  • April 28, 2025

@shalikakk Is this possible with custom screens? 


shalikakk
Hero (Employee)
Forum|alt.badge.img+7
  • Hero (Employee)
  • 37 replies
  • April 30, 2025

Hi ​@jamesking 
In the baseline functionality, it updates two tables from a single message. That message is generated at the code level. However, at the client script level, we can’t generate that kind of message. So, according to my understanding, this can't be done through configuration alone — but we can achieve it by customizing the mobile code.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings