Forum Post: RE: Checking related records for deleted records before updating

  • Thread starter Thread starter Gian Torralba
  • Start date Start date
Status
Not open for further replies.
G

Gian Torralba

Guest
Hi matman, Instead using {!LOOP} to iterate thru all records just to compare a specific ID, can you just use a rbv_api.selectValue function? This will be much faster that looping thru all records of a certain object. This is not the exact code but will help you rethink your script logic: var relatedId = parseInt("{!R108244245#id}"); var newId = 0; if(relatedId 0){ /*if has a value*/ newId = rbv_api.selectNumber("SELECT id FROM rel_object WHERE id=? AND object_rel_to_this_object=?",relatedId,parseInt("{!id}")); /*gets this objects related records by using {!id} as a filter*/ } if(newId = 0){ return "Kan niet updaten, er mist een werknemer bij contactpersoon!"; } Let me know if this helps. Thanks, Gian

Continue reading...
 
Status
Not open for further replies.
Back
Top