You need to sign in to do that
Don't have an account?
shan876
Javascript help plz...
Hi:
I have two queries which I placed into two arrays, then I loop through the records if the first element in the array is the same as the second array then it will display the record ... for some reason it is not working the way I want it to actually its not working at all....Can someone tell me where I am going wrong.....Please thanks
Code:
<html> <head> <script type="text/javascript" src="/soap/ajax/10.0/connection.js"></script> <script type="text/javascript"> window.onload=init_page; function init_page() { if ("{!$User.UserRoleId}"=="00E50000000w27b") { var j = ""; var strSQL = "Select OwnerId,AS400_Account_Number__c,Name,BillingCity,SF_DATE_ON_SERVICE__c from Account where SF_DATE_ON_SERVICE__c = LAST_N_DAYS:30 ORDER BY SF_DATE_ON_SERVICE__c DESC"; var strSQLB = "Select Id,Name from User where UserRoleId In ('00E50000000w3yvEAA','00E50000000w2ESEAY','00E50000000w5UrEAI', '00E50000000wA08EAE','00E50000000w2BEEAY','00E50000000w29rEAA', '00E50000000w2B4EAI','00E50000000w2BJEAY')"; var result = sforce.connection.query(strSQL); var resultB = sforce.connection.query(strSQLB); var records = result.getArray("records"); var recordsB = resultB.getArray("recordsB"); if (recordsB[0]==records[0]) { for (var i=0; i<records.length; i++) { for (var z=0;z<recordsB.length;z++) { j += "<a href=\"" + records[i].Id + "\" target=\"_blank\">("+(i+1)+") "+ recordsB[z].Name +" - "+ records[i].SF_DATE_ON_SERVICE__c+" - "+records[i].AS400_Account_Number__c+" - "+records[i].Name+" - "+records[i].BillingCity+"</a><br> "; } } document.getElementById("div_tag").innerHTML = j; } } } </script> </head> <body bgcolor="#F3F3EC"> <font size="2" face="Verdana"> <div id="div_tag">No Accts</div></font> </body> </html>
See if the following helps: