B
ByronB
Guest
There are 3 triggers: One after create that creates a related record using a conversion map, creating another record in the Association table: After Update Trigger: var fromAcc = {!associationFromAccount}; var toAcc = {!associationToAccount}; var assocRecId = rbv_api.selectQuery("select id from association where associationToAccount = ? and associationFromAccount = ?", 1, fromAcc, toAcc); var arr = new Array(); arr['toDescription'] = '{!fromDescription}'; arr['fromDescription'] = '{!toDescription}'; arr['associationToAccount'] = '{!associationFromAccount#id}'; arr['toRelationship'] = '{!fromRelationship#id}'; arr['associationFromAccount'] = '{!associationToAccount#id}'; arr['fromRelationship'] = '{!toRelationship#id}'; rbv_api.println(assocRecId[0][0]); rbv_api.updateRecord("association", assocRecId[0][0], arr); Before Delete: var fromAcc = {!associationFromAccount}; var toAcc = {!associationToAccount}; //rbv_api.println(fromAcc + "|" + toAcc); var assocRecId = rbv_api.selectQuery("select id from association where associationToAccount = ? and associationFromAccount = ?", 1, fromAcc, toAcc); //rbv_api.printArr(assocRecId); rbv_api.println(assocRecId[0][0]); rbv_api.deleteRecord('association', assocRecId[0][0]);
Continue reading...
Continue reading...