Quantcast
Channel: Discussion Forum > Connect Data Services
Viewing all articles
Browse latest Browse all 2504

Issues chaining objects on GET (1 Comment)

$
0
0

Topic by bluephlame

I am simply trying to get the organization record from a contact in a get.

I have tried two things both without success.

 

firstly initiating the contact.organization = new NamedID();

            var contact = new Contact
            {
                ID = new ID { id = contactId, idSpecified = true },                           
            };
            contact.Organization = new NamedID();
            contact.CustomFields = new GenericObject();
            var options = new GetProcessingOptions {FetchAllNames = false};
            var rnObjects =  client.Get(clientInfoHeader, new RNObject[] {contact}, options);                        
 
            if (rnObjects.Count() == 1)
            {
                var rnObject = (Contact) rnObjects[0];                
                return rnObject;
            }
            return null;
 
The rnObject is always null for Organization, and so is the CustomFields.
next trying to use ROQL, by simply selecting the organization FROM the Contact
 
            var sql = @"SELECT Organization FROM Contact WHERE ID =" + contactId;
            var organization = new Organization();
            var result = client.QueryObjects(clientInfoHeader, sql, new RNObject[] { organization }, 1000);
            var resultobjects = result[0].RNObjectsResult;
            if (resultobjects.Count() == 1)
            {
                return (Organization) resultobjects[0];
            }
            return null;
 
This  returns an error, Organization is not an Object.
Thanks for any help anyone can provide!
 

Viewing all articles
Browse latest Browse all 2504

Trending Articles