• yogeshsharma
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
Hi All,, 

I am trying to get the authorization token from the salesforce for the google drive access. But I am getting the bad response error(400 ) for the access. I am not able to decipher the reason in the code.

String messageBody='';
  Initialize();
  httpReq.setMethod('POST');
  httpReq.setEndpoint('https://accounts.google.com/o/oauth2/token');
  httpReq.setHeader('content-type',
   'application/x-www-form-urlencoded');

  messageBody ='client_id='+'288961038342.apps.googleusercontent.com'+
  '&client_secret='+'OHLLahnI9DKD1xR5gVnyGA36'+'&redirect_uri='+'https://login.salesforce.com/services/authcallback/00D90000000dAqaEAE/GoogleLogin'+
   '&grant_type='+'authorization_code';
   System.debug('messagebody'+messageBody );


/* if(tokenType=='ALL')
   messageBody = messageBody +
   '&code='+<Fetch Authorization Code from Key Safe>+
   '&redirect_uri='+<Fetch Redirect URI from EndPoint>+
   '&grant_type='+'authorization_code';

  else if(tokenType=='ACCESS_TOKEN')
   messageBody = messageBody +
   '&refresh_token='+<Fetch Refresh Token from Key Safe>+
   '&grant_type='+'refresh_token';
*/
  httpReq.setHeader('Content-length',
    String.valueOf(messageBody.length()));


Please somebody help in this regard
Good Morning:

I have the following piece of code that I am having some issues with.

What I am trying to do is to pull all Billing_Account__c records where Billing_Account__c.Zip_Code__c = MTU_Location__c.Zip_Code__c and Billing_Account__c.Address_1__c CONTAINS MTU_Location__c.Street_Address__c. After doing so, I want to update Billing_Account__c.MTU_Location__c with MTU_Location__c.ID.

The query should return multiple records to update, which it does, but that is causing my trigger to erorr out - I am getting the SOQL returned multiple rows for assignment error.

How to I re-write this so that it pulls multiple records but allows me to update multiple records?

Thanks,

Matt

for(MTU_Location__c mtuRecord : addMTUList){
            Billing_Account__c mtuUpdate = [Select ID, Address_1__c, Zip_Code__c, MTU_Location__c from Billing_Account__c where Zip_Code__c = :mtuRecord.Zip_Code__c];
                if(mtuUpdate.Address_1__c.CONTAINS(mtuRecord.Street_Address__c)){
                    mtuUpdate.MTU_Location__c = mtuRecord.ID;}


           
            updateBillingAccountList.add(mtuUpdate);
           
        }
        update updateBillingAccountList;
Hello All,

I have one sample list to retreive contact information and data is below.
list<contact> lstcont = [select id,name,accountid,sequence__c from contact where accountid=:accids ];

sample data when I execute the list from developer console:

Contact{Name=a01i000000D6EeW, Account__c=acc1, Id=a01i000000D6EeWAAV, Sequence_Number__c=1},
Contact{Name=a01i000000D6EeX, Account__c=acc2, Id=a01i000000D6EeXAAV, Sequence_Number__c=1},
Contact:{Name=testaccount, Account__c=acc1, Id=a01i000000D6EeaAAF, Sequence_Number__c=2})

I want to modify the list order by Account wise, for example

Contact{Name=a01i000000D6EeW, Account__c=acc1, Id=a01i000000D6EeWAAV, Sequence_Number__c=1},
Contact{Name=a01i000000D6EeX, Account__c=acc1, Id=a01i000000D6EeXAAV, Sequence_Number__c=2},
Contact:{Name=testaccount, Account__c=acc2, Id=a01i000000D6EeaAAF, Sequence_Number__c=1})

Please share the ideas how to change the list order as required.

Thanks,
Krishna