• hari.p
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 3
    Replies
Hello,
We are facing an issue with the call out from Salesforce to SAP.We are calling SAP REST service from Salesforce using the OAuth2.0 flow.
As I am not able to post with screen shots, Created a Google doc with the complete details. https://docs.google.com/document/d/1b7-u0WCKFHUtTsOwzC-bfbawqi5MxU3Q/edit (https://docs.google.com/document/d/1b7-u0WCKFHUtTsOwzC-bfbawqi5MxU3Q/edit" style="color:blue; text-decoration:underline)
Can someone help us with the resolution to this issue. Please share some reference code if you have any. Thank you so much for your time.
 
  • August 27, 2019
  • Like
  • 0

Hi, We have a VF page hosted in public sites, where the site guest user will enter the details. Once he save the data, we are running a trigger in the backend to send this data to Zuora. Using Zuora managed package utility classes. 

If System Admin or any other user logged in and execute this page, we are able to send the data successfully. When site guest user do the same, we are getting below error.
Error: SObject row was retrieved via SOQL without querying the requested field: zqu__Quote__c.zqu__Is_Parent_Quote__c

Steps:

1) Site Guest User clicks Save button in public VF page.
2) Trigger executed in the backend.
  
trigger Zuora_Quote_Trigger on zqu__Quote__c (after Update) {    
    if(Trigger.isUpdate){
        system.debug('In Quote  Trigger - after update '+trigger.new);
        set<Id> setQuoteIds = new set<Id>();
        map<String,String> mapQuoteAccountIds = new map<String,String>();
        for(zqu__Quote__c zq : Trigger.new){
            if(zq.zqu__ZuoraSubscriptionID__c == null && zq.zqu__ZuoraPaymentID__c != trigger.oldMap.get(zq.Id).zqu__ZuoraPaymentID__c ){
                mapQuoteAccountIds.put(zq.Id,zq.zqu__Account__c);
            }
        }
     if(mapQuoteAccountIds.keyset().size()>0) SendQuoteToZuora.sendQuote(mapQuoteAccountIds);
    }    
}

3) This trigger will call the SendQuoteToZuora class 
@future(callout=true)
    public static void sendQuote(map<string,string> Map_QuoteAccountID){
        List<zqu.zQuoteUtil.ZBillingQuoteCollection> quotes = new List<zqu.zQuoteUtil.ZBillingQuoteCollection>();
        
        for(string s: Map_QuoteAccountID.keyset()){
            system.debug('Map_QuoteAccountID......Key:'+s+'..value: '+Map_QuoteAccountID.get(s));
            zqu.zQuoteUtil.ZBillingQuoteCollection quote = new zqu.zQuoteUtil.ZBillingQuoteCollection();
            quote.sfdcAccountId = Map_QuoteAccountID.get(s);
            quote.zAccountId = 'new';
            quote.quoteRequests = new List<zqu.zQuoteUtil.ZBillingQuoteRequest>();
            zqu.zQuoteUtil.ZBillingQuoteRequest req = new zqu.zQuoteUtil.ZBillingQuoteRequest();
            req.sfdcQuoteId = s;
            quote.quoteRequests.add(req);            
            quotes.add(quote);
            
        }        
                    
        List<zqu.zQuoteUtil.zBillingResult> results = zqu.zQuoteUtil.sendToZBilling(quotes); // invoing managed package class
        for ( zqu.zQuoteUtil.zBillingResult result : results ) {
            System.debug('Result: QuoteId = ' + result.sfdcQuoteId + ', Success = ' + result.success + ', message = ' + result.message );
        }
    }

Any help is greatly appreciated. 

  • April 06, 2017
  • Like
  • 1
Hi, I am trying to create the subtopics for a navigational topic in community witht apex code.

ConnectApi.ManagedTopicType managedTopicType=connectApi.ManagedTopicType.Navigational;
ConnectApi.ManagedTopics.createManagedTopicByName('0DB55000000CarKGAS', 'Test Topic',managedTopicType ,'0TO550000008ZlfGAE');

When I execute this code it gives me this error.
Line: 256, Column: 1
ConnectApi.ConnectApiException: Illegal value for parameter: 'parentId': 0TO550000008ZlfGAE

As it showes line 256, I don't even have more than two line of code here in developer console unanimus block. So it seams we are getting this error from the main class. Can any one suggest what wrong in it. Thanks 
  • January 27, 2017
  • Like
  • 0
A) Activity Timeline
B) Datepicker 
C) Menu
D) Pill
 
  • November 20, 2015
  • Like
  • 0

Hi, We have a VF page hosted in public sites, where the site guest user will enter the details. Once he save the data, we are running a trigger in the backend to send this data to Zuora. Using Zuora managed package utility classes. 

If System Admin or any other user logged in and execute this page, we are able to send the data successfully. When site guest user do the same, we are getting below error.
Error: SObject row was retrieved via SOQL without querying the requested field: zqu__Quote__c.zqu__Is_Parent_Quote__c

Steps:

1) Site Guest User clicks Save button in public VF page.
2) Trigger executed in the backend.
  
trigger Zuora_Quote_Trigger on zqu__Quote__c (after Update) {    
    if(Trigger.isUpdate){
        system.debug('In Quote  Trigger - after update '+trigger.new);
        set<Id> setQuoteIds = new set<Id>();
        map<String,String> mapQuoteAccountIds = new map<String,String>();
        for(zqu__Quote__c zq : Trigger.new){
            if(zq.zqu__ZuoraSubscriptionID__c == null && zq.zqu__ZuoraPaymentID__c != trigger.oldMap.get(zq.Id).zqu__ZuoraPaymentID__c ){
                mapQuoteAccountIds.put(zq.Id,zq.zqu__Account__c);
            }
        }
     if(mapQuoteAccountIds.keyset().size()>0) SendQuoteToZuora.sendQuote(mapQuoteAccountIds);
    }    
}

3) This trigger will call the SendQuoteToZuora class 
@future(callout=true)
    public static void sendQuote(map<string,string> Map_QuoteAccountID){
        List<zqu.zQuoteUtil.ZBillingQuoteCollection> quotes = new List<zqu.zQuoteUtil.ZBillingQuoteCollection>();
        
        for(string s: Map_QuoteAccountID.keyset()){
            system.debug('Map_QuoteAccountID......Key:'+s+'..value: '+Map_QuoteAccountID.get(s));
            zqu.zQuoteUtil.ZBillingQuoteCollection quote = new zqu.zQuoteUtil.ZBillingQuoteCollection();
            quote.sfdcAccountId = Map_QuoteAccountID.get(s);
            quote.zAccountId = 'new';
            quote.quoteRequests = new List<zqu.zQuoteUtil.ZBillingQuoteRequest>();
            zqu.zQuoteUtil.ZBillingQuoteRequest req = new zqu.zQuoteUtil.ZBillingQuoteRequest();
            req.sfdcQuoteId = s;
            quote.quoteRequests.add(req);            
            quotes.add(quote);
            
        }        
                    
        List<zqu.zQuoteUtil.zBillingResult> results = zqu.zQuoteUtil.sendToZBilling(quotes); // invoing managed package class
        for ( zqu.zQuoteUtil.zBillingResult result : results ) {
            System.debug('Result: QuoteId = ' + result.sfdcQuoteId + ', Success = ' + result.success + ', message = ' + result.message );
        }
    }

Any help is greatly appreciated. 

  • April 06, 2017
  • Like
  • 1

Hi, We have a VF page hosted in public sites, where the site guest user will enter the details. Once he save the data, we are running a trigger in the backend to send this data to Zuora. Using Zuora managed package utility classes. 

If System Admin or any other user logged in and execute this page, we are able to send the data successfully. When site guest user do the same, we are getting below error.
Error: SObject row was retrieved via SOQL without querying the requested field: zqu__Quote__c.zqu__Is_Parent_Quote__c

Steps:

1) Site Guest User clicks Save button in public VF page.
2) Trigger executed in the backend.
  
trigger Zuora_Quote_Trigger on zqu__Quote__c (after Update) {    
    if(Trigger.isUpdate){
        system.debug('In Quote  Trigger - after update '+trigger.new);
        set<Id> setQuoteIds = new set<Id>();
        map<String,String> mapQuoteAccountIds = new map<String,String>();
        for(zqu__Quote__c zq : Trigger.new){
            if(zq.zqu__ZuoraSubscriptionID__c == null && zq.zqu__ZuoraPaymentID__c != trigger.oldMap.get(zq.Id).zqu__ZuoraPaymentID__c ){
                mapQuoteAccountIds.put(zq.Id,zq.zqu__Account__c);
            }
        }
     if(mapQuoteAccountIds.keyset().size()>0) SendQuoteToZuora.sendQuote(mapQuoteAccountIds);
    }    
}

3) This trigger will call the SendQuoteToZuora class 
@future(callout=true)
    public static void sendQuote(map<string,string> Map_QuoteAccountID){
        List<zqu.zQuoteUtil.ZBillingQuoteCollection> quotes = new List<zqu.zQuoteUtil.ZBillingQuoteCollection>();
        
        for(string s: Map_QuoteAccountID.keyset()){
            system.debug('Map_QuoteAccountID......Key:'+s+'..value: '+Map_QuoteAccountID.get(s));
            zqu.zQuoteUtil.ZBillingQuoteCollection quote = new zqu.zQuoteUtil.ZBillingQuoteCollection();
            quote.sfdcAccountId = Map_QuoteAccountID.get(s);
            quote.zAccountId = 'new';
            quote.quoteRequests = new List<zqu.zQuoteUtil.ZBillingQuoteRequest>();
            zqu.zQuoteUtil.ZBillingQuoteRequest req = new zqu.zQuoteUtil.ZBillingQuoteRequest();
            req.sfdcQuoteId = s;
            quote.quoteRequests.add(req);            
            quotes.add(quote);
            
        }        
                    
        List<zqu.zQuoteUtil.zBillingResult> results = zqu.zQuoteUtil.sendToZBilling(quotes); // invoing managed package class
        for ( zqu.zQuoteUtil.zBillingResult result : results ) {
            System.debug('Result: QuoteId = ' + result.sfdcQuoteId + ', Success = ' + result.success + ', message = ' + result.message );
        }
    }

Any help is greatly appreciated. 

  • April 06, 2017
  • Like
  • 1

Am getting the following error in POST http method.

 

Error: CSRF token validation failed and System.HttpResponse[Status=Forbidden, StatusCode=403]"|0x43de18c1

 

I have two http request, 1. GET and 2. POST. Please review my code below and let me know where am missing.

 

GET:

    Http h = new Http();
    // Instantiate a new HTTP request, specify the method (GET) as well as the endpoint
    HttpRequest req = new HttpRequest();
    req.setHeader('Content-Type', 'application/atom+xml');    
    req.setHeader('x-csrf-token', 'fetch');
    req.setHeader('Authorization', 'BASIC ' + EncodingUtil.base64Encode(Blob.valueOf('username:pasword')));
    req.setMethod('GET');
    req.setEndpoint(url1);
    HttpResponse res = h.send(req);


POST: Using the above response and passing the CSRF token to my POST method,


        req.setHeader('Content-Type', 'application/atom+xml');
        req.setHeader('X-CSRF-Token',maptoken.get('x-csrf-token'));   
        req.setHeader('Authorization', 'BASIC ' + EncodingUtil.base64Encode(Blob.valueOf('username:pasword')));
        req.setMethod('POST');
        req.setEndpoint(url2);     
        req.setBody('xml hard coded');
        HttpResponse ires = h.send(req);

  • November 27, 2012
  • Like
  • 0

I have VP/Apex Class that updates a record.When the page first loads it grabs the first record that meets a particular criteria.

 

Here is the code that runs when the record is submitted. What should happen is upon submission it should update a checkbox (and some other fields) and then set the PageReference to the same page and then reload that page.

 

One of the criteria for the selected record is that the Resume Review Completed field should be false therefore after a submission the current record should drop out. (which it does if I reload manually)

 

 

public pageReference doSubmitReview()
	{
        
        if (ResumeStatus != '' && ResumeStatus != null)
        {
        	cRC.Status__c = ResumeStatus;	
        }
        cRC.Resume_Review_Completed__c = true;
        Update cRC;

        nextlink = '/apex/TBR_Resume_Review';
        PageReference nextPage = new PageReference(nextlink);
        return nextPage;
			
	}

What I notice is the bottom part (not url) seems to reload, it almost appears as if its reloading cache of the prior page load. If I manually choose to click reload I get the results I expect.

 

Is there something else I should be doing to force a proper reload.