You need to sign in to do that
Don't have an account?
Not understanding relationship 'c' in field path
I am getting some strange errors trying to manipulate the timeline code from the api exchange... can anyone help.
if ( validId("{!Claim__c.Id}") ) { // we are on a case page, this gets interesting...
// query the case history and display that
sforce.connection.query( "Select OldValue, NewValue, IsDeleted, Id, Field, CreatedDate, c.CreatedBy.Name, c.CreatedById, c.Id From Claim__History"+
" where c.Claim__c= '{!Claim__c.Id}' order by CreatedDate ",
layoutCaseHist );
// case comments
sforce.connection.query( "Select c.ParentId, c.LastModifiedDate, c.LastModifiedById, c.IsPublished, c.IsDeleted, c.Id, c.CreatedDate, c.CreatedBy.FirstName, c.CreatedBy.LastName, c.CreatedById, c.CommentBody From CaseComment c " +
" where ParentId = '{!Case.Id}' order by CreatedDate ",
layoutCaseComment );
} // end case
didn't understand relationship 'c' in field path
and an invalid field
ERROR: ........... {faultcode:'sf:INVALID_FIELD', faultstring:'INVALID_FIELD:
IsDeleted, Id, Field, CreatedDate, c.CreatedBy.Name, c.CreatedById
^
ERROR at Row:1:Column:63
Didn't understand relationship 'c' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.', detail:{InvalidFieldFault:{exceptionCode:'INVALID_FIELD', exceptionMessage:'
IsDeleted, Id, Field, CreatedDate, c.CreatedBy.Name, c.CreatedById
^
ERROR at Row:1:Column:63
Didn't understand relationship 'c' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.', row:'1', column:'63', }, }, }
In the first SOQL query, there FROM clause doesn't specificy the letter 'c'.So you can't use the dot-syntax to reference a field like c.CreatedDate unless you specificy the letter 'c' to represent the FROM object.
Notice how the 2nd query clause specifies the letter 'c': From CaseComment c
I see so its like an AS in sql
so
// query the case history and display that
sforce.connection.query( "Select OldValue, NewValue, IsDeleted, Id, Field, CreatedDate, c.CreatedBy.Name, c.CreatedById, c.Id From Claim__History c"+
" where c.Claim__c= '{!Claim__c.Id}' order by CreatedDate ",
layoutCaseHist );
should work?
I don't get the relationship r stuff.