[Progress Communities] [Progress OpenEdge ABL] Forum Post: RE: Attach and update records automatically

  • Thread starter Thread starter mpiscoso@gmail.com
  • Start date Start date
Status
Not open for further replies.
M

mpiscoso@gmail.com

Guest
leonc What you did was actually incomplete. I'm assuming your trigger is an update field value trigger type and that you're trying to update the codes relationship on the user object. That trigger type expects a return statement and a lookup field expects a comma separated string of IDs as the value. To give you an example, your end code would look somewhat like this: var returnArr = [], //This is the return array in which we'll be keeping all the codes for the return statement premises = rbv_api.getRelatedRecordIds("USER","R######", '{!id}'); //First, get the user's premises (Where R###### is the User:Premise relationship integration code) for (var count in premises) { //Iterate through all related premises of the user var codes = rbv_api.getRelatedRecordIds("Client_Premise","R461886", premises[count]); //Get the codes for each premise for (var cCount in codes) { //Iterate through the codes of each premise returnArr.push(codes[cCount]); //Store each code's ID in the return array } } return returnArr.join(","); //After getting all of the codes of all of the premises, join() the array to make a comma separated string of codes and return to the lookup If you swap R###### with the actual relationship code I think that should work for you. If not, minor debugging of the code should handle the matter. Hope that helps Piscoso, Martin

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