I need to construct one object that will return Forms->Section->Question The objects are Master-Child relationships in the above order.
Please let me know how I can construct this object. Appreciate your help.
@RestResource(urlMapping='/FormSectionQuestions/*')
global with sharing class FormSectionQuestions{
@HttpGet
global static List<Form__c> doGet() {
List<Form__c> objects = [SELECT Active__c, IsDeleted, Name, FormId__c, LastModifiedDate,Title__c, Version__c ,(SELECT ParentSection__c,Sort_Order__c, Title__c,name FROM Sections__r) FROM Form__c];
for(Form__c form : objects){
for(Section__c secRelation:form.Sections__r ){
List<Question__c> questions =
[select IsDeleted, Options__c, PostText__c, PreText__c, Name, Required__c,SectionId__c, Sort_Order__c, Text__c, Type__c, Validation__c FROM Question__c where SectionId__c=:secRelation.Id];
secRelation.put('questionsHere',questions);//ERRORS here
}
}
return objects;
}
}
questionsHere
onSection__c
records. So if that field doesn't exist, not sure what you are expecting