• BDatla
  • NEWBIE
  • 370 Points
  • Member since 2015

  • Chatter
    Feed
  • 12
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 74
    Replies
Hi,

I am trying to create one more  contact whenever a contact is created,my code is as follows:

trigger CreateContact on Contact (after insert) {
    Contact con = trigger.new[0];
    Contact contact = new contact(LastName=con.LastName);
    insert contact;

}


can any one help me why below exception is raising
Exception:

Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger CreateContact caused an unexpected exception, contact your administrator: CreateContact: execution of AfterInsert caused by: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, CreateContact: maximum trigger depth exceeded Contact trigger event AfterInsert for [00328000001tPuI] Contact trigger event AfterInsert for [00328000001tPuJ] Contact trigger event AfterInsert for [00328000001tPuK] Contact trigger event AfterInsert for [00328000001tPuL] Contact trigger event AfterInsert for [00328000001tPuM] Contact trigger event AfterInsert for [00328000001tPuN] Contact trigger event AfterInsert for [00328000001tPuO] Contact trigger event AfterInsert for [00328000001tPuP] Contact trigger event AfterInsert for [00328000001tPuQ] Contact trigger event AfterInsert for [00328000001tPuR] Contact trigger event AfterInsert for [00328000001tPuS] Contact trigger event AfterInsert for [00328000001tPuT] Contact trigger event AfterInsert for [00328000001tPuU] Contact trigger event AfterInsert for [00328000001tPuV] Contact trigger event AfterInsert for [00328000001tPuW] Contact trigger event AfterInsert for [00328000001tPuX]: []: Trigger.CreateContact: line 4, column 1
 
  • March 31, 2015
  • Like
  • 0
hi guys,,
i am new to salesforce, what is the fuction of this statement ..
please explain me ..
List<List<Set<Integer>>> my_list_2 = new List<List<Set<Integer>>>();
Thanking you in advance..
 
HI,

I have trying to put the subquery into a second map as so:


Map<id,Case> caseToUpdate = new Map<id,Case>([select id, status,recordtypeid,Response_Time_Remaining__c,(select id , timeremaininginmins  from CaseMilestones where MilestoneType.Name like '%response%') from case where status='new' and recordtypeid='012200000005ZLF']);

Map<id,CaseMilestone> CaseMilestoneMap = new Map<id,CaseMilestone>();

for(Case tempCase:caseToUpdate){

  for(CaseMilestone cm:caseToUpdate.CaseMilestones){
 
    CaseMilestoneMap.put(cm.id,cm);
  }
}



i am getting "Compile Error: Initial term of field expression must be a concrete SObject: Map<Id,Case>" .  It is pointing to "  for(CaseMilestone cm:caseToUpdate.CaseMilestones){" .

i am pretty sure we can retrieve the subqeury and put it in a diff map...

what am i doing wrong? 
  • March 31, 2015
  • Like
  • 0
public void testSchedule() {
        List<Object_C> pList= [Select date__c 
                                                FROM Object_C
                                                WHERE  UserId = :UserInfo.getUserId() ];
        for(Object_C test : pList) {
            if(test .date__c< Date.today()){
                test .column__c = 'DONE';
                update Object_C;
            }
        }
    }

I have a fucntion which checks if the date enetered is less than today.  If true then it will update column__c to Done.

I want to implement it as apex scheduler.

I followed below links with no scucess.

http://stackoverflow.com/questions/9126886/how-do-we-schedule-a-class-to-run-every-15-mins-in-salesforce
https://developer.salesforce.com/forums?id=906F00000008rTLIAY
 
global class certifiedToLapsedScheduler implements Schedulable{
    global void execute(SchedulableContext SC) {
        RecurringScheduleJob.startJob();   
        String day = string.valueOf(system.now().day());
        String month = string.valueOf(system.now().month());
        String hour = string.valueOf(system.now().hour());
        String minute = string.valueOf(system.now().minute() + 10);
        String second = string.valueOf(system.now().second());
        String year = string.valueOf(system.now().year());
        
        String strJobName = 'Job-' + second + '_' + minute + '_' + hour + '_' + day + '_' + month + '_' + year;
        String strSchedule = '0 ' + minute + ' ' + hour + ' ' + day + ' ' + month + ' ?' + ' ' + year;
        System.schedule(strJobName, strSchedule, new certifiedToLapsedScheduler());
    } 
}

ERRRO: Method does not exist or incorrect signature: RecurringScheduleJob.startJob()

public class RecurringScheduleJob{
    public static void startJob(){
        String str = 'Job Started at : ' + system.now();
        Schedule_job__c obj = new Schedule_job__c();
        obj.name = str;
        insert obj;
    }
}
ERROR: Invalid type: Schedule_job__c


 

  • March 30, 2015
  • Like
  • 0
Hello All

I have used an wesdl to generate apex classe inside salesforce and when i am trying to call it from excute anonymous window in developer console i am getting an error.

here is the class generated :

//Generated by wsdl2apex

public class AsyncVerisysComBr {
    public class RegisterActivationResponse_elementFuture extends System.WebServiceCalloutFuture {
        public verisysComBr.dtoRegistro getValue() {
            verisysComBr.RegisterActivationResponse_element response = (verisysComBr.RegisterActivationResponse_element)System.WebServiceCallout.endInvoke(this);
            return response.RegisterActivationResult;
        }
    }
    public class AsyncWebService1Soap {
        public String endpoint_x = 'http://181.192.160.53/wsIntegracaoDiscador/sandeepIntegrationWS.asmx';
        public Map<String,String> inputHttpHeaders_x;
        public String clientCertName_x;
        public Integer timeout_x;
        public verisysComBr.ValidationSoapHeader ValidationSoapHeader;
        private String ValidationSoapHeader_hns = 'ValidationSoapHeader=http://verisys.com.br/';
        private String[] ns_map_type_info = new String[]{'http://verisys.com.br/', 'verisysComBr'};
        public AsyncVerisysComBr.RegisterActivationResponse_elementFuture beginRegisterActivation(System.Continuation continuation,String ID) {
            verisysComBr.RegisterActivation_element request_x = new verisysComBr.RegisterActivation_element();
            request_x.ID = ID;
            return (AsyncVerisysComBr.RegisterActivationResponse_elementFuture) System.WebServiceCallout.beginInvoke(
              this,
              request_x,
              AsyncVerisysComBr.RegisterActivationResponse_elementFuture.class,
              continuation,
              new String[]{endpoint_x,
              'http://verisys.com.br/RegisterActivation',
              'http://verisys.com.br/',
              'RegisterActivation',
              'http://verisys.com.br/',
              'RegisterActivationResponse',
              'verisysComBr.RegisterActivationResponse_element'}
            );
        }
    }
}

i am trying to exectue using this below code 

AsyncVerisysComBr.RegisterActivationResponse_elementFuture ex1;
AsyncVerisysComBr.AsyncWebService1Soap ex2 = New AsyncVerisysComBr.AsyncWebService1Soap();
ex1 = ex2.beginRegisterActivation(60, '00vJ000000H6Nix');


Error i am getting is 

Line: 3, Column: 7
Method does not exist or incorrect signature: [AsyncVerisysComBr.AsyncWebService1Soap].beginRegisterActivation(Integer, String)

can some one help me how to call this class 

Thanks in Advance 
Hello,

I want to detect the apex page url in javascript.

I am not sure if this is correct forum to ask this question.
  • March 27, 2015
  • Like
  • 0
I have 3 pages which does nearly sale thing, I have created 3 pages and 3 respective controllers.
Is there way i could reuse my visualfoce page and controller.
  • March 26, 2015
  • Like
  • 0
How can i include my css and javascript i use for page as a static resource and use them in my visualforce page ?
  • March 26, 2015
  • Like
  • 0
Hi Experts!

I hope you can help me with this.

I'm trying this experiment some apex code
I have ObjectX, ObjectA and ObjectB.
ObjectA and ObjectB are a Lookup in ObjectX.

First is that I create ObjectA, then in Related List when ObjectX is created, I want to have fields updated on ObjectA with the value fields from Object B which is a lookup on ObjectX. It should do something like the image below.

User-added image

I'm able to do it with the below code but it's giving me incorrect records when I update All records in DataLoader.

Not sure if my approach is correct. Please Help. Here's my code.

trigger TestFieldUpdate on ObjectX__c (after insert, after update){

Map<ID, ObjectA__c> ObjectA = new Map<ID, ObjectA__c>();
  Set<Id> Ids = new Set<Id>();
  Set<Id> ObjectBids = new Set<Id>();
    
  for (ObjectX__c ObjX : Trigger.new) {
    Ids.add(ObjX.ObjectA__c);
    ObjectBids.add(ObjX.ObjectB);
  }

  ObjectA = new Map<Id, ObjectA__c>([SELECT id, Field_1__c, Field_2__c,
                                        (SELECT id,ObjectB__r.Field_1__c, ObjectB__r.Field_2__c
                                         FROM ObjectX__c) 
                                         FROM ObjectA__c 
                                         WHERE ID IN :Ids]);
  
  //I'm not sure if this part is correct though

  List<ObjectB__c> ObjectB = [SELECT Id, Field_1__c, Field_2__c FROM ObjectB__c 
                                      WHERE Id =: ObjectBids ];
 
  for (ObjectX__c ObjectX: Trigger.new){
      
      ObjectA ObjA = ObectA.get(ObjectX.ObjectA__c);
      ObjA.Field1__c = ObjectB[0].Field_1__c;
      ObjA.Field1__c = ObjectB[0].Field_2__c;
      //And So on..
    
  }
      
  IF(ObjectB.size()>0) update ObjectB.values();
    
}


Please let me know what's is the correct code to use if my code is a total none sense :(

Thanks a Lot!

P.S. I'm still learning things, so please explain what each lines does :)

 
<script type="text/javascript">
    function call(id1,id2,id3){ 
        callAction(document.getElementById(id1).value,document.getElementById(id2).value,document.getElementById(id3).value); 
    }
</script>

 <apex:selectList size="1" value="{!wValue}" id="check1"
         onchange="call('{!$Component.check1}','{!$Component.check2','{!$Component.check3}';">
            <apex:selectOption itemValue="Select"/> 
            <apex:selectOptions value="{!lOptions}" />
</apex:selectList>
sometimes my value is null and the javascript is not called
  • March 25, 2015
  • Like
  • 0
I am trying to write a trigger that will update a picklist field on the Account object if a checkbox is true. when the (Account.Billing_Address_Same_As_Shipping_Address__c=true) then i want the  Account.StateOrProvince__c  to equal Account.Shipping_State__c. any help would be appreciated.  my trigger code is below.


trigger Trigger_UpdateBillingAddress on Account (after update) {
    
    for (Account obj: trigger.new){
        if(Account.Billing_Address_Same_As_Shipping_Address__c=true)
        Account.StateOrProvince__c = Account.Shipping_State__c;
    }

}
  • March 25, 2015
  • Like
  • 0
Hi All

When updating 115 record through data loader,
i got this error message. 
ERROR: UpdateTrigger: System.LimitException: Too many future calls: 51

Originally I thought it was because i was updating more than 50 record. 
but I tried it again with 50 record and got the same message.

Plz guys help me out as soon as possible, i will be grateful.
If required to display my code then let me know.

Thanks in advance
I have a child object for which a profile cannot see the related list on the parent object layout. I can see the related list when signed in as System Administrator. I have checked:
  • The profile has read access rights to the child and parent objects and to all fields on those objects
  • The parent object layout assigned to the profile is correct (there is only one) and has the related list on it
Can't figure out what's missing. One other thing to say is there is no tab for this child object, by design.
Can anyone help please?
Thanks
Trevor
Hi

I have a requirement to login in into salesforce through another web application

I have configure the single sign on feature in my organization, and configure the axiom Identity provider and i am able to login into to salesforce through the axiom heroku app.

but i want to login in through my web application by clicking on button how can i configure

Thanks in Advance
MD Farooq Ahmed
 
Hello  Everyone,

I am trying to create the new record on Task  that is related to case.
But i am getting the below error.

Can you please help me to fix this.

Thanks for the help.

[object Object]: Tasktriggerhandler: execution of BeforeUpdate caused by: System.DmlException: Insert failed. First exception on row 0 with id 00TK000000IDH1nMAH; first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id] Class.Tasktriggerhandlerclass.DependenceTask: line 137, column 1 Trigger.Tasktriggerhandler: line 20, column 1



public void DependenceTask(LIST<Task> LstTaskValues)
      {
        set<Id> Caseids= new Set<Id>();
        List<Task> LstTaskUpdates= new List<Task>();
        List<Task> InsertTask= new List<Task>();
        for(Task Tasks:LstTaskValues)
        {
          Caseids.add(Tasks.WhatId);
          caseIds.add(Tasks.WhoId);
        }
        LstTaskUpdates=[SELECT subject,WhatId,RQQ_Part_2_Info_Collected__c,Status__c,Review_Affiliation_Kit__c,Assigned_Supervisor_Reviewed__c,Web_CRD_Composite_Info_Collected__c,Verifiable_GDC__c FROM Task where WhatId IN:Caseids];
        for(Task TaskValues:LstTaskUpdates)
        {
           //Review_Affiliation_Kit__c,Assigned_Supervisor_Reviewed__c,Web_CRD_Composite_Info_Collected__c,Verifiable_GDC__c
           //Create a Approved Prospect File.
          if(TaskValues.Review_Affiliation_Kit__c==true && TaskValues.Assigned_Supervisor_Reviewed__c=='IGO' && TaskValues.Web_CRD_Composite_Info_Collected__c=='Approved' && TaskValues.Verifiable_GDC__c=='Approved')
          {
            TaskValues.Subject='Onboarding-Approve Prospect File';
            Taskvalues.OwnerId='005A0000001WunG' ;//User Values are hard coded
            InsertTask.add(Taskvalues);  
          }
        }
          if(InsertTask.size()>0)
          {
            insert InsertTask ;
          }
            system.debug('LstTaskUpdates====>>>>>>>>>>>'+InsertTask);
    }

//This is the place where i am calling the trigger
if(Trigger.Isupdate && Trigger.IsBefore)
    {
       rtHandler.CloseAllTask(Trigger.New);
        rtHandler.DependenceTask(Trigger.New);
      
    }

Regards,
Jyo
Hi,

I am trying to create one more  contact whenever a contact is created,my code is as follows:

trigger CreateContact on Contact (after insert) {
    Contact con = trigger.new[0];
    Contact contact = new contact(LastName=con.LastName);
    insert contact;

}


can any one help me why below exception is raising
Exception:

Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger CreateContact caused an unexpected exception, contact your administrator: CreateContact: execution of AfterInsert caused by: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, CreateContact: maximum trigger depth exceeded Contact trigger event AfterInsert for [00328000001tPuI] Contact trigger event AfterInsert for [00328000001tPuJ] Contact trigger event AfterInsert for [00328000001tPuK] Contact trigger event AfterInsert for [00328000001tPuL] Contact trigger event AfterInsert for [00328000001tPuM] Contact trigger event AfterInsert for [00328000001tPuN] Contact trigger event AfterInsert for [00328000001tPuO] Contact trigger event AfterInsert for [00328000001tPuP] Contact trigger event AfterInsert for [00328000001tPuQ] Contact trigger event AfterInsert for [00328000001tPuR] Contact trigger event AfterInsert for [00328000001tPuS] Contact trigger event AfterInsert for [00328000001tPuT] Contact trigger event AfterInsert for [00328000001tPuU] Contact trigger event AfterInsert for [00328000001tPuV] Contact trigger event AfterInsert for [00328000001tPuW] Contact trigger event AfterInsert for [00328000001tPuX]: []: Trigger.CreateContact: line 4, column 1
 
  • March 31, 2015
  • Like
  • 0
<aura:attribute name="native" type="boolean" default="true"/>
    <aura:attribute name="accounts" type="Account[]"/> 
    <div class="pink">
    <table style="width:100%">
        <aura:iteration var="acc" items="{!v.accounts}">
            <aura:if isTrue="{!acc.Id != ' '}">
            <aura:if isTrue="{!v.native}">
            <tr>
                <th>Account Id</th>
                <th>Name</th>
                <th>Country</th>
                <th>City</th>
                <th>Email</th>
            </tr>
                {!v.native}=false;
                 component.set("v.native",'false');
                 {!v.native};

            </aura:if>
            <tr>
                <td>{!acc.Id} </td> 
                   <td>{!acc.Name} </td> 
                   <td>{!acc.Country__c} </td>
                   <td> {!acc.City__c} </td>
                   <td>{!acc.Email__c}</td>            
            </tr>
            </aura:if>
      </aura:iteration>
    </table>  
    </div>

I wanted to set "native" attribute to false  without using the client controller.If anyone having another solution to this problem.
Please share it.
hi guys,,
i am new to salesforce, what is the fuction of this statement ..
please explain me ..
List<List<Set<Integer>>> my_list_2 = new List<List<Set<Integer>>>();
Thanking you in advance..
 
HI,

I have trying to put the subquery into a second map as so:


Map<id,Case> caseToUpdate = new Map<id,Case>([select id, status,recordtypeid,Response_Time_Remaining__c,(select id , timeremaininginmins  from CaseMilestones where MilestoneType.Name like '%response%') from case where status='new' and recordtypeid='012200000005ZLF']);

Map<id,CaseMilestone> CaseMilestoneMap = new Map<id,CaseMilestone>();

for(Case tempCase:caseToUpdate){

  for(CaseMilestone cm:caseToUpdate.CaseMilestones){
 
    CaseMilestoneMap.put(cm.id,cm);
  }
}



i am getting "Compile Error: Initial term of field expression must be a concrete SObject: Map<Id,Case>" .  It is pointing to "  for(CaseMilestone cm:caseToUpdate.CaseMilestones){" .

i am pretty sure we can retrieve the subqeury and put it in a diff map...

what am i doing wrong? 
  • March 31, 2015
  • Like
  • 0
I am creating a connection to salesforce from Delphi. I am able to login to salesforce and get issue details.
After this I created a windows service to do the same process. By using windows service,I am able to login to salesforce. But I am not query any objects. I get the exception "ESOAPHTTPException with message - A connection with the server could not be established"

  RIO := THTTPRIO.Create(nil);
  xConnection := getSOAP(false, '', RIO);
  lr := xConnection.login('Username', 'pwd');
  RIO.Service    := lr.sessionId;
  RIO.URL        := lr.serverUrl;
  sh := SessionHeader.Create;
  sh.sessionId := lr.sessionId;
  (RIO as ISOAPHeaders).Send(sh); 
    qr := xConnection.query('Select id,Name,LastName from User');

At this place I get the exception.
Please suggest how to proceed.
Hi,

I have tried all ways searched in google but still couldn't get it. Can i know whats the reason
  • March 24, 2015
  • Like
  • 0
Hi

I have a requirement to login in into salesforce through another web application

I have configure the single sign on feature in my organization, and configure the axiom Identity provider and i am able to login into to salesforce through the axiom heroku app.

but i want to login in through my web application by clicking on button how can i configure

Thanks in Advance
MD Farooq Ahmed