function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RahulRahul 

hello friends, Iam getting error in this query as "Unknown error parsing query". Please find the Query select id,(select id from SBQQ__Quote__r) from opportunity. Need your help

Iam querying from opportunity to CPQ quote the Iam getting the Error
mj clarkemj clarke
Download trendmicro from downloadcenter.trendmicro.com on your computer and secure it from cyber threats.

https://downloadcenter-trendmicro.com/

<a href="https://downloadcenter-trendmicro.com/">downloadcenter.trendmicro.com</a>
Harsh P.Harsh P.
Hi Rahul,

The object inside the inner query must be child i.e.SBQQ__Quote__c should be child of Opportunity.
Lup or MD should be on SBQQ__Quote__c .And also check the API name of this custom object.

Regards,
Harsh P.
RahulRahul
Hi Harsh, yes SBQQ__Quote__C is the child of opportunity. There is a Lookup on it with opportunity. API name also correct but dont know  why its not working
Deepali KulshresthaDeepali Kulshrestha
Hi Rahul,
Greetings to you!

- I implemented this in my Org. Please use the below code[Solved].
- It depends on who is a parent and who is a child.
- If SBQQ__Quote__c is parent and opportunity is child the query will be : -

     - (SBQQ__Quotes__r) - plural name of SBQQ__Quote__r : -
    
    [select id,(select id from SBQQ__Quotes__r) from opportunity];

- If an opportunity is parent and SBQQ__Quote__c is child the query will be : -

    [select id,SBQQ__Quotes__r.Id from opportunity];

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha.
RahulRahul
Iam still getting the same Error friends. Please find the error below

Error: Compile Error:
SBQQ__SubscriptionTerm__c from SBQQ__Quote__r ) from opportunity
^
ERROR at Row:1:Column:50
Didn't understand relationship 'SBQQ__Quote__r' in FROM part of query call. 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. at line 5 column 42

Here is my code.

trigger opportunityTrigger2 on Opportunity (after insert, after update) {

    list< SBQQ__Quote__c> lstopp = new list< SBQQ__Quote__c>();
    
    list<opportunity> queryparentchild = [select id,(select SBQQ__SubscriptionTerm__c from SBQQ__Quotes__r ) from opportunity];

    if(Trigger.IsAfter && (Trigger.IsInsert|| Trigger.Isupdate)){
    
        for(Opportunity opp : trigger.new){
        
            if(opp.Auto_Renew__c == True){
            
             SBQQ__Quote__c ww = new SBQQ__Quote__c();
                            ww.SBQQ__Opportunity2__c=opp.id;

             ww.SBQQ__SubscriptionTerm__c = 12;
                           lstopp.add(ww);

            }
        
        }      
    
    }

insert lstopp;
}
mj clarkemj clarke
Vipre antivirus secures your computer against unwanted cyber threats available online. 

https://installvipreantivirus.com
https://installvipreantivirus.com/i-need-to-install-vipre
https://installvipreantivirus.com/install-vipre-with-key-code
https://installvipreantivirus.com/reinstall-vipre-with-product-key

<a href="https://installvipreantivirus.com/">install vipre antivirus</a>
<a href="https://installvipreantivirus.com/i-need-to-install-vipre/">i need to install vipre</a>
<a href="https://installvipreantivirus.com/install-vipre-with-key-code/">install vipre with key code</a>
<a href="https://installvipreantivirus.com/reinstall-vipre-with-product-key/">reinstall vipre with product key</a>User-added image
Deepali KulshresthaDeepali Kulshrestha
Hi Rahul,
Greetings to you!

- I implemented in my Org. Please use the below code[Solved].
- Correction in the query.
    
    list<opportunity> queryparentchild = [select id,SBQQ__Quote__r.SBQQ__SubscriptionTerm__c from opportunity];
    System.debug('queryparentchild--->'+queryparentchild);

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha.