• Arav Sundar
  • NEWBIE
  • 15 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 8
    Replies
i was a trying the below code and getting  an error can anyone please let me know what is the mistake i am doing the error is " Error: Unknown property 'AccountStandardController.Location' " what i could understand from the error is Location is not getting referenced pls help 

<apex:page standardController="Account">
 <apex:form >
  <apex:outputPanel id="locationPicker">
<apex:outputField value="{!Location.country}">
<apex:inlineEditSupport event="ondblClick" />
</apex:outputField>
</apex:outputpanel>
  </apex:form>
</apex:page>
Hi All , 

i am new to the Coding and i really want to learn the coding and intrested too and i am finding very difficult to build the logic and to write can anyone please suggest ..

i am trying to build the code for the requirement " i am havng an self lookup relationship with opportunity and when i delete the parent child should also get deleted " Below is the code can anyone pls suggest and the error i am getting is " Error: Compile Error: sObject type 'childofopp' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names. at line 7 column 37 " Not sure what is the mistake  i have done 

Standard object = Opportunity 
Custom object = Child_of_Oppty__c (having an self lookup realtionship) 

trigger DeletionofParentchildgetsdeleted on Opportunity (before delete) {

List<id> OpptyID = new list<id>();
for( Opportunity Oppty : trigger.old){
opptyid.add(oppty.id);
}
list<Child_of_Oppty__c> childofopp =[select id from childofopp where opportunityid in : opptyid];
delete childofopp;

}

 
Hi All , 

i am having an 2 fields booked value (number data type) and Booked value percentage (Percentage data type) below is my validation 
"SBLANK (Booked_value__c ) && number_fields__c <= 100" i tried with many its not working bascialy my requeitement is when user is trying to create a record it should enforce the record to enter the data for that i am using isblank for the booked value field then in the booked value percentage field the number should be 0 to 100% can anyone let me know where is it going wrong 
VF page 

<apex:page controller="OAuthDemoPageController">
    <apex:form >
        <apex:pageBlock title="OAuth Demo" mode="edit">
            <apex:pageBlockSection title="Authorization Code" columns="1">
                <apex:pageBlockSectionItem >
                    Your Authorization Code
                    <apex:outPutText >{!authorizationCode}</apex:outPutText>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
        
        
            <apex:pageBlockSection title="Access Token">
                <apex:commandButton value="Get Access Token" action="{!getAccessToken}"/>
                <apex:pageBlockSectionItem >
                Your Access Token 
                <apex:outPutText >{!accessToken}</apex:outPutText>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
            
            <apex:pageBlockSection title="Upload File">    
                <apex:inputFile value="{!attachmentBody}" fileName="{!attachmentName}"></apex:inputFile>
                <apex:commandButton value="UPLOAD FILE" action="{!uploadFile}"/>
            </apex:pageBlockSection>
         </apex:pageBlock>
    </apex:form>
</apex:page>
              

Class 


public class OAuthDemoPageController{
    public String authorizationCode {get;set;}
    public String accessToken {get;set;}
    
    public transient blob attachmentBody {get;set;}
    public string attachmentName {get;set;}
    
    
    public OAuthDemoPageController(){
        authorizationCode = ApexPages.CurrentPage().getParameters().get('code');
    }
    
    public void getAccessToken(){
        String grantTypeString = 'grant_type=authorization_code';
        String authorizationCodeString = '&code='+authorizationCode;
        String clientIdString = '&client_id=191713897201-mg7kgkhpd1h8up6behjc9a635nj86bma.apps.googleusercontent.com';
        String clientSecretString = '&client_secret=VfJRs-MBGgwKQ3bb-Zo8j_NH';
        String redirectURIString = '&redirect_uri=https://c.ap2.visual.force.com/apex/OAuthDemoPage';
        
        String requestBody = grantTypeString + authorizationCodeString + clientIdString + clientSecretString + redirectURIString;
        
        HttpRequest req = new HttpRequest();
        req.setEndpoint('https://www.googleapis.com/oauth2/v3/token');
        req.setMethod('POST');
        req.setHeader('Content-Type', 'application/x-www-form-urlencoded');
        req.setBody(requestBody );
        Http http = new Http();
        HTTPResponse res = http.send(req);
        System.debug('RESPONSE BODY---> '+res.getBody());
        
        
        GoogleAPIResponseWrapper googleResponse = (GoogleAPIResponseWrapper) JSON.deserialize(res.getBody(), GoogleAPIResponseWrapper.Class);
        accessToken = googleResponse.access_token;
    } 
    
    
    public void uploadFile(){
        GoogleDriveFileUploadHandler.uploadFile(attachmentName, attachmentBody, accessToken);
    }
   
}

Debug Logs 


36.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
16:50:46.0 (662273)|EXECUTION_STARTED
16:50:46.0 (707459)|CODE_UNIT_STARTED|[EXTERNAL]|06628000004EHZv|VF: /apex/OAuthDemoPage
16:50:46.0 (1946813)|VF_DESERIALIZE_VIEWSTATE_BEGIN|06628000004EHZv
16:50:46.0 (21984877)|VF_DESERIALIZE_VIEWSTATE_END
16:50:46.0 (25779298)|CODE_UNIT_STARTED|[EXTERNAL]|01p28000007E1sX|OAuthDemoPageController invoke(getAccessToken)
16:50:46.0 (26796425)|CALLOUT_REQUEST|[28]|System.HttpRequest[Endpoint=https://www.googleapis.com/oauth2/v3/token, Method=POST]
16:50:46.0 (844669215)|CALLOUT_RESPONSE|[28]|System.HttpResponse[Status=Bad Request, StatusCode=400]
16:50:46.0 (844920747)|USER_DEBUG|[29]|DEBUG|RESPONSE BODY---> {
 "error": "invalid_grant",
 "error_description": "Bad Request"
}

16:50:46.0 (851454005)|CODE_UNIT_FINISHED|OAuthDemoPageController invoke(getAccessToken)
16:50:46.0 (852131918)|VF_APEX_CALL|j_id9|{!getAccessToken}|PageReference: none
16:50:46.0 (880204589)|CODE_UNIT_STARTED|[EXTERNAL]|01p28000007E1sX|OAuthDemoPageController get(authorizationCode)
16:50:46.0 (880222476)|SYSTEM_MODE_ENTER|true
16:50:46.0 (880239984)|CODE_UNIT_STARTED|[EXTERNAL]|01p28000007E1sX|authorizationCode
16:50:46.0 (880260100)|CODE_UNIT_FINISHED|authorizationCode
16:50:46.0 (880286428)|CODE_UNIT_FINISHED|OAuthDemoPageController get(authorizationCode)
16:50:46.0 (880730009)|CODE_UNIT_STARTED|[EXTERNAL]|01p28000007E1sX|OAuthDemoPageController get(accessToken)
16:50:46.0 (880737624)|SYSTEM_MODE_ENTER|true
16:50:46.0 (880746006)|CODE_UNIT_STARTED|[EXTERNAL]|01p28000007E1sX|accessToken
16:50:46.0 (880754720)|CODE_UNIT_FINISHED|accessToken
16:50:46.0 (880767385)|CODE_UNIT_FINISHED|OAuthDemoPageController get(accessToken)
16:50:46.0 (883135783)|VF_SERIALIZE_VIEWSTATE_BEGIN|06628000004EHZv
16:50:46.0 (884272275)|VF_SERIALIZE_VIEWSTATE_END
16:50:46.887 (887216183)|CUMULATIVE_LIMIT_USAGE
16:50:46.887 (887216183)|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 1 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

16:50:46.887 (887216183)|CUMULATIVE_LIMIT_USAGE_END

16:50:46.0 (887272335)|CODE_UNIT_FINISHED|VF: /apex/OAuthDemoPage
16:50:46.0 (888406109)|EXECUTION_FINISHED
              

I was trying with the google have got the customer id and service key by creating an project in the google console , can someone help me with the suggestion 
Hi ,
i am having an custom object of Location which has a lookup to account and i am trying to perform the soql query to get the locations which is greater than 1 from the account object , below is the SOQL query can someone see this and suggest me on the same

Select id,name,(SELECT id,Name From SVMXC__Site__r ) from Account
HI All ,

learning SFDC coding , need a help please  .. in the Apex guide i am trying to execute the below code in the anonymus block in the developer console when i click on execute i am getting an error unexpected token at line 2 .. But if i save the same code directly in the apex class no error its getting saved , can anyone tell me how is it working .. And i am getting an error in the system.debug line where i am using as red cant i put the debug statement there pls confirm

public class MyClass {
class RGB {
Integer red;
system.debug (this is red : + red);
Integer green;
Integer blue;
//Static and Instance Methods, Variables, and Initialization Code
//Classes, Objects, and Interfaces
RGB(Integer red, Integer green, Integer blue)
system.debug(this is RGB : + RGB);
{ this.red = red;
this.green = green;
this.blue = blue; }
}
static Map<String, RGB> colorMap = new Map<String, RGB>();
system.debug(this is the static colormap : + colorMap);
static {
colorMap.put('red', new RGB(255, 0, 0));
colorMap.put('cyan', new RGB(0, 255, 255));
colorMap.put('magenta', new RGB(255, 0, 255)); }
}
Hi , Can someone tell me how to schedule the job for every 30 mins i am using                         "system.schedule('SVMXC_ScheduleCallClosureGlobal', '0 0/30 * 1/1 * ? *', new SVMXC_ScheduleCallClosureGlobal());" with this i am getting an error integers are accepted i took this the format from the cronmaker 

"System.schedule('SVMXC_ScheduleCallClosureGlobal', '0 30 * * * ?', new SVMXC_ScheduleCallClosureGlobal());" but with the second option first time it scheduled for half an hour second time its happening for 1 hr so not understanding how is that working 
Hi, 

Need help on the below things 

global class OpprtunityWEbservice2{
   
    webService static String test1(String year,String accId, String mheCourseId, String term, String stage, String name ,Boolean productInUseUpdate,String creationSourceId,String contactId,String productId, String pricebookEntryId,Double unitPrice, String targetedCreationSourceId, Boolean restrictOppLineCreation){
        String newOptyId;
      try{
        test2 o = new test2(Name=name,year__c=year,accountId=accId,MHE_Course__c=mheCourseId,Term__c=term,StageName=stage,CloseDate=System.Today(),Product_in_Use_Update__c=productInUseUpdate,Creation_Source_ID__c=creationSourceId);
        insert o;
        newOptyId =''+o.id;
         
        test 3 oc=new test 3(Name='test45',Contact_Name__c=contactId,Opportunity__c=newOptyId );
        insert oc;
        
        if(restrictOppLineCreation == false){
            System.debug('restrict oppline creation ::'+restrictOppLineCreation);
            test4 ol=new test4(OpportunityId=newOptyId ,Quantity=1,UnitPrice=unitPrice,PricebookEntryId=pricebookEntryId,Creation_Source_ID__c=targetedCreationSourceId);
            insert ol;
           }else{
               System.debug('restrict oppline creation*** ::'+restrictOppLineCreation);
           }
        return newOptyId;
      }catch(Exception e){
        return e.getmessage();
    }
    }
   
}


ANd the test class i am trying is below pls help 

@isTest Class Test_webservice{

private Static TestMethod void test1(){
   
   OpprtunityWEbservice2.test1 test = new OpprtunityWEbservice2.test1();



Getting an error (Invalid type: OpprtunityWEbservice2.test1 at line 101 column 65    


Hi , 

Can anyone please help me the test class for the below webservice class ..


global class OpprtunityWEbservice2{
   
    webService static String test1(String year,String accId, String mheCourseId, String term, String stage, String name ,Boolean productInUseUpdate,String creationSourceId,String contactId,String productId, String pricebookEntryId,Double unitPrice, String targetedCreationSourceId, Boolean restrictOppLineCreation){
        String newOptyId;
      try{
        test2 o = new test2(Name=name,year__c=year,accountId=accId,MHE_Course__c=mheCourseId,Term__c=term,StageName=stage,CloseDate=System.Today(),Product_in_Use_Update__c=productInUseUpdate,Creation_Source_ID__c=creationSourceId);
        insert o;
        newOptyId =''+o.id;
         
        test 3 oc=new test 3(Name='test45',Contact_Name__c=contactId,Opportunity__c=newOptyId );
        insert oc;
        
        if(restrictOppLineCreation == false){
            System.debug('restrict oppline creation ::'+restrictOppLineCreation);
            test4 ol=new test4(OpportunityId=newOptyId ,Quantity=1,UnitPrice=unitPrice,PricebookEntryId=pricebookEntryId,Creation_Source_ID__c=targetedCreationSourceId);
            insert ol;
           }else{
               System.debug('restrict oppline creation*** ::'+restrictOppLineCreation);
           }
           
        
        return newOptyId;
      }catch(Exception e){
        return e.getmessage();
    }
    }
   
}


ANd the test class i am trying is below pls help 

@isTest Class Test_webservice{

private Static TestMethod void test1(){
   
   OpprtunityWEbservice2.test1 test = new OpprtunityWEbservice2.test1();



Getting an error (Invalid type: OpprtunityWEbservice2.test1 at line 101 column 65    




 
i was a trying the below code and getting  an error can anyone please let me know what is the mistake i am doing the error is " Error: Unknown property 'AccountStandardController.Location' " what i could understand from the error is Location is not getting referenced pls help 

<apex:page standardController="Account">
 <apex:form >
  <apex:outputPanel id="locationPicker">
<apex:outputField value="{!Location.country}">
<apex:inlineEditSupport event="ondblClick" />
</apex:outputField>
</apex:outputpanel>
  </apex:form>
</apex:page>
Hi All , 

i am having an 2 fields booked value (number data type) and Booked value percentage (Percentage data type) below is my validation 
"SBLANK (Booked_value__c ) && number_fields__c <= 100" i tried with many its not working bascialy my requeitement is when user is trying to create a record it should enforce the record to enter the data for that i am using isblank for the booked value field then in the booked value percentage field the number should be 0 to 100% can anyone let me know where is it going wrong 
Hi ,
i am having an custom object of Location which has a lookup to account and i am trying to perform the soql query to get the locations which is greater than 1 from the account object , below is the SOQL query can someone see this and suggest me on the same

Select id,name,(SELECT id,Name From SVMXC__Site__r ) from Account
HI All ,

learning SFDC coding , need a help please  .. in the Apex guide i am trying to execute the below code in the anonymus block in the developer console when i click on execute i am getting an error unexpected token at line 2 .. But if i save the same code directly in the apex class no error its getting saved , can anyone tell me how is it working .. And i am getting an error in the system.debug line where i am using as red cant i put the debug statement there pls confirm

public class MyClass {
class RGB {
Integer red;
system.debug (this is red : + red);
Integer green;
Integer blue;
//Static and Instance Methods, Variables, and Initialization Code
//Classes, Objects, and Interfaces
RGB(Integer red, Integer green, Integer blue)
system.debug(this is RGB : + RGB);
{ this.red = red;
this.green = green;
this.blue = blue; }
}
static Map<String, RGB> colorMap = new Map<String, RGB>();
system.debug(this is the static colormap : + colorMap);
static {
colorMap.put('red', new RGB(255, 0, 0));
colorMap.put('cyan', new RGB(0, 255, 255));
colorMap.put('magenta', new RGB(255, 0, 255)); }
}
Batch Apex can have 5 concurrent (simultaneous) jobs running in parallel. When I schedule my job I am checking if 5 jobs are already running if yes I want to try scheduling the job again after 30 minutes. The job should still run only at 3pm daily.
Please help me with the apex code for the same as I am new to Salesforce.