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

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 4
    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,
 
It seems that this is a known issue (https://success.salesforce.com/issues_view?id=a1p30000000T2KyAAK) but I am looking for some alternative solutions or workaround for this.

Here is the description of the issue and sample codes.
  • Custom Fields in Account Object
There are two custom picklists in Account object. Pick_1__c is a controlling field and Pick_2__c is a dependent field and Pick_2__c is multi-select picklist.
  • VisualForce Page
Page 1: it has a button called “Go To Page2” and it opens Page2 when clicking.
Page 2: you can save the Pick 1 and Pick 2 values in this page and it opens Pick 2  page after saving.
  • Issue Description
When opening Page 2 after saving the picklist values the values chosen for Pick_2__c are not listed in Chosen section. (All are listed in Available section as shown in below picture)
User-added image
If the Page 2 is directly called from the web browser like https://yoursite.visual.force.com/apex/page2, it is correctly listing the chosen values as shown in below picture.

User-added image
  • Sample Source
You need to create below two picklists in Account object.
Pick_1__c: PickList (controlling)
Pick_2__c: (multi-select) PickList (Dependent)

VisualForce Page - Page1
<apex:page controller="myController"  cache="false"> 
    <apex:form >
       <apex:pageBlock >
           <apex:pageBlockButtons > 
              <apex:commandButton value="Go To Page2" action="{!gotoPage2}"/>
          </apex:pageBlockButtons>          
       </apex:pageBlock>  
    </apex:form> 
</apex:page>



​VisualForce Page - Page2
 
<apex:page controller="myController"  cache="false"> 
    <apex:form >      
        <apex:pageBlock title="Select Pick List" mode="edit" id="thePageBlock"> 
           <apex:pageBlockButtons > 
              <apex:commandButton value="Save" action="{!save}"/>
          </apex:pageBlockButtons>       
            <apex:pageBlockSection columns="1" id="multiselectsection">
                <apex:inputField value="{!Acc.Pick_1__c}" required="true"  id="pick1"/>
                <apex:inputField value="{!Acc.Pick_2__c}" required="true"  id="pick2"/>
           </apex:pageBlockSection> 
        </apex:pageBlock>  
    </apex:form> 
</apex:page>


Controller – myController
 
public class myController {

    public Account Acc {get;set;}
    
    public myController() {         
        String ssid = '\'001f4000004zngp\'';
        String q = 'select Pick_1__c, Pick_2__c from Account where id = ' + ssid;
        Acc = Database.query(q);       
    }
    public pageReference save() {       
        Update Acc;
        return page.Page1; 
    }
    public pageReference gotoPage2() {
        return page.Page2;
    }
}


Thank you so much for your time.
Brian Kim 
brian.kim@suppliersoft.com

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.