• Vasani Parth
  • SMARTIE
  • 859 Points
  • Member since 2014
  • Parth Vasani


  • Chatter
    Feed
  • 23
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 3
    Questions
  • 275
    Replies
HI All,

How to write a test class for schedule apex class?
give explanation about this variable, String sch = '0 0 2 * * ?';
Hi i have written the trigger  in such away that when i update the  contact record , another Contact  record  hasto be inserted .But when i try to update the existing record it throwing the error like  " execution of BeforeUpdate caused by: System.NullPointerException: Attempt to de-reference a null object: Trigger.wed: line 39, column 1" 

and my code is as below,

trigger wed on Contact(Before insert, Before Update)
{

Public Account a;

Public List<Contact> ab;

if(Trigger.isinsert==TRUE)
{
For(Contact c:Trigger.New)

{

ab=new List<Contact>();

 a= [select Phone from Account where ID=:c.AccountID];
 
 c.Phone=a.Phone;
 
 ab.add(c);
 
}

}

if (Trigger.isUpdate==TRUE)
{

For(Contact ct:Trigger.New)
{

String stv=ct.FirstName;

Contact cts=new Contact();

cts.FirstName='ram';
cts.LastName=ct.LastName;

ab.add(cts);

}
insert ab;

}

}

So please suggest me any one, where iam doing the error.




 
Error: Compile Error: Illegal assignment from String to Date at line 6 column 1

trigger studentdata on Student_Particluars__c (before insert,before update) {

for(Student_Particluars__c std :Trigger.New){
std.phone__c ='909090099';
std.descripition__c = 'gopal naik';
std.DOB__c = '5/5/2016';

}

}
Hello,

I have completed my apex specialist superbadge in first attempt but I did not receive any special badge related to first time ascent.

Does it take some time to get updated as I can only see simple super badge in my trailhead profile. 

Arpit
Hi All,

whether trigger will be called once or twice and when will you get the recursive trigger?
Hello,

 A field in a standard object is modified for many records, I was wonderring if there is any way to get them back.

field tracking history is not ticked for this object
  • July 19, 2016
  • Like
  • 0
I am quite new for VisualForce and want to ask a question. Is there any way on VisualForce to help me to have a responsive design on my page? Or I need to desgin the css to solve this problem? Thanks for your help.
Does anyone know if I create a Salesforce Site and associate a VF page with it, can I retrieve the site's public URL given the VF page name using SOQL? Thanks
Guys ,

Can anyone tell me where I mean which list type or list is used to store the below Query .
select Id , (select Id, Name from Contacts) from Account .
Hello,
I have a custom object, Survey, and I have created a visualforce page to show a customized UI. I successfully linked it to a custom button to be used for creating a new record and it displays correctly but hitting the save button doesn't save the record.
No errors are displayed instead, the page redirects to the previous page.
This is my code:
 
<apex:page standardController="Survey__c" recordSetVar="surveys">
    <apex:pageMessages />
    <apex:form >
        <apex:pageBlock title="Create a new survey">
            <apex:pageBlockButtons >
                    <apex:commandButton value="Save" action="{!save}"/>
                    <apex:commandButton value="Cancel" action="{!cancel}"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection columns="1">
                // The fields go here
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

What could be the issue ?
Hello All,

Need some information, suppose I have 2 fields called Age & DOB in a controller, these are not a getter setter fields, I have a button on the VF page, when I click the button these fields should get loaded to the page, how to achieve this.

Thanks in advance.
Jancy
I want to group a a bunch of input fields under one radio button similar to ASP:Radiobutton.
Please see the below screen shot.
The forst radio button selected has "city" and "state" grouped togetrher.
Is it possible to do this usng the selectRadio component?

User-added image
these is What i have Written,,

trigger UpdateAccount on Account (after insert,after update, after delete, after undelete) 
{
set<ID> setAccountIDs=new Set<ID>();
for (Account a:Trigger.new)
{
setAccountIDs.add(a.AccountID);
List <Account> accounts=[select ID,Name from Account Where ID IN: setAccountIDs];
String accName = '';
a.name=accName;
}
update account;
}
I am trying to Schedule an class at the interval of 5 minutes but am not getting any idea how to perform it, i have seen some examples but they are not working properly please help if any body can.
I remembered last time I can format the code, but I am not able to see any icon to format code either in IE or Chrome.What happen?How to post code here?


trigger Opportunity_Trigger on Opportunity (before insert) { if (Trigger.isBefore) { if(Trigger.isInsert) { OpportunityTriggerHandler.populateDefaultData (Trigger.new); } } }
Does anyone know how to execute git commands in a batch file. I have ant commands in a batch file that pulls the meta data from salesforce. And I would like to schedule the ant and git in one batch and schedule it to keep a backup. Please help.
Hello,

I've just refreshed a Sandbox and would like to make sure that it's possible for the developers to deploy changes from Sandbox to Production using Apex.com IDE.

I don't have a lot of experience with this and can't seem to find some basic instructions about it.

Could someone give me some tips?

Thank you!
 I have writen a apex class to import csv file from the VF page . Now I want to remove special characters(@,#.% etc) from particular column of CSV file say "Account Name" . How would do I that with my below code ? Thanks.
Would be glad if anyone can help finding a way in my code.
public class importDataFromCSVController
 {
    public Blob csvFileBody{get;set;}
    public string csvAsString{get;set;}
    public String[] csvFileLines{get;set;}
    public List<account> acclist{get;set;}
    
    public importDataFromCSVController()
    {
        csvFileLines = new String[]{};
        acclist = New List<Account>(); 
    }
  
 public void importCSVFile()
 {
       try
       {
           csvAsString = csvFileBody.toString();
           csvFileLines = csvAsString.split('\n'); 
            
           for(Integer i=1;i<csvFileLines.size();i++)
           {
               Account accObj = new Account() ;
               string[] csvRecordData = csvFileLines[i].split(',');
               accObj.name = csvRecordData[0] ;             
               accObj.accountnumber = csvRecordData[1];
               accObj.Type = csvRecordData[2];
               accObj.AccountSource = csvRecordData[3];   
               accObj.Industry = csvRecordData[4];                                                                             
               acclist.add(accObj);   
           }
            //insert acclist;
        }
        catch (Exception e)
        {
            ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured while importin data Please make sure input csv file is correct');
            ApexPages.addMessage(errorMessage);
        }  
  }
}
<apex:page controller="importDataFromCSVController">
    <apex:form >
        <apex:pagemessages />
        <apex:pageBlock >
            <apex:pageBlockSection columns="4"> 
                  <apex:inputFile value="{!csvFileBody}"  filename="{!csvAsString}"/>
                  <apex:commandButton value="Import Account" action="{!importCSVFile}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
        <apex:pageBlock >
           <apex:pageblocktable value="{!accList}" var="acc">
              <apex:column value="{!acc.name}" />
              <apex:column value="{!acc.AccountNumber}" />
              <apex:column value="{!acc.Type}" />
              <apex:column value="{!acc.Accountsource}" />
              <apex:column value="{!acc.Industry }" />
        </apex:pageblocktable>
     </apex:pageBlock>
   </apex:form>
</apex:page>
Any help will be appreciated .
 

My delete button does not work after putting endless efforts and thought to post here.When i click on Delete button, its just rerendering and not deleting after trying with actionSupport.

Also I'm not able to search by OwnerId though my query is right. Please help.


public class PagingTasksController1{

    public List<Task> Tasks;

   
    public Task del;
    public Task taskDel;
    public Integer CountTotalRecords{get;set;}
    public String QueryString {get;set;}
    public Integer OffsetSize = 0;
    private Integer QueryLimit =3 ;
    public List<Task> lstTasks {get;set;}
    public String searchText {get;set;}
    public String rowIndex {get;set;}
    public Date mydate;
    public Integer totalCount {get;set;}
    public string sortField = 'Subject';  // default sort column
    private string sApplySOQL = '';
     public List<Task> delattendeeList {get;set;}

    public List<Task> delAttendees {get; set;}

    public PagingTasksController1(ApexPages.StandardController controller) {

     taskDel= (Task)controller.getRecord();
     Tasks = [Select id,Subject,Status,ActivityDate from Task where OwnerId =: taskDel.Id];
    // this.Tasks=Tasks[0];
     totalCount = Tasks.size();

     delattendeeList = new List<Task>();
     delattendees = new List<Task>();
      }


      // the current sort direction. defaults to ascending
       public String sortDir {
        get  { if (sortDir == null) {  sortDir = 'asc'; } return sortDir;  }
        set;
      }

     // the current field to sort by. defaults to role name
      public String getsortField() {
        return sortField;
    }

    // the current field to sort by.
     public void setsortField(string value) {
        sortField = value;
     }
            
    // toggles the sorting of query from asc<-->desc
    public void toggleSort() {
        // simply toggle the direction
        sortDir = sortDir.equals('asc') ? 'desc' : 'asc';
      
        integer iIndex = sApplySOQL.indexOf('Order By');
        if (iIndex > -1){
          sApplySOQL = sApplySOQL.substringBefore('Order By');
          sApplySOQL = sApplySOQL + ' Order By ' + sortField + ' ' + sortDir +  ' limit ' + QueryLimit + ' offset ' + OffsetSize;
        }
        tasks = Database.query(sApplySOQL );
    }
  
     public PagingTasksController1 (){
        //CountTotalRecords= [select count() from Task];
        //String qStr2= '7/23/2014';
          
     }

     public List<Task> getTasks(){
        if(tasks == null){
            tasks = new List<Task>();
        }
        return tasks;
    }

       public void findTasks(){
        String qStr2 = 'Select count() from Task where Subject like \'%'+searchText+'%\' OR Status like \'%'+searchText+'%\'';
        CountTotalRecords = Database.countQuery(qStr2);
        queryTasks();
     }

    public void  queryTasks(){
        
        String qStr2= searchText;
        Set<Id> ownerIds = new Set<Id>();
        String strnormal = '';
        try{
             mydate = date.parse(qStr2);
        }catch(Exception e)
        { }
           
        String strDate = '';
        if(mydate != null) {
         // strnormal = String.valueOf(mydate );
          String[] qstr3 = String.valueOf(mydate).split(' ',2); 
          strDate = ' ActivityDate =  '+ qstr3[0] + ' ';
        }else{
       
           strDate  =  'Subject like \'%'+searchText +'%\' OR Status like \'%' +searchText+ '%\' Order By '  + sortField;
        }
       
        if (ownerIds != null && ownerIds.size() > 0){
       
          String qStr = 'Select OwnerId,Subject,Status,ActivityDate from Task where '+strDate+' limit ' + QueryLimit + ' offset ' + OffsetSize +' and OwnerId in :ownerIds';
          System.debug(qStr); 
          tasks = Database.query(qStr);         
        }
       
           //String qStr ='Select OwnerId,Subject,Status,ActivityDate from Task where \''+strDate +'\' limit ' + QueryLimit + ' offset ' + OffsetSize;
          // String qStr = 'Select OwnerId,Subject,Status,ActivityDate from Task where '+strDate+' limit ' + QueryLimit + ' offset ' + OffsetSize;
       
                  
            //  String qStr = 'Select OwnerId,Subject,Status,Priority from Task where Subject like \'%'+searchText+'%\' OR Status like \'%'+searchText+ '%\' Order By ' + sortField;

       //tasks.sort();

         }

       public Boolean getDisablePrevious(){
        if(OffsetSize>0){
            return false;
        }
        else return true;
    }

     public Boolean getDisableNext() {
        if (OffsetSize + QueryLimit < countTotalRecords){
            return false;
        }
        else return true;
    }

      public PageReference Next() {
        OffsetSize += QueryLimit;
        queryTasks();
        return null;
    }

      public PageReference Previous() {
        OffsetSize -= QueryLimit;
        queryTasks();
        return null;
       }

      public PageReference save() {
        update tasks;
        return ApexPages.CurrentPage();
       }
    
      public void deleteRow(){

         rowIndex = String.valueOf(ApexPages.currentPage().getParameters().get('rowIndex'));
         System.debug('rowIndex ------------'+rowIndex );
         if(rowIndex!=null)
         {
         Task check=[Select id from Task where id=: rowIndex];
         System.debug('row to be deleted ' + check);
         delete check;
         Tasks=[Select Subject,Status,ActivityDate,OwnerId from Task ];
         update Tasks;
           }
         }
       }


         <apex:page controller="PagingTasksController1" docType="html-5.0">
          <apex:form >
          <apex:variable var="rowNumber" value="{!0}"/>
            <apex:pageBlock title="Tasks" id="pgBlock" >
      
           <apex:pageBlockButtons >
               <apex:commandButton action="{!save}" id="saveButton" value="Save"/>
               <apex:commandButton onclick="resetInlineEdit()" id="cancelButton" value="Cancel"/>
           </apex:pageBlockButtons>
 
             <apex:inlineEditSupport showOnEdit="saveButton, cancelButton"
                    hideOnEdit="editButton" event="ondblclick"
                    changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
 
               <apex:inputText id="searchBox" value="{!searchText}"/>
                <apex:commandButton value="Search" reRender="pgTable,pgBlock" action="{!findTasks}"/>
          
          <apex:pageBlockTable value="{!Tasks}" var="tsk" id="pgTable">
              
         <apex:column headerValue="Action" >
           <apex:commandButton value="Delete" action="{!deleteRow}" reRender="pgTable">
           <apex:param name="rowIndex" value="{!tsk.id}"/>
          </apex:commandButton>             
        </apex:column>
          
                 
             <!-- <apex:column headerValue="Action" >
            <apex:outputLink value="{!URLFOR($Action.Task.Delete, .id,['retURL'='/apex/New_Test_task_Assignment'])}"> Delete</apex:outputLink>
           </apex:column>  -->
        
           <apex:column headerValue="Subject">
              <apex:facet name="header">
                    <apex:commandLink value="Subject" action="{!toggleSort}" rerender="pgTable" >
                    <apex:param name="sortField" value="Subject" assignTo="{!sortField}"/>
                    <apex:outputPanel rendered="{!BEGINS(sortField,'Subject')}">
                         <apex:image value="{!IF(sortDir = 'desc','/img/arrowDown.gif','/img/arrowUp.gif')}"/>
                    </apex:outputPanel>
                    </apex:commandLink>
                </apex:facet>    
              
                  <apex:outputField value="{!tsk.Subject}"/>
           </apex:column>
          
          
             <apex:column headerValue="Status">
               <apex:facet name="header">
                    <apex:commandLink value="Status" action="{!toggleSort}" rerender="pgTable" >
                    <apex:param name="sortField" value="Status" assignTo="{!sortField}"/>
                    <apex:outputPanel rendered="{!BEGINS(sortField,'Status')}">
                         <apex:image value="{!IF(sortDir = 'desc','/img/arrowDown.gif','/img/arrowUp.gif')}"/>
                    </apex:outputPanel>
                    </apex:commandLink>
              </apex:facet>        
 
           <apex:outputField value="{!tsk.Status}"/>
         </apex:column>
     
        <apex:column headerValue="OwnerId">
            <apex:outputField value="{!tsk.OwnerId}"/>
        </apex:column>
       
        <apex:column headerValue="date">
            <apex:outputField value="{!tsk.ActivityDate}"/>
        </apex:column>  
          
          </apex:pageBlockTable>
           <apex:pageBlockButtons >
                <apex:commandButton value="Previous" action="{!Previous}" rerender="pgTable,pgBlock"
                                    status="status" disabled="{!DisablePrevious}" />
                <apex:commandButton value="Next" action="{!Next}" reRender="pgTable,pgBlock"
                                    status="status" disabled="{!DisableNext}" />
                <apex:actionStatus id="status" startText="Please Wait..."/>
               </apex:pageBlockButtons>
             </apex:pageBlock>
          </apex:form>
      <apex:enhancedlist type="Activity" height="800" rowsPerPage="50" customizable="False"/>
    </apex:page>



I need to include "Del" to delete records row wise . How can i implement with my code . Helpful suggestions and code will be really appreacibale .If there is any other way , please mention that also .Here the code searches for Activities on task object.Thanks in advance .


<apex:page controller="TaskListController">
       <apex:form id="searchForm">
      <apex:PageBlock mode="edit">      
      <apex:pageblockSection id="searchBlockSection">
       <apex:pageBlockSectionItem id="searchBlockSectionItem">
        <apex:outputLabel >Keyword</apex:outputLabel>
            <apex:panelGroup >
                <apex:inputtext id="searchTextBox" value="{!searchText}">

                </apex:inputtext>
                <apex:commandButton Id="btnSearch" action="{!Search}" rerender="renderBlock" status="status" title="Search" value="Search">                    </apex:commandButton>
            </apex:panelGroup>
        </apex:pageBlockSectionItem>
    </apex:pageblockSection>
    <apex:actionStatus id="status" startText="Searching... please wait..."/>      
    <apex:pageBlocksection id="renderBlock" >
        <apex:pageblocktable value="{!SearchResults}" var="o" rendered="{!NOT(ISNULL(SearchResults))}">
            <apex:outputLink value="/{!o.Id}">{!o.Subject}</apex:outputLink>
            <apex:column value="{!o.Subject}"/>

        </apex:pageblocktable>     
    </apex:pageBlocksection>
   </apex:pageblock>
  </apex:form>
  <apex:enhancedlist type="Activity" height="800" rowsPerPage="50" customizable="False"/>
   </apex:page>



public class TaskListController
    {
       public apexpages.standardController controller{get;set;}
       public Task l;
       public List<Task> searchResults {get; set; }

      public string searchText
      {
       get
       {
         if (searchText==null) searchText = '';
         return searchText;
       }
      set;
       }

     public TaskListController(ApexPages.StandardController controller)
     {
        this.controller = controller;
        this.l = (Task) controller.getRecord();
      }

    public PageReference search()
    {
      if(SearchResults == null)
      {
        SearchResults = new List<Task>();
      }
     else
     {
        SearchResults.Clear();
     }

     String qry = 'Select Id, Subject,Status from Task where Subject like \'%'+searchText+'%\' Order By Subject,Status';
  // System.debug(qry);
    SearchResults = Database.query(qry);
SearchResults.sort();
   // System.debug(SearchResults);
   return null;
    }
   }
I have earned 9 badges but when I go to My Profile it only shows 5. Copare the two screen shots:
9 Badges showing in the NavBar

and

5 Badges showing in Profile

What gives?...
I am having a picklist field(Status) with values A,B,C and D

 I want to hide or remove only D  value from Piclist(Status) in the VF page

Can someone pls help me with the code.

Regards,
Viswa.
Hello,

bulk as an annotation look like to be permitted in a trigger, is there any documentation on the purpose of it ?

For instance, the 2 following are valid
trigger AccountTrigger on Account bulk (before insert){
// Do something
}
trigger AccountTrigger on Account  (before insert){
// Do something
}
Hi 
I want Salesforce Certified Force.com Developer - Summer '16 Release Maintenance Announcement exam please provide the dumps

Thanks 
Chandu
 
The Account object's Type field must have the following picklist values: Prospect, Customer, Pending. Before creating the approval process, verify the values in your Account object setup
The last couple of days it has seemed like saving and deploying changes on a number of different instances via Mavens Mate seems to be taking quite a bit longer than usual.

Has anyone noticed a similar slow down? In some cases it has been faster to edit the code directly on the instance via the web and deploy via changesets.

Saving a class/trigger is taking on average 6-8mins which seems quite a bit longer than I am used to.
Hi,

Is there a way to implement a secure way to log CC information on a leads account?
Hi All,

Currently we are using all our docuemnts(Draft versions, revisison of attachments..) store in SharePoint and share drives. In Salesforce, looking options to store Files/Attachments in SFDC only instead of sharepoint for a user conveinent prospetive. Could you please suggest some of the option to store with the limitations of data - since we have a large number of files and storing all the versions as well. Thanks
They are not in setup menu. DO NOT RESPOND SETUP QUICK SEARCH! 
i have a record on vf page and i want that same record should autopopulate in inputtext field of another vf page.
PLEASe help me out.
I'm triying to query FullPhotoUrl from an User object and creating a PageReference for that URL. But this runs me into the security scan issue URL Redirection Attack.

Can someone please help me to fix this?

String userId = String.escapeSingleQuotes(Apexpages.currentpage().getparameters().get('ID'));
list<User> lstUsers = [select FullPhotoUrl from User where Id=:userId limit 1];
String strPhotoURL = lstUsers[0].FullPhotoUrl;

strPhoto = EncodingUtil.base64encode(new PageReference(strPhotoURL).getContent());

Thank you in advance!
I plan to make Apex and Visualforce changes and 'deploy' to Production using either the Change Set mechanism or Force.com IDE. Which is the preferable(or standard industry practice) way to deploy these changes? If there is a prefered method, then why is one prefered over the other?

Also, are Apex and Visualforce changes treated just as metadata changes, so if I am able to modify the metadata for these specific changes, and 'commit' these changes using Force.com IDE, can I effectively 'rollback' any Apex or Visualforce changes already deployed to Production?

Can someone please advise?

Many thanks!
How cascading search is performed in account search ? 
  • August 01, 2016
  • Like
  • 0
Hi,

I Want answer of Some Questions Related To Rest API.

1: How to create partner of salesforce using rest api
2: How to generate lead using rest api
3: How to get particular lead performance
4: how to upload bulk user performance using rest api
5: how to create user particular organisation using rest api
6: how to add multiple organisation using rest api
7: how to filler performance month wise,weekly,yearly using rest api
8: How to generate campaign using rest api

Thanks,
Hardik chavda