You need to sign in to do that
Don't have an account?
Nik_P
Code:
The tables are set up as:
Of course, this doesn't seem to be working for me. Would any of you gurus be able to point out my err in trying
Relationship query and S-Control.....
Hey all,
I have a small issue with an S-Control I am writing, mostly as it deals with relationships, and I haven't been able to pull out the information I require with my query string.....
To put in context, I have a custom object named Site. I also have a custom object named Site_Contact, which is to allow a many-to-many relationship for contacts to sites. The site also has a lookup (not master) to the account. What my s-control is going to do is allow them to press the button, and change any contacts associated to the site to be associated with the account which owns the site (if site is purchased by Company B, the contacts associated with the site who used to work for Company A (who used to own the site) would also move to Company B)...This s-control would run off of a button on the related list on the site detail.
I tried the inner join, but then, after reading through the APEX white paper, see that the joins do not work with a SOQL Call...
so, I have the following code for my query right now....
var qStr = "Select Id,AccountID, (SELECT Contact__c, Site__C From Site_Contact__c) from Contact"; try{ var queryResults = sforce.connection.query(qStr); if (queryResults != null){ if (queryResults.size > 0){ var records = queryResults.getArray('records'); } } } catch(err) { alert(err) }
The tables are set up as:
Contact (Standard SFDC)
Site (Id, Contact__c)
Site_Contact (Id, Contact__c, Site__c)
So, I am thinking that I need to grab Id, AccountID from Contacts where (grab Id from Site Contact where the property__c field is equal to the Id of the Site detail you are on.
Of course, this doesn't seem to be working for me. Would any of you gurus be able to point out my err in trying
Hello all,
Well, I found out my error on how to use relationships...used the soql paper to figure that one out. now, though, it seems that my s-control continually loops, and never completes the update....I place the code up, just in case anyone sees what i can't right now...
Code:
(i am using a hard coded accountid right now to test...)
Thanks again,
Nik