• Prakashb
  • NEWBIE
  • 405 Points
  • Member since 2012

  • Chatter
    Feed
  • 14
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 123
    Replies
I am Creating records thru Visualforce page. Everytime I hit Save button only Id gets generated and Entered values are shown Blank.

VF
<apex:page standardController="Tandure_Domain__c" sidebar="false" extensions="attachementsample">
 <apex:form >
   <apex:pageblock >
   <apex:pageblockbuttons location="Bottom">
    <apex:commandButton value="Save" action="{!Save1}" disabled="{!save}"/>
   </apex:pageblockbuttons>
    <apex:pageblockSection title="Salesforce">  
       <apex:inputField value="{!Tandure_Domain__c.Name__c}"/>
       <apex:inputField value="{!Tandure_Domain__c.Education__c}"/>
    </apex:pageblockSection>
   </apex:pageblock>
  </apex:form>  
</apex:page>
Class
 
public class attachementsample {
public tandure_domain__c dom{get;set;}
String accid = System.currentPagereference().getParameters().get('id');

    public attachementsample(ApexPages.StandardController controller) {
    dom=new tandure_domain__c();
    }
   public void save1()
   {
     Database.upsert(dom); 
     system.debug('>>>>>'+dom); // Education and Name fields are Blank here, Only Id got generated
}
}


Thanks,
 
Hello, 

I have a Master - Detail Relationship between two objects, say, Tasks__c and Projects__c. Each Project is supposed bto have a few tasks. So when I display the instances of the tasks in the Tasks tab, I also want to display the details of the project it is related to. Right now, I am able to display the Project__c id, i.e., the index field, but not the name of the project or any other detail. A screenshot of the current Tab is attached below. Please help!!

PS: This is a very basic thing which I can easily do in a custom visualforce page. Calling this feild name  : Project__r.Project_Name__c.
But, how do I display this field in Salesforce defined detailed page. 
User-added image

I want to show the Project Name here as well.
Hi all,
I written one trigger and test class, but code coverage is 33%. can any one help me

Trigger:-
---------
trigger LeadPreventUpdatePhone on Lead (before update) {         
    string UserName = userinfo.getUserName();
    if(UserName.left(4) == 'sfdc'){
    for (Lead Lead : System.Trigger.new) {   // This line is not covered the code
        Lead oldLead = Trigger.oldMap.get(Lead.ID); // This line is not covered the code
        if(Lead.Phone != oldLead.Phone){ // This line is not covered the code
            Lead.Phone = oldLead.Phone; // This line is not covered the code
        }
    }
    }


Test class:-
--------------
@isTest
public class LeadPreventUpdatePhoneTestClass
{

    @isTest static void LeadPreventUpdatePhone()
    {
       Profile p = [SELECT Id FROM Profile WHERE Name='SumT Support'];
       User u = new User(Alias = 'Test', Email='Test@testorg.com',
       EmailEncodingKey='UTF-8', LastName='Test', LanguageLocaleKey='en_US',
       LocaleSidKey='en_US', ProfileId = p.Id,
       TimeZoneSidKey='America/Los_Angeles', UserName='xsfdc@testorg.com');

       System.runAs(u) {
         // The following code runs as user 'u'
       System.debug('Current User: ' + UserInfo.getUserName());
       System.debug('Current Profile: ' + UserInfo.getProfileId());
    
    
       Lead objLead=new Lead();
       objLead.OwnerId=u.ID;
       objLead.LastName='sampath';
       objLead.Company='Testing';
       objLead.Job_Function__c='VP1';
       objLead.Department__c='HR1!';
       objLead.Lead_Source_Category__c='Partner1';
       objLead.Status='Open';
       objLead.Email='sampath.kumar@octaware.com';
       objLead.phone='515222632';
       insert objLead;
       Lead la = [select phone from Lead where id = :objLead.id limit 1];
       System.debug('Original Lx:'+ la.phone);
       System.assert(la.Phone == '515222632');       
       la.phone = '123456789';
       update la;
      
        Lead lb = [select phone from Lead where id = :objLead.id limit 1];
        System.debug('Changed lb:'+ la.phone);
//COMMENT:  then we assert that the field we updated equals the field it was updated from
        System.assert(la.Phone == '123456789');
        }
      
    }
  }

hi,

 

how print even numbers between 1 to 50 in developer console class......

 

i write a code here ...........

 

An error is generate ... line9:18 no aviable alternaive at character '%'...

 

 

class

================

public class ListEvenNumbers
{
public void evenMethod()
{
Integer limit=50;
System.debug('Printing even numbers between 1 and '+limit);
for(Integer i=1;i<=limit;i++)
{
if(i%2==0)
{
System.debug('Display the even numbers'+i);
}
}
}
}

 

 

please help me

  • October 11, 2012
  • Like
  • 0

I need help with a trigger I wrote.  It works fine with one record updates but it hits the govenor limits when a batch is procesesd.  I understand that it is because I have the SOQL query in a for loop which is causing the query to fire multiple times when a batch is processed.  The issue is I am not sure how to write it where the Query is outside the loop and the trigger will still work and how to "Bulkify" the portion where I am updating BillingCity and BillingZip to handle the mutiple records in the query.  I'm a beginner/learning and any help would be appreciated.

 

trigger triggerAccountCityState on Account (before insert, before update) {

// IF THE ACCOUNT RECORD BEING INSERTED/UPDATED HAS A BILLINGPOSTALCODE AND DOES NOT HAVE A BILLINGCOUNTRY OF "FOR", EXECUTE TRIGGER
    for(Account acct:Trigger.new){
        if(acct.BillingPostalCode != null && acct.BillingCountry != 'FOR'){     
            string zipcode = acct.BillingPostalCode;
            string zipcity;
            string zipstate;
            
// QUERY THE CUSTOM sOBJECT "ZIP CODE" TO GET THE CITY AND STATE FOR THE ZIP CODE BEING INSERTED/UPDATED
            List <Zip_Code__c> zipList = [select Name, City__c, State__c from Zip_Code__c where Name = :zipcode];

// REPLACE THE EXISTING CITY AND STATE WITH THE DATA RETURNED FROM THE QUERY
                for(Zip_Code__c z : zipList){
                zipcity = z.City__c;
                zipstate = z.State__c;
                }
            acct.BillingCity = zipcity;
            acct.BillingState = zipstate;

// IF NOTHING WAS RETURNED/UDPATED GIVE THE INVALID ZIP CODE ERROR
            for (Integer i = 0; i < Trigger.new.size(); i++) {
                if (Trigger.new[i].BillingCity == null){
                    Trigger.new[i].addError('The Zip Code you have entered is not valid.');
                }
            }
           }

    }

}
  • October 04, 2012
  • Like
  • 0

HI,

 

I want to set default value for Required field of standard object. Before insert trigger is not working on that. Help me.

 

Eg: There is Last name in Lead, which is required field, what my business requirement is when i click on save without entering the field value in "Last Name",trigger would update "XYZ" value in that standard field.

 

Hope my requirement is clear. any help would be appreciated.

 

regards,

Taani

I want to write a trigger on Account so that when I edit the Phone field of an existing Account record ,the same Phone also auto populate in the Phone field of associated Contacts of that Account .

 

I have created a trigger but it shows exception .Please give me genuine way to avoid this exception or help me with code .

 

Here is my code

trigger updtPhone on Account (before update) {

for(Account acc:trigger.new){
List<contact> lst=new List<contact>();
Contact c=new Contact();
c=[SELECT Phone FROM Contact WHERE AccountId=:acc.id];
c.Phone=acc.Phone;
lst.add(c);
update acc;
}
}

 

Hi everybody,

 

My opportunity has a master-detail to a custom object called Opportunity.

i tried this

<apex:repeat value="{!Opportunity.Payment__c}" var="line"

 

but it's not working.

Anyone?

 

is there any possibility of uploading a video file or directly a video in salesforce sandbox

 

 

Thanks In advance

Hi,Community!

 

I want to test the following code.

Plead tell me how to write test code.

 

public with sharing class LogACallControllerExtension {
    
    public Task task;
    
    ApexPages.Standardcontroller controller;
    
    public LogACallControllerExtension(ApexPages.StandardController controller) {
        this.task = (Task)controller.getRecord();
        User u = [Select Id From User Where id = :UserInfo.getUserId()];
        List<Lead> lead = [Select Id,Email,Phone From Lead Where Lead.Id =:ApexPages.currentPage().getParameters().get('who_id')];
        task.WhoId = lead[0].Id;
        task.WhatId = ApexPages.currentPage().getParameters().get('what_id');
        task.Status = ApexPages.currentPage().getParameters().get('tsk12');
        task.OwnerId = u.Id;
    }
    
   
    public PageReference save() {
        Task t = new Task();
        t.ownerId = task.ownerId;
        t.status = task.status;
        t.subject = task.subject;
        t.whoId = task.whoId;
        t.activityDate = task.activityDate;
        t.Description = task.Description;
        insert t;   
        return null;
    }

}

 Thanks.

Hi, 

 

I'm getting this error - can anyone help me tp understand whay this simple SELEST QUERY doesn't work?

 

Query in Forice.Com Explorer:

SELECT Id FROM Account WHERE DateDiff(day, CreatedDate, GETDATE()) = 0

 

It return the follwing error:

MALFORMED_QUERY:
FROM Account WHERE DateDiff(day, CreatedDate, GETDATE()) = 0
^
ERROR at Row:1:Column:41
unexpected token: ','

 

Best regards,

Nicolai

HI all,

     

 Hi need to test coverage  for the apex class ,I am getting 66%, can any one help  to get more that 75%, My apex class is

 

 

public class acceptavailability
{
id i;
id pid;
public acceptavailability()
{
i=apexpages.currentpage().getparameters().get('id');
system.debug('i===='+i);
for(Availability_In_Order__c a:[select id,Purchase_Order__c from Availability_In_Order__c where id=:i])
{
pid=a.Purchase_Order__c;
system.debug('+++'+pid);
}
}
public pagereference update1()
{
pagereference p2=new pagereference('/'+i);
purchase_order__C p=[select id,Available_Order_Accepted_by_executive__c from purchase_order__C where id=:pid];
system.debug('p===='+p.id);
p.Available_Order_Accepted_by_executive__c=true;
update p;
return p2;
}
}

 

_---------------------- 

My test class is

 

 

@isTest
Private class Testacceptavailability
{
static TestMethod void TestAccept()
{
id i ='a07U000000AK8mW';
id pid;
Purchase_Order__c p = new Purchase_Order__c();
insert p;

Availability_In_Order__c a= New Availability_In_Order__c(Purchase_Order__c=p.id );
insert a;

acceptavailability ac= new acceptavailability();
ac.update1();

}

}

  The red lines are not covered any can help


Hi 

I am getting date as 2012-07-03 00:00:00 but I want the date format as 03/07/2012 is it possible to get it this way without time 

please help me to solve this problem thanks.

 

thanks 

Anu

Hi All,

 

I have a image in Visualforce pdf and i want it to display according to the field selection 

 

I have used the following code but it is not working

<apex:image url="{!$Resource.Image1}" rendered="{!Opportunity.Project_l__c='East Point'}" />

 

Project_I__c is a lookup field in Opportunity.

when i select this field as East Point it should show the image.

 

Please help me...

Thanks in advance.

  • July 02, 2012
  • Like
  • 0

Hi,

 

We have a requirement were in we need to fetch datas which are stored in Salesforce objects and we need that to be cached on the VF page instead of the controller.

 

We have actions to be executed based on the data  which we are storing, so we do not want to hit the controller each and every time for verifying the data.

 

Is there an option in Salesforce where in we can put the data in the memory of the page and use those data using Javascript or some other option.

 

Any help would be greatly appreciated.

 

Thanks.

 

Prakash

I am Creating records thru Visualforce page. Everytime I hit Save button only Id gets generated and Entered values are shown Blank.

VF
<apex:page standardController="Tandure_Domain__c" sidebar="false" extensions="attachementsample">
 <apex:form >
   <apex:pageblock >
   <apex:pageblockbuttons location="Bottom">
    <apex:commandButton value="Save" action="{!Save1}" disabled="{!save}"/>
   </apex:pageblockbuttons>
    <apex:pageblockSection title="Salesforce">  
       <apex:inputField value="{!Tandure_Domain__c.Name__c}"/>
       <apex:inputField value="{!Tandure_Domain__c.Education__c}"/>
    </apex:pageblockSection>
   </apex:pageblock>
  </apex:form>  
</apex:page>
Class
 
public class attachementsample {
public tandure_domain__c dom{get;set;}
String accid = System.currentPagereference().getParameters().get('id');

    public attachementsample(ApexPages.StandardController controller) {
    dom=new tandure_domain__c();
    }
   public void save1()
   {
     Database.upsert(dom); 
     system.debug('>>>>>'+dom); // Education and Name fields are Blank here, Only Id got generated
}
}


Thanks,
 
I cannot trace the Custom Object Called COMPLAINT in our SFDC ORG , albeit there's a tab for COMPLAINT available and working. I need to figure out the corresponding Object so that I can implement the Case management for customer complaint handling. This is very URGENT

Please help.

Thanks.

Debendra
I am having a custom button on case as related list button .
This button is on different objects like Account,opportunity,Quote and some othe custom objects.
The button works fine in out side the service cloud console , but it is nor working in console.
below code is for out side the console . I need a help how can put  this button for console.
This button also should  work in console , can any one please guide  me how to do this .

{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")}

//Get parent ID
var x = top.window.location.pathname;
var x1 = x.substring(1,x.length);
var xpre = x1.substring(0,3);

//Parent page is Account
if (xpre == '{!$ObjectType.Account}'){
var Acc = sforce.connection.query("Select Id, Name From Account Where Id = '" + x1 + "' limit 1");
var accrecords = Acc.getArray("records"); 
if (accrecords.length > 0){
top.window.location.href = '/setup/ui/recordtypeselect.jsp?ent=Case&nooverride=1&save_new_url=/500/e?nooverride=1&def_account_id=' + accrecords[0].Id + '&retURL=%2F' + x1;
}
}
//Parent page is Opportunity
else if (xpre == '{!$ObjectType.Opportunity}'){
var Opp = sforce.connection.query("Select Id, AccountId, Account.Name, Name From Opportunity Where Id = '" + x1 + "' limit 1");
var opprecords = Opp.getArray("records"); 
if (opprecords.length > 0){
top.window.location.href = '/setup/ui/recordtypeselect.jsp?ent=Case&nooverride=1&save_new_url=/500/e?nooverride=1&def_account_id=' + opprecords[0].AccountId + '&{!$Setup.OrgIDs__c.SR_OPRTY__c}_lkid='+ opprecords[0].Id + '&{!$Setup.OrgIDs__c.SR_OPRTY__c}='+ opprecords[0].Name + '&retURL=%2F' + x1;
}
}
//Parent page is Quotes
else if (xpre == '{!$ObjectType.UNUM_QUOTE__c}'){
var Qte= sforce.connection.query("Select Id, Name, OPRTY_ID__r.AccountId, OPRTY_ID__r.Name, OPRTY_ID__c From UNUM_QUOTE__c Where Id = '" + x1 + "' limit 1");
var Qterecords = Qte.getArray("records"); 
if (Qterecords.length > 0){
top.window.location.href = '/setup/ui/recordtypeselect.jsp?ent=Case&nooverride=1&save_new_url=/500/e?nooverride=1&def_account_id='+Qterecords[0].OPRTY_ID__r.AccountId+'&{!$Setup.OrgIDs__c.SR_OPRTY__c}_lkid='+ Qterecords[0].OPRTY_ID__c+'&{!$Setup.OrgIDs__c.SR_OPRTY__c}='+ Qterecords[0].OPRTY_ID__r.Name + '&{!$Setup.OrgIDs__c.SR_Quotes__c}_lkid='+ Qterecords[0].Id+'&{!$Setup.OrgIDs__c.SR_Quotes__c}='+ Qterecords[0].Name + '&retURL=%2F' + x1;
}
}

//Parent page is Enrollment Event
else if (xpre == '{!$ObjectType.Enrol_Event__c}'){
var Enr = sforce.connection.query("SELECT Id, Name, OPRTY_ID__c, OPRTY_ID__r.Name, OPRTY_ID__r.AccountId FROM Enrol_Event__c Where Id = '" + x1 + "' limit 1");
var enrrecords = Enr.getArray("records"); 
if (enrrecords.length > 0){
top.window.location.href = '/setup/ui/recordtypeselect.jsp?ent=Case&nooverride=1&save_new_url=/500/e?nooverride=1&def_account_id=' + enrrecords[0].OPRTY_ID__r.AccountId + '&{!$Setup.OrgIDs__c.SR_OPRTY__c}_lkid='+ enrrecords[0].OPRTY_ID__c + '&{!$Setup.OrgIDs__c.SR_OPRTY__c}='+ enrrecords[0].OPRTY_ID__r.Name + '&{!$Setup.OrgIDs__c.SR_ENROL_EVENT_ID__c}_lkid=' + enrrecords[0].Id + '&{!$Setup.OrgIDs__c.SR_ENROL_EVENT_ID__c}=' + enrrecords[0].Name + '&retURL=%2F' + x1;
}
}
//Suresh Added 
//Parent page is Rating Product 
else if (xpre == '{!$ObjectType.UW_Rating_Products__c}'){ 

var Enr = sforce.connection.query("SELECT Id ,Name,OPPTY_ID__c,    OPPTY_ID__r.Name, OPPTY_ID__r.AccountId, UNUM_QUOTE_ID__c, UNUM_QUOTE_ID__r.Name, PRODT_ID__r.Name, PRODT_ID__c FROM UW_Rating_Products__c Where Id = '" + x1 + "' limit 1"); 

var enrrecords = Enr.getArray("records"); 

if (enrrecords.length > 0){ 

top.window.location.href = '/setup/ui/recordtypeselect.jsp?ent=Case&nooverride=1&save_new_url=/500/e?nooverride=1&def_account_id=' + enrrecords[0].OPPTY_ID__r.AccountId + '&{!$Setup.OrgIDs__c.SR_OPRTY__c}_lkid='+ enrrecords[0].OPPTY_ID__c + '&{!$Setup.OrgIDs__c.SR_OPRTY__c}='+ enrrecords[0].OPPTY_ID__r.Name +'&{!$Setup.OrgIDs__c.SR_Quotes__c}_lkid='+ enrrecords[0].UNUM_QUOTE_ID__c + '&{!$Setup.OrgIDs__c.SR_Quotes__c}='+ enrrecords[0].UNUM_QUOTE_ID__r.Name +'&{!$Setup.OrgIDs__c.SR_Rating_Product_ID__c}_lkid='+ enrrecords[0].Id + '&{!$Setup.OrgIDs__c.SR_Rating_Product_ID__c}='+ enrrecords[0].Name + '&{!$Setup.OrgIDs__c.SR_Rating_Product_Name__c}='+enrrecords[0].PRODT_ID__r.Name+'&retURL=%2F' + x1; 
  • March 16, 2015
  • Like
  • 0
Hi Guys,
Can you please help me out with the formula field it is very urgent. I have this formula field below and I need to update this field to get calculated date based on business days. Suppose if Record CreatedDate is on Friday then Estimated Completion Date + 2 Shouldn't be Date of Sunday it should be the Date whichever will be on Tuesday. 

Formula Field Name: Estimated_Completion_Date__c 
Field Type:  Date 
CASE(RecordType.Name, "Credit Request", CreatedDate + 2, "Cancellation", CreatedDate + 2, "Invoice/Usage Report", CreatedDate + 2, "New Order Assistance/Special Terms", CreatedDate + 1, "Technical Issue", CreatedDate + 2, "Vendor Information", CreatedDate + 2, "Purchase Order Submission", CreatedDate + 2, "Change of Address/Invoice Recipient Request", CreatedDate + 2, "Organic Growth", CreatedDate + 2, "Account Number Issue", CreatedDate + 5, Null)

Thanks Guys 
  • March 16, 2015
  • Like
  • 0
Hi folks,

Could you plz tell me how to add custom vf page as a related list in standard object?
I need to geenrate a report with Count /List of opportunities where Opportunity team member is not added. How can i do this without customization?

I am able to generate opportunitieis with team members and thier count.
 public pagereference submit()
    {
       integer count = [select count() FROM Sworn_Undertaking__c WHERE id =:swornUT.id];
        if (count>0)  // Error at this Line
        {
        if(SUT.submit_done__C == false)
        {
            sakid = 'Y';
            system.debug('***sakid'+sakid);
            SUT.City_of__c = swornUT.City_of__c;
            SUT.Address__c = swornUT.Address__c;
             upsert SUT;    
                
        }
        else
        {
             sakid = 'N';
             ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,' You have already entered details in Sworn Undertaking Form'));   
        }
        return null;
        else
        {
             sakid = 'N';
             ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,' You have already entered details in Sworn Undertaking Form'));   
        }
        
        
         pagereference pdf = page.pdfSwornUndertaking;
         pdf.getParameters().put('id',SUT.New_applicant_Name__c);
         Attachment attach = new Attachment();
         Blob body;
         try
         {
             body=pdf.getcontent();
         }
         catch(visualforceException e)
         {
             body=Blob.valueOf('Some Text');
         }
         return null;
        
}}

I have given return null but its still shows the same.. Am i wrong Anywhere?
Hi,

I have the below trigger that makes an @future call to an apex class.
This line  UpliftmentRequestFutureWebService.sendvehiclerequest makes the call.

I have tried various things in my test class such as test.startTest() and test.stopTest() and still fails with a "Methods defined as TestMethod do not support Web service callouts, test skipped".

Any guidance is very welcome on this!


trigger UpliftmentRequestCreate on Vehicle__c (after insert) {
    
    DateTime createdate = system.now();
    String dateofrequest;
    Integer insurer;
    String claimno;
    DateTime dateoflossconvert;
    String dateofloss;
    Integer vehiclecondition;
    String customerfirstname;
    String customerlastname;
    String vehiclemake;
    String vehiclemodel;
    String vehiclemmcode;
    String vehicleyear;
    String vehicleregistrationno;
    String vehiclecommercialpassenger;
    String locationname;
    String locationcontactperson;
    String locationcontactno;
    String locationemailaddress;
    String locationstreetaddress;
    String locationsuburb;
    String locationpostalcode;
    String locationcity;
    String locationprovince;
    String createuserfirstname;
    String createuserlastname;
    String salesforcecapturer;
    String salesforcerefno;
    String refno;
    id customer;
    id vehicleid;
        
    User currentuser=[Select FirstName, LastName from User Where Id =: UserInfo.getUserId() LIMIT 1];
    createuserfirstname = currentuser.FirstName;
    createuserlastname = currentuser.LastName;
    salesforcecapturer = createuserfirstname+' '+createuserlastname;
    system.debug ('Current User : ' + createuserfirstname +' '+createuserlastname);

    for (Vehicle__c v : Trigger.new) {
        vehicleid = v.id;
        customer = v.Customer__c;
        //
        //DateOfRequest    
        if (v.Insurance_Group__c == 'AFI' || v.Insurance_Group__c == 'Zurich'){
            
        dateofrequest = createdate.format('yyyy/MM/dd HH:mm:ss');
        system.debug ('Date of Request New : ' + dateofrequest);                               
        //
        //Insurer
        if (v.Insurance_Group__c != null){
                if (v.Insurance_Group__c == 'AFI'){
                    insurer = 26;
                }
                
                else if (v.Insurance_Group__c == 'Zurich'){
                    insurer = 347;
                }
                else{
                    insurer = 1;
                }
        }
        else{
                insurer = 0;
        }
        system.debug('Insurer : ' + insurer);
        //
        //ClaimNumber                
        if (v.PolicyNo__c != null){
                claimno = v.PolicyNo__c;
        }
        else{
                claimno = 'Not Specified';
        }
        system.debug('Claim No : ' + claimno);
        //
        //DateOfLoss    
        if (v.Date_Of_Loss__c != null){
                
                dateoflossconvert = DateTime.newInstance(v.Date_Of_Loss__c.year(), v.Date_Of_Loss__c.month(), v.Date_Of_Loss__c.day());
                dateofloss = dateoflossconvert.format('yyyy/MM/dd HH:mm:ss');
        }
        else{
                dateofloss = null;
        }        
        system.debug('Date of Loss : ' + dateofloss);
        //
        //VehicleCondition        
        if(v.Vehicle_Condition__c != null){
                if (v.Vehicle_Condition__c == 'Repairable'){
                    vehiclecondition = 1;
                }
                else if (v.Vehicle_Condition__c == 'WriteOff'){
                    vehiclecondition = 2;
                }
                else{
                    vehiclecondition = 0;
                }
        }
        else{
                vehiclecondition = 0;
        }
        system.debug('Vehicle Condition : ' + vehiclecondition);
        //
        //VehicleCommercialPassenger
        if(v.Vehicle_Commercial_Passenger__c != null){
                vehiclecommercialpassenger = v.Vehicle_Commercial_Passenger__c;
        }
        else{
                vehiclecommercialpassenger = 'Not Specified';
        }
        system.debug ('Vehicle Commercial Passenger : ' + vehiclecommercialpassenger);
        //
        //VehicleMake
        if(v.Make__c != null){
            vehiclemake = v.Make__c;
        }    
        else{
            vehiclemake = 'Not Specified';
        }
        system.debug ('Vehicle Make : ' + vehiclemake);
        //
        //VehicleModel
        if (v.Model__c != null){
                vehiclemodel = v.Model__c;
        }        
        else{
                vehiclemodel = 'Not Specified';
        }
        system.debug('Vehicle Model : ' + vehiclemodel);
        //
        //VehicleMMCode
        if (v.MMCode__c != null){
            vehiclemmcode = v.MMCode__c;
        }
        else{
            vehiclemmcode = 'Not Specified';
        }
        system.debug ('Vehicle MMCode : ' + vehiclemmcode);
        //
        //VehicleYear
        if (v.Reg_Year__c != null){
                vehicleyear = v.Reg_Year__c;    
        }
        else{
                vehicleyear = 'Not Specified';
        }
        system.debug('Vehicle Year : ' + vehicleyear);
        //
        //VehicleRegistrationNumber
        if(v.RegNo__c != null){
                vehicleregistrationno = v.RegNo__c;    
        }
        else{
                vehicleregistrationno = 'Not Specified';
        }
        system.debug('Vehicle Registration No : ' + vehicleregistrationno);
        //
        //LocationName
        if (v.MBR_Name__c != null){
                locationname = v.MBR_Name__c;    
        }
        else {
                locationname = 'Not Specified';
        }
        system.debug('Location Name : ' + locationname);
        //
        //LocationContactPerson    
        if (v.MBR_Contact_Person__c != null){
                locationcontactperson = v.MBR_Contact_Person__c;    
        }
        else{
                locationcontactperson = 'Not Specified';
        }
        system.debug('Location Contact Person : ' + locationcontactperson);
        //
        //LocationEmailAddress    
        if (v.MBR_Email__c != null) {
                locationemailaddress = v.MBR_Email__c;    
        }
        else {
                locationemailaddress = 'Not Specified';
        }
        system.debug('Location Email Address : ' + locationemailaddress);
        //
        //LocationStreetAddress    
        if (v.MBR_Address__c != null){
                locationstreetaddress = v.MBR_Address__c;    
        }
        else {
                locationstreetaddress = 'Not Specified';
        }
        system.debug('Location Address : ' + locationstreetaddress);
        //
        //LocationSuburb    
        if (v.MBR_Suburb__c != null){
                locationsuburb = v.MBR_Suburb__c;    
        }
        else{
                locationsuburb = 'Not Specified';
        }
        system.debug('Location Suburb : ' + locationsuburb);
        //
        //LocationPostalCode
        if (v.MBR_Postal_Code__c != null){
            locationpostalcode = v.MBR_Postal_Code__c;
        }
        else{
            locationpostalcode = '';
        }
        //
        //LocationCity
        if (v.MBR_City__c != null){
            locationcity = v.MBR_City__c;
        }
        else{
            locationcity = '';
        }
        //
        //LocationProvince    
        if (v.MBR_Province__c != null){
                locationprovince = v.MBR_Province__c;    
        }
        else {
                locationprovince = 'Not Specified';
        }        
        system.debug('Location Province : ' + locationprovince);    
        //
        //LocationContactNumber    
        if (v.MBR_Contact_No__c != null){
                locationcontactno = v.MBR_Contact_No__c;
        }
        else{
                locationcontactno = 'Not Specified';
        }
        system.debug('Location Province : ' + locationcontactno);
        //
        //SalesforceReferenceNumber    
        if (v.StockNo__c != null){
                salesforcerefno = v.StockNo__c;    
        }
        else{
                salesforcerefno = 'Not Specified';
        }
        //
        }    
    }
    
    for (Account a : [Select Id, FirstName, LastName from Account where Id =: customer LIMIT 1]) {
        
        if (a.FirstName != null){
            customerfirstname = a.FirstName;    
        }
        else {
            customerfirstname = 'Not Specified';
        }
        
        if (a.LastName != null){
            customerlastname = a.LastName;    
        }
        else{
            customerlastname = 'Not Specified';
        }
        system.debug('Customer Name : ' + customerfirstname +' '+ customerlastname);
    }
    
        
    for (Vehicle__c v : Trigger.new) {
        
        if (v.Insurance_Group__c == 'AFI' || v.Insurance_Group__c == 'Zurich'){ 
    
                try {
                
                system.debug ('About to call the web service class');
                UpliftmentRequestFutureWebService.sendvehiclerequest(dateofrequest, insurer, claimno, dateofloss, vehiclecondition, customerlastname, customerfirstname, vehiclecommercialpassenger, vehiclemake, vehiclemodel, 
                                                                     vehicleMMCode, vehicleyear, vehicleregistrationno, locationname, locationcontactperson, locationcontactno, locationemailaddress, locationstreetaddress, 
                                                                     locationsuburb, locationpostalcode, locationcity, locationprovince, salesforcecapturer, salesforcerefno);        
                }
                    catch(DmlException e){
                    system.debug('The following exception has occured: ' + e.getMessage());
                }
        }
    }            
}
Hello, 

I have a Master - Detail Relationship between two objects, say, Tasks__c and Projects__c. Each Project is supposed bto have a few tasks. So when I display the instances of the tasks in the Tasks tab, I also want to display the details of the project it is related to. Right now, I am able to display the Project__c id, i.e., the index field, but not the name of the project or any other detail. A screenshot of the current Tab is attached below. Please help!!

PS: This is a very basic thing which I can easily do in a custom visualforce page. Calling this feild name  : Project__r.Project_Name__c.
But, how do I display this field in Salesforce defined detailed page. 
User-added image

I want to show the Project Name here as well.
Can any one help me out on this?how to write a Test class for the trigger.Any help is very much appreciated.

Trigger:
 
trigger ReparentComment on CaseComment (before insert) {
    Map<String, Case> newCaseMap = new Map<String, Case>();
    Set<Id> caseIds = new Set<Id>();
    Map<Id, List<CaseComment>> ccMap = new Map<Id, List<CaseComment>>();
    List<CaseComment> newCCList = new List<CaseComment>();
    for(CaseComment cc : trigger.new)
    {
        caseIds.add(cc.ParentId);
        List<CaseComment> ccList = ccMap.get(cc.ParentId);
        if(ccList == null)
            ccList = new List<CaseComment>();
        ccList.add(cc);
        ccMap.put(cc.ParentId, ccList);
    }
    for(Case c : [Select Id, Subject From Case Where Id in :caseIds Order by CreatedDate])
        if(newCaseMap.containsKey(c.Subject))
            for(CaseComment cc : ccMap.get(c.Id))
            {
                CaseComment newCC = cc.clone();
                newCCList.add(newCC);
                newCC.ParentId = newCaseMap.get(c.Subject).Id;
            }
        else
            newCaseMap.put(c.Subject, c);

    for(Case c : [Select Id, Subject From Case Where Subject in :newCaseMap.keySet() And Id not in :caseIds And Status != 'Closed'])
        for(CaseComment cc : ccMap.get(newCaseMap.get(c.Subject).Id))
        {
            CaseComment newCC = cc.clone();
            newCCList.add(newCC);
            newCC.ParentId = c.Id;
        }
    insert newCCList;
}

Test Class :
 
@istest
public class TestReparentComment{
static TestMethod void testcomment(){
list<casecomment> ccomment = new list<casecomment>();
for(integer i=0;i<200;i++){
case c= new case(subject='RE:');
insert c
casecomment cc = new casecomment(cc.commentBody = c.Description)
Parentid=c.id;
insert cc;
List<case> insertedcases =[Select Name ,Subject,status from case Where Id in :c.Id Order by CreatedDate];
for(case c :insertedcases){
system.assertEquals(
'NotClosed',c.status);
}
}
}

 
  • March 15, 2015
  • Like
  • 0
I am attempting to schedule and email a report, and the user I want to email it to is not coming up in the "Select From" list in order for me to add them. How do I fix this in this persons profile so when I select "users" the name I want pops up. Attached is a screen shot of the directions. 

User-added image
User-added image
Hi All,
I need to pull one single report, Its like combining of two reports.. Contacts with sponsership details also contacts with affiliation details.
Sponsership has lookup field to contact and Affiliation too.. How can i cobine all these data in single report ??

Thanks.
Hello,
Below are my Visual force and controller code. I would like display Account name as read only field from the list of items. 
Unfortunately I am getting error as Error: Unknown property 'VisualforceArrayList.name'

visualforce page:

<apex:page controller="AccountInformation">
<apex:form>
<apex:sectionHeader title="ACCOUNT DETAILS"/>
<apex:pageBlock title="Detailed Information">
<apex:pageBlockButtons location="top">
<apex:commandButton value="Save"/>
<apex:commandButton value="Cancel"/>
</apex:pageBlockButtons>

<apex:pageBlockSection title="Account Information">
<apex:pageBlockSectionItem>
Account Name <apex:outputText value="{!accountlist.name}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>


<apex:pageBlockSection title="Billing Information">
<apex:pageBlockSectionItem>
Billing Street <apex:outputText />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
Billing City <apex:outputText />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
Billing State <apex:outputText />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
Billing Country <apex:outputText />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
Billing PostalCode <apex:outputText />
</apex:pageBlockSectionItem>

</apex:pageBlockSection>



<apex:pageBlockSection title="Shipping Information">
<apex:pageBlockSectionItem>
Shipping Street <apex:outputText />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
Shipping City <apex:outputText />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
Shipping State <apex:outputText />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
Shipping Country <apex:outputText />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
Shipping Zipcode <apex:outputText />
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:selectList>
</apex:pageBlock>
</apex:form>
</apex:page>



controller code:

public class AccountInformation
{

    public PageReference edit() {
    
    string str = apexpages.currentpage().getparameters().get('Accountid');
    System.debug('str+-------'+str);
    pagereference pg = new pagereference('/'+str+'/e');
        return pg;
    }







public list<Account> accountlist{get;set;}
public AccountInformation()
{
accountlist = new list<Account>();
accountlist = [SELECT Name,BillingStreet,BillingCity,BillingCountry,BillingPostalCode,BillingState,ShippingStreet,ShippingCity,ShippingCountry,ShippingPostalCode,ShippingState FROM Account order by Name asc
];

}








}
Hi everyone,
I'm trying to learn on the fly here, my knowledge is more around triggers.

I'm trying to create a List button to automatically create three records, basically I'm trying to create my own grocery list and just automate a few items.

Class and Method:
Global class addGroceries {
    WebService static void addSomeGroceries(){
        List<Groceries__c> groc = new List<Groceries__c>();
        Groceries__c g1 = new Groceries__c(Name='Garlic', Category__c='1 - Fruit and Vegetables');
        groc.add(g1);
        
        Groceries__c g2 = new Groceries__c(Name='Onions', Category__c='1 - Fruit and Vegetables');
        groc.add(g2);
        
        Groceries__c g3 = new Groceries__c(Name='Pears', Category__c='1 - Fruit and Vegetables');
        groc.add(g3);
        insert groc;            
    }
}

Onclick Javascript button:
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")}
sforce.apex.execute("addGroceries","addSomeGroceries",{});
window.location.reload();

Error message
A problem with the OnClick JavaScript for this button or link was encountered:

args not specified

Everything I look up seems to reference passing parameters as part of the button, but I don't have anything to pass here.  
I'm assuming that it's something obvious

Thanks very much



 
I have one custom field on user object like "Notify me of releases" which data type is checkbox . When user select "Notify me of releases" checkbox checked  user will get notification for every update of  article whose type is alert. 
Note:- I have created one article type alert.