• Naval Sharma4
  • SMARTIE
  • 1134 Points
  • Member since 2015
  • Sn. Salesforce Developer
  • Appcino Technologies Pvt. Limited


  • Chatter
    Feed
  • 34
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 4
    Questions
  • 345
    Replies
//iam executed bluk record code.i getting this dml exception.//
public class ContactUtilty {
    Public static void CreateBulconRecords()
    {
        List<Contact> lstConRecords = new List<Contact>();
        
        for(integer counter = 1; counter <= 20; counter++)
        {
            // Prepare the Record..
            Contact con = new Contact();
            
                con.LastName= 'arjunreddy - '+ counter;
                con.Fax = '0878946464';
                con.HomePhone = '9900998877';
                con.Email = 'apexhr'+counter+'@gmail.com';
            
              // Add the Record to the Collection..
              lstconRecords.Add(con);
        }
        
        if(! lstconRecords.isEmpty())
        {
            insert lstconRecords;            
        }        
    }

}
public class HospitalApex{

    public Hospital__c hosp{get;set;}
    public Hospital__c insertedrecord{get;set;}

public HospitalApex( ApexPages.StandardController sc ) {
        this.hosp= (Hospital__c)sc.getRecord();
}
    
  public void insertNewItem() {
if(hosp.Name == NULL || hosp.Name == '' )
{
   ApexPages.addmessage(new ApexPages.message(ApexPages.severity.FATAL,'Please enter Something'));   
}
 else
 {     
      insert hosp;
      id insertedrecordid = hosp.Id;
      insertedrecord = [Select Name, Account__c  from Hospital__c where Id = :insertedrecordid  ];
      hosp = new Hospital__c();     
 }   
  }
}
 
<apex:page standardController="Hospital__c" extensions="HospitalApex">
<apex:form >
<apex:pageBlock >
  <apex:pageMessages id="showmsg"></apex:pageMessages>  
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
  Hospital Name : 
<apex:inputField value="{!hosp.Name}"/>  
</apex:pageBlockSectionItem>
    
 <apex:pageBlockSectionItem >
Account Name :  
 <apex:inputField value="{!hosp.Account__c}"/>
</apex:pageBlockSectionItem>  
</apex:pageBlockSection>   
  
    <apex:pageBlockButtons >
    
<apex:commandButton action="{!insertNewItem}" value="Save" rerender="showmsg"/>   

</apex:pageBlockButtons>
    
<apex:pageBlockTable value="{! insertedrecord }" var="ct" id="mainSection">
    <apex:column headerValue="Hospital Name">"{! ct.Name }"</apex:column>
    <apex:column headerValue="Account Name">"{! ct.Account__c }"</apex:column>
</apex:pageBlockTable>    

</apex:pageBlock>
</apex:form>
</apex:page>
I want to save record entered in text field in table but when i click on Save button, nothing happens
 
global class BirthdayCard implements Database.Batchable<sObject> {
    
    global Database.QueryLocator start(Database.BatchableContext bc)
     {
        return Database.getQueryLocator([SELECT OwnerId,DOB_Formula__c,Id,Possible_Followup_Date__c FROM Lead WHERE DOB_Formula__c =  NEXT_N_DAYS:7 AND Possible_Followup_Date__c != null]);
    }
    global void execute(Database.BatchableContext bc, List<Lead> scope)
    { 
        List<Task> listOfTask = new list<Task>();
        
        for(Lead l : scope)
        {
            Task B = new Task();
            B.Subject= 'Send Birthday Card';
            B.ActivityDate = date.today();
            B.OwnerId = l.OwnerId;
            B.WhoId=l.Id;
            listOfTask.add(B);
 
When a Lead is converted into an account, it gives the option to create a Pipeline opportunity. My issue is that if selected, I cannot edit this opportunity's fields via a trigger (I have both a trigger for when the Opportunity is created and when a Lead is converted and neither work for that opportunity). Strange thing is that if the opportunity is created before or after the conversion, my triggers are able to edit these fields. Is there a reason that the conversion opportunity is uneditable? Is there a workaround to this problem?
We're trying to import information from Salesforce into our Grails3 system and don't really need to authenticate every user since we can control user access at our system login. Can we use something a bit more permanent to send API requests to our my.salesforce.com instance at a system level without having to prompt our already locally logged-in authorized users to authenticate with SF every time we want to import another record from SF to our system?
<apex:page controller="Calculator"> <apex:form > <apex:inputText value="{!number1}"/> <apex:inputText value="{!number2}"/> <apex:inputText value="{!operator}"/> <apex:commandButton value="Show Result" action="{!calculation}">{!result} </apex:commandbutton> </apex:form> </apex:page>


CONTROLLER

public class Calculator
{
public integer number1{get;set;}
public integer number2{get;set;}
public string operator{get;set;}
public double result{get;set;}
public void calculation()
{
if(operator.contains('+'))
result=number1+number2;
if(operator.contains('-'))
result=number1-number2;
if(operator.contains('*'))
result=number1*number2;
if(operator.contains('/'))
result=number1/number2;
}
}
 
Subject: Developer script exception from (Company) : SlackOpportunityPublisher for job ID 7074M00005mBr87. : Argument 1 cannot be null

Message: Apex script unhandled exception by user/organization: 00561000001ZL2O/00D610000007iZw
Failed to process Queueable job for class SlackOpportunityPublisher for job ID 7074M00005mBr87.
caused by: System.NullPointerException: Argument 1 cannot be null
Class.SlackOpportunityPublisher.QueueableSlackCall.execute: line 36, column 1

If anyone can make sense of this or has any recommendations I would appreciate it.
Thanks -Mark
 
Hi, 

  Is there  a way to get difference between two column as another column in report. Please let me know. 

Thanks 
Maheem
I am always getting this error "ContactDetails$controller$locationChange [Cannot read property 'indexOf' of undefined] Failing descriptor: {ContactDetails$controller$locationChange}" Not sure what is wrong, can you please help

My component is 

<aura:component controller="ContactController">

    <aura:attribute name="contact" type="Contact" default="{'sobjectType': 'Contact'}"/>
    <aura:handler event="aura:locationChange" action="{!c.locationChange}"/>

    <div class="details">
        <h1>{!v.contact.Name}</h1>
        <h3>{!v.contact.Account.Name}</h3>
        <h3>{!v.contact.Title}</h3>
        <p>{!v.contact.Phone}</p>
        {!v.contact.MobilePhone}
    </div>

</aura:component>



and Controller is



({
    locationChange : function(component, event, helper) {
        
        var token=event.getParam("token");
        if(token.indexOf('contact/')===0)
        {
            var contactId=token.substr(token.indexOf('/')+1);
            var action=component.get("c.findById");
            action.setParams({"contactId":contactId});
        }
        action.setCallback(this,function(response){
            
            component.set("v.contacttt",response.getReturnValue());
        })
    $A.enqueueAction(action);
    }
})
Scenario is: If Quote status exceeds 7 days, send email reminder to record owner to follow up with quote

User-added imageUser-added imageUser-added imageUser-added image i was trying to do this but face problem in first status 
When i create Quote it can't fatch me " Status change DateTime" first time.
I want to do this Scenario with Apex Class: "If Quote status exceeds 7 days, send email reminder to record owner to follow up with quote
"
Can we customize the standard form code, Can I use DML on a standard form field.
I need to fetch the field value on the form using DML. Is it possible in salesforce?
What is the other solution? Please reply.