M
matman
Guest
Hey Orchid Corpin, thank you for your reply. I know we can use Javascript, but I don't understand why we can just put {!R108244227} into new Array(). When doing return "" + {!R108244227} it only returns the first ID, rather than all IDs. This makes me think that passing {!R108244227} will always create an array with only one element (which is that single ID), regardless of the amount of related records. When passing only one argument to new Array(), it will create an array with that b length /b , that's why .length worked for me. For example: new Array(10234234) will create an array with 10234234 indices
I replaced the new Array() with [ ]. [ ] supports the creation of an array with only 0 or 1 elements, resulting in a .length of 0 or 1 Applying [ ] resulted in the following code: var employeeIDsBefore = [{!R108244227#before}]; var employeeIDsAfter = [{!R108244227}]; if(employeeIDsBefore.length && employeeIDsAfter.length) { for(var i = 0; i employeeIDsBefore.length; i += 1) { if(employeeIDsAfter.indexOf(employeeIDsBefore) 0) { rbv_api.deleteRecord("employee", employeeIDsBefore); } } } else if(employeeIDsBefore.length && !employeeIDsAfter.length) { for(var i = 0; i employeeIDsBefore.length; i += 1) { rbv_api.deleteRecord("employee", employeeIDsBefore); } }
Continue reading...
Continue reading...