• vandana raju
  • NEWBIE
  • 70 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 17
    Questions
  • 16
    Replies
Hello
I having a custom object C1 with fields like name,email and mobile number.On an visualforce page I will enter the values and save the data.This part is fine with me.
Now my requirement is when I enter email in <apex:inputfield> say on keypress event I should be able to call an server side method in apex controller.
This method will check if the email already exists in object. If it exists then some action needs to be taken.

Please anybody any help will be greatly appreciated
thanks
vandana
 
Hello

I need to bind picklist values to an toggle switch in an visualforce page. assuming the toggle switch is created using css or jquery.

if I click save button then it should save to object.

please help me out.

thanks
vandana
Hi
I have a visualforce with standard controller=account and doctype=HTML 5.0. when I enter acocunt Name and click save button it is not saving to object. please let me know if any issue.
 
<apex:page docType="HTML-5.0" 
           standardController="Account"
           standardStylesheets="false"
           showheader="false"
           sidebar="false">
 <html>
<head>   
</head>
<body>
<form>
<table>
<tr>
<td>
Account Name:
</td>
<td>
<Input type="Text"/> 
</td>
</tr>

</table>
</form>
</body>
</html>
<apex:form >
<apex:commandButton action="{!Save}"
                    value="Save" />
                   
</apex:form>     
</apex:page>

Thanks
Pooja Hegde
In opportunitylineitems object, I have field amount and three radio buttons i.e monthly , quarterly and yearly. I have a jquery slider in visualforce page , when I move the slider if I select radio button monthly then it should show the amount to be paid in a month, similarly, if radio button quarterly is selected then it will display amount to be paid in a quarter and so on. I picked up brief idea from the url http://blogforce9.blogspot.in/2012/02/jquery-slider-for-visualforce-pages.html about query slider but I am not sure as how to handle the apex class required for this.
thanks
vandana R
Hello friends
I have a scenario where when a account field is udpated corresponding contact field descriptions also gets updated.
pls see code as follows , its working.
 
public class Account_ContactDescription
{
      public void Update_ContactDescription(Set<ID> accountIDs)
   {
      List<Contact> contactsToUpdate=new List<Contact>();
      
      List<Contact> conaccountIDs=[select Id,FirstName,LastName from contact where accountID IN :accountIDs];
      
      if (conaccountIDs.size() > 0 && conaccountIDs != NULL)
      {
         for(Contact con:conaccountIDs)
         {
         contactsToUpdate.add(new Contact(ID=con.ID, Description=con.FirstName+' '+con.LastName));
            
         }
      }
      
      Database.Update(contactsToUpdate,false);
   }
}

trigger trg_updateContactDescripton on Account (before Update) 
{
  
  if (trigger.IsUpdate)
  {
    Account_ContactDescription obj = new Account_ContactDescription();
    obj.Update_ContactDescription(Trigger.NewMap.Keyset());
  }
}

If I use   after Update event also it works, then my question is what is the specific case scenario where a user is forced to use after trigger.
pls elaborate

thanks
vandana
Hi
I am trying to understand how to compare old values and new values for sobject.
I have a opportunity custom field , type=check box, which is checked only when stageName='Closed Won'.

when the custom field is checked the trigger further will do some business logic.

any help will ge greatly apprecitaed.

thanks


 
Hi
I am performing a data import through dataloader so I need to disable validation rules and trigger.
I know how to create a custom setting , type=Hierarchy but I am unable to frame the code for validation rule and trigger.

any help will be greatly appreciated.

Thanks
Vandana
Hi
 I have some historical records in account object where the Phone field in some records is less than 10 digits and in some records it is 10 digits.
 I need to show in a report only those records whose Phone is exactly 10 digits and not less.

Pls let me know how to achieve this.

Thanks
Vandana
Hi
I am trying to understand data modelling in salesforce.
I have a rollup summary field defined between two custom objects (involved in a Master-detail relationship).
can I access the rollup summary field in a trigger written on child object which will update the parent object field based on some calculation?

any help with a smal piece of code will he greatly helpful.

Thanks
Vandana
Hi
I am trying to understand how to go about below issue.
I have 2 million historical records in account object.
I have as follows:
public class somecontroller
{
    public String searchstring{get;set;}
    
    public list<Account> acc{get;set;}
    
    public somecontroller(ApexPages.StandardController controller) {}
    public PageReference Search()
    {
      string searchquery='select ID,Name from Account where name like \'%'+String.escapeSingleQuotes(searchstring)+'%\' ';   

      acc= Database.query(searchquery);   

      return null;
    }  
}
<apex:page standardController="Account"
           extensions="SomeController">
<apex:form>
     <apex:inputText value="{!SearchString}"
                                  label="Enter Account Name"/>
                   
     <apex:commandButton value="Search records" action="{!search}"/>  
 
     <apex:commandButton value="Clear records" action="{!search}"/>  
       
       <apex:pageBlock title="Search Result">  

     <apex:pageblockTable value="{!acc}" 
                          var="a">  
     <apex:column>  
     <apex:outputlink value="/{!a.id}">{!a.Name}</apex:outputlink>  
 
     </apex:column>  
 
     <apex:column value="{!a.id}"/>  

    </apex:pageBlockTable>     

   </apex:pageBlock>

If the number of rows is less than or equal to 50000 then its fine but if number of rows is more than 50000 then I will have to use a batch apex.
Now assuming 1 lakh rows are returned then how can I hold this result information in batch apex?
I may want to show these records in a PDF or excel.

I really hope I am very clear.
Please let me know.
 
Hi
I am new to javascript and java.
Please tell me how to create a class in javascript?
Also it would be help if simple to advanced scenario interview questions can be sent on javascript and java.

Thanks
Vandana

 
Hi
I have brief knowledge on OWD and sharing settings.
Please explain how OWD=Controlled By parent  actually works.
what it can impact?

also say OWD=private / public readonly for account object, if I share set of records using sharing criteria to a group of users will they also have
access to related contact , opportunity & cases records?

Thanks
vandana 

 
Hello
I am newbie to apex integration , I got the below error while peforming integration
"Invalid session_ID"

I am using two different saleforce instances to perform integration say HDFC & flipkart
HDFC is destination salesforce which contains a method which I need to call from flipkart(source )

In destionation instance: I have connected app, with client ID, consumer secret working
here is the code.
code in destination:
===================
@RestResource(UrlMapping='/AccountRestUsingPatch/*')   
global class RestAccountUsingPatch
{
@HTTPPatch
webservice static void UpdateAccount()  
{
   Account account=[SELECT Id,Name,Phone FROM Account WHERE Id=:RestContext.request.params.get('accountId')];
   account.Name='Cathay Pacific1';

   //I want to update phone.
   account.Phone='8732909090';
   Database.Update(account,false);
}}

code in source:
===============
Helper class for OAUTH authentication.

In reqbody , I have provided the password and security_token of destination along with clientID and clientsecret
of destination

global class Helper
{
  global static OAuth2 GetAccessToken()
  {
    Http h = new Http();
        
    HTTPRequest req = new HttpRequest();
        
    req.setHeader('Content-Type', 'application/x-www-form-urlencoded');
                
    string reqbody ='grant_type=password&client_id=3MVG9ZL0ppGP5UrCfQLl3qwiw0BYov5r1NNhhhJkvj7VEeQtGzp4ki8zGexr7_XbvXdr1tzWhlDFEckNw5l91&client_secret=8280221851649175782&username=hdfcBank@sfdc.com&password=pwd+securitytoken of destination';      
                                                                                       
                              
    req.setBody(reqbody);
        
    req.setEndpoint('https://login.salesforce.com/services/oauth2/token');
        
    req.setMethod('POST');
        
    HttpResponse res=h.send(req);  
        
    OAuth2 objAuthenticationInfo = (OAuth2)JSON.deserialize(res.getbody(), OAuth2.class);
           
    return objAuthenticationInfo;
  }
  
  global class OAuth2 
  {
         public String id{get;set;}
         public String issued_at{get;set;}
         public String instance_url{get;set;}
         public String signature{get;set;}
         public String access_token{get;set;}    
  }
}

//apex class
public class IntegrateAccountRestController
{ 
    public string jsonList;
    
    public List<Account> accList{get;set;}
    
    public PageReference pRef;
     
    public Account a { get; set; }

    public IntegrateAccountRestController()
    {
      a = new Account();  
    }

   public PageReference UpdateAccount()  
     {
        
       if (Helper.GetAccessToken() != NULL)
       {
          
          Http h = new Http();
          
          HttpRequest req = new HttpRequest();
        
          req.setMethod('PATCH'); 
            
          req.setHeader('Authorization','Bearer '+Helper.GetAccessToken().access_token);
        
          req.setHeader('Content-Type','application/json; charset=UTF-8'); 
                 
   req.setEndpoint('https://ap2.salesforce.com/services/apexrest/AccountRestUsingPatch?accountId=0012800000rmaf9'); 
  
          String dataupload = JSON.serialize(a);
        
          req.setBody(dataupload);
                          
          HttpResponse res=h.send(req); // JSON string is generated at this point
         
          Jsonresponse=res.getBody();//to get back the response from HDFC
                       
       }
        return null;
     }
} //end of  IntegrateAccountRestController class

In source I have created remote site settings for the below urls
https://login.salesforce.com/services/oauth2/token
https://ap2.salesforce.com/

when I check debug logs, OAUTH = NULL,, so it is giving error as Invalid session_D
Please help me out.

Thanks
Vandana R




 
Hello
I have some difficulty in understanding the following

a) Normally apex code & trigger run in system.context
   But How to make the apex code execute in USER Mode?
   if the apex code executing in USER Mode  is called by a trigger, will the trigger also execute in USER Mode?

b) Can a visual force page run in USER Mode instead of system.context , again what changes need to be done and why?

c) By default webservice classes written in apex , rest api execute in what Mode?

d) what is the use of system.RunAs with respect to the above.

I hope I am clear

Thanks
Vandana R
Hi
I am newbie to workflow and validaton rules.
In CASE object , I have a custom field as SuppliedCompany. The value in this field should be "somecompany" whenever the CASE record is created or edited.

How to achieve this using validation rule and workflow rule. In worklfow I am not clear in formula editor what to give.

Pls suggest .
Thanks
Vandana
Hello
I am getting this error " CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY  " when I execute a apex code from trigger.

sorry I cannot give the code , but pls help me out.

Thanks
Vandana
Hello friends
I am getting the error " INSUFFICIENT_ACCESS_OR_READONLY" when I execute apex code from trigger and the logic performs an DML operation.
I went through several posts to understand this error I understood that in the context of current user not having permission to perform edit on the object is resulting in this error.

The code was written by another user with 'WITH SHARING" keyword and also he has written as test class.
I checked with sysadmin so I do not have permissions to perform any edit on the said object.


My question is how do I resolve this error.

A) Can I actually remove the "WITH SHARING" keyword and then run the code from my login ?
B) In test class can I remove the option of 'WITHOUT SHARING"?
C) Also Pls lt me know how system.RunAs() works in the above context.
D) as of now this code is not deployed, so once it is deployed if this error occurs pls explain how to to resolve

I really hope I am clear.
Thanks
vandana R

 
Hello
I having a custom object C1 with fields like name,email and mobile number.On an visualforce page I will enter the values and save the data.This part is fine with me.
Now my requirement is when I enter email in <apex:inputfield> say on keypress event I should be able to call an server side method in apex controller.
This method will check if the email already exists in object. If it exists then some action needs to be taken.

Please anybody any help will be greatly appreciated
thanks
vandana
 
Hello
I have some difficulty in understanding the following

a) Normally apex code & trigger run in system.context
   But How to make the apex code execute in USER Mode?
   if the apex code executing in USER Mode  is called by a trigger, will the trigger also execute in USER Mode?

b) Can a visual force page run in USER Mode instead of system.context , again what changes need to be done and why?

c) By default webservice classes written in apex , rest api execute in what Mode?

d) what is the use of system.RunAs with respect to the above.

I hope I am clear

Thanks
Vandana R
Hi
I have a visualforce with standard controller=account and doctype=HTML 5.0. when I enter acocunt Name and click save button it is not saving to object. please let me know if any issue.
 
<apex:page docType="HTML-5.0" 
           standardController="Account"
           standardStylesheets="false"
           showheader="false"
           sidebar="false">
 <html>
<head>   
</head>
<body>
<form>
<table>
<tr>
<td>
Account Name:
</td>
<td>
<Input type="Text"/> 
</td>
</tr>

</table>
</form>
</body>
</html>
<apex:form >
<apex:commandButton action="{!Save}"
                    value="Save" />
                   
</apex:form>     
</apex:page>

Thanks
Pooja Hegde
Hello friends
I have a scenario where when a account field is udpated corresponding contact field descriptions also gets updated.
pls see code as follows , its working.
 
public class Account_ContactDescription
{
      public void Update_ContactDescription(Set<ID> accountIDs)
   {
      List<Contact> contactsToUpdate=new List<Contact>();
      
      List<Contact> conaccountIDs=[select Id,FirstName,LastName from contact where accountID IN :accountIDs];
      
      if (conaccountIDs.size() > 0 && conaccountIDs != NULL)
      {
         for(Contact con:conaccountIDs)
         {
         contactsToUpdate.add(new Contact(ID=con.ID, Description=con.FirstName+' '+con.LastName));
            
         }
      }
      
      Database.Update(contactsToUpdate,false);
   }
}

trigger trg_updateContactDescripton on Account (before Update) 
{
  
  if (trigger.IsUpdate)
  {
    Account_ContactDescription obj = new Account_ContactDescription();
    obj.Update_ContactDescription(Trigger.NewMap.Keyset());
  }
}

If I use   after Update event also it works, then my question is what is the specific case scenario where a user is forced to use after trigger.
pls elaborate

thanks
vandana
Hi
I am trying to understand how to compare old values and new values for sobject.
I have a opportunity custom field , type=check box, which is checked only when stageName='Closed Won'.

when the custom field is checked the trigger further will do some business logic.

any help will ge greatly apprecitaed.

thanks


 
Hi
I am performing a data import through dataloader so I need to disable validation rules and trigger.
I know how to create a custom setting , type=Hierarchy but I am unable to frame the code for validation rule and trigger.

any help will be greatly appreciated.

Thanks
Vandana
Hi
 I have some historical records in account object where the Phone field in some records is less than 10 digits and in some records it is 10 digits.
 I need to show in a report only those records whose Phone is exactly 10 digits and not less.

Pls let me know how to achieve this.

Thanks
Vandana
Hi
I have brief knowledge on OWD and sharing settings.
Please explain how OWD=Controlled By parent  actually works.
what it can impact?

also say OWD=private / public readonly for account object, if I share set of records using sharing criteria to a group of users will they also have
access to related contact , opportunity & cases records?

Thanks
vandana 

 
Hello
I have some difficulty in understanding the following

a) Normally apex code & trigger run in system.context
   But How to make the apex code execute in USER Mode?
   if the apex code executing in USER Mode  is called by a trigger, will the trigger also execute in USER Mode?

b) Can a visual force page run in USER Mode instead of system.context , again what changes need to be done and why?

c) By default webservice classes written in apex , rest api execute in what Mode?

d) what is the use of system.RunAs with respect to the above.

I hope I am clear

Thanks
Vandana R
Hello friends
I am getting the error " INSUFFICIENT_ACCESS_OR_READONLY" when I execute apex code from trigger and the logic performs an DML operation.
I went through several posts to understand this error I understood that in the context of current user not having permission to perform edit on the object is resulting in this error.

The code was written by another user with 'WITH SHARING" keyword and also he has written as test class.
I checked with sysadmin so I do not have permissions to perform any edit on the said object.


My question is how do I resolve this error.

A) Can I actually remove the "WITH SHARING" keyword and then run the code from my login ?
B) In test class can I remove the option of 'WITHOUT SHARING"?
C) Also Pls lt me know how system.RunAs() works in the above context.
D) as of now this code is not deployed, so once it is deployed if this error occurs pls explain how to to resolve

I really hope I am clear.
Thanks
vandana R