• SRajesh8
  • SMARTIE
  • 720 Points
  • Member since 2012

  • Chatter
    Feed
  • 26
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 46
    Questions
  • 353
    Replies

Hello,

 

How can I write a SOQL statement with a clause "does not contain" ? I've tried this Carrier_ID__c not like '%TEST%' but it does not work. I want to use this SOQL for the dataloader to export the data. Please advise.

 

Thanks

Paul

 

  • July 11, 2013
  • Like
  • 0

Passing ID to other Page to display Google maps but not able to display maps , Any help would be appreciated

Here's my Code

 

<apex:page standardController="Account">

<script src="https://maps.google.com/maps?file=api">
</script>

<script type="text/javascript">

var map = null;
var geocoder = null;

var address = "{!Account.BillingStreet}, {!Account.BillingPostalCode} {!Account.BillingCity}, {!Account.BillingState}, {!Account.BillingCountry}";

function initialize() {
if(GBrowserIsCompatible())
{
map = new GMap2(document.getElementById("MyMap"));
map.addControl(new GMapTypeControl());
map.addControl(new GLargeMapControl3D());

geocoder = new GClientGeocoder();
geocoder.getLatLng(
address,
function(point) {
if (!point) {
document.getElementById("MyMap").innerHTML = address + " not found";
} else {
map.setCenter(point, 13);
var marker = new GMarker(point);
map.addOverlay(marker);
marker.bindInfoWindowHtml("Account Name : <b><i> {!Account.Name} </i></b>
Address : "+address);
}
}
);
}
}
</script>
<div id="MyMap" style="width:100%;height:300px"></div>
<script>
initialize() ;
</script>

</apex:page>

 

I asked about this before.

I don't know how to access the data that I need.

 

I have a VF page:

<apex:page standardController="Case" extensions="CaseExtension" >
<apex:pageBlock title="Viewed Cases" rendered="{! IF (case.Status=='', true, false)}">
<apex:form >
<apex:dataTable value="{!case}" var="s" columns="5" cellspacing="15" >
<apex:column value="{! s.CaseNumber}" headerValue="Case Number" />
<apex:column value="{! s.Contact}" headerValue="Contact Name" />
<apex:column value="{! s.Reason}" headerValue="Reason" />
<apex:column value="{! s.CreatedDate}" headerValue="Created Date" />
<apex:column value="{! s.Owner}" headerValue="Owner" />
</apex:dataTable>
</apex:form>

</apex:pageBlock>
</apex:page>

 

I don't know how to set up the Controller Extension. I read about get and put, I tried various codes, but i am not having any success in accessing the data.

 

I would very much appreciate help with this matter.

 

 

  • June 05, 2013
  • Like
  • 0

Hi All

 

I have a VisualForce page embeded as a related list in Opportunity, which takes the Opportunity id and displays certain details.

 

There is a Checkbox in the VF page. when this Checkbox is selected I need to update another object at backend and refresh the entire Opportunity detail page.

 

The VF page is already there, i just have to incorporate this change. Can someone give me some sample code looking at which I can understand how do I use Java script, and how do I update the object with the value of Opportunity ID and the field (on VF page) pervious to the Checkbox.

 

I am a Newbie, any help will be greatly appriciated.

 

Regards

  • June 03, 2013
  • Like
  • 0

 

I have an email publisher that populates based on the value in the case type field. However, I have only been able to get 40% coverage. Any idea what I am doing wrong?

 

Visualforce page with email publisher:

 

<apex:page standardController="Case" extensions="myControllerExtention2">
<apex:emailPublisher entityId="{!case.id}"
emailBody="{!EmailBody}"
subject="{!Subject}"
/>
</apex:page>

 

Extension that contains logic and content for the email publisher:

 

public class myControllerExtention2 {
private Case cas;
private string EmailBody, Subject;
//Define default values
String defaultEmailBody = '';
String defaultSubject = '';

//Instantiate Visualforce standard controller 
public myControllerExtention2(ApexPages.StandardController stdController) {
//Instantiate case record
this.cas= (case)stdController.getRecord();
//SOQL query
cas = [SELECT Type FROM Case where Id =: cas.Id];
//Case record type conditionals
If (cas.Type=='AAA') {
emailBody = 'AAA body content';
subject = 'AAA subject';
}
If (cas.Type=='BBB') {
emailBody = 'BBB body content';
subject = 'BBB subject';
}
If (cas.Type=='CCC') {
emailBody = 'CCC Body';
subject = 'CCC subject';
}
}

//Accessor methods
public string GetEmailBody() {
If (emailBody == NULL) { 
return defaultEmailBody;
}
Else {
return emailBody;
}
}
public string GetSubject() {
If (subject == NULL) { 
return defaultSubject;
}
Else {
return subject;
}
}
}

 


The test code (currently provides 40% coverage):

 

@isTest
public class testMyPage2 {
static testMethod void myPage_Test() {
PageReference pageRef = Page.CaseEmailPublisher;
Test.setCurrentPageReference(pageRef);
//Create new account
Account newAccount = new Account (name='XYZ Org');
insert newAccount;
//Create first contact
Contact myContact = new Contact (FirstName='Joe',
LastName='Miller',
AccountId=newAccount.id);
insert myContact;
//Create first case
Case myCase = new Case(
ContactId=myContact.id,
Type='AAA');
insert myCase;
ApexPages.StandardController sc = new ApexPages.standardController(myCase);
myControllerExtention2 e = new myControllerExtention2(sc);
myCase.type='BBB';
update myCase;
myCase.type='CCC';
update myCase;
}
}

 

Hi guys,

 

I need help with this Apex Class as I'm having difficulties creating a test method for it.

 

public with sharing class myQuestionnaireExtension {
private final Questionnaires__c webquestionnaire;
public myQuestionnaireExtension(ApexPages.StandardController
stdController) {
webquestionnaire = (Questionnaires__c)stdController.getRecord();
}
public PageReference saveQuestionnaire() {
try {
insert(webquestionnaire);
}
catch(System.DMLException e) {
ApexPages.addMessages(e);
return null;
}
PageReference p = Page.ThankYou;
p.setRedirect(true);
return p;
}
}

 

Here's what I've started with:

 

@isTest
private class myQuestionnaireExtensionTest {
    static testMethod void myQuestionnaireExtension() {
        // Set up the Account record.
        Questionnaires__c q = new Questionnaires__c(Name = 'TestQuestionnaire');
        insert q;
        
        }
}

 

Any help on this would be appreciated and be rewarded by a thousand likes! 

 

  • July 06, 2012
  • Like
  • 0

Hi,

 

how to write test method for this class,

 

public class Emailnewpurchaserecord
{
set<id> pset=new set<id>();
map<string,string> emap=new map<string,string>();
public Emailnewpurchaserecord()
{
for(profile p:[select id,name from profile where name=:'Executive User'])
pset.add(p.id);
for(profile p1:[select id,name from profile where name=:'Factory User'])
pset.add(p1.id);
system.debug(pset+'p===');
for(user u:[select id,name,Email,profileid from user where profileid in : pset])
{
if(u.id!=null)
emap.put(u.name,u.email);
}
system.debug(emap+'e===');
}
public void send()
{
if(emap.size()>0)
{
for(string s:emap.keyset())
{
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[] {emap.get(s)}; 
mail.setToAddresses(toAddresses);
mail.setReplyTo('support@acme.com');
mail.setSenderDisplayName(s);//here if we specify s that will taken the name which specified in object
mail.setSubject('Purchase Order is Placed');
mail.setBccSender(false);
mail.setUseSignature(false);
mail.setPlainTextBody('hi');
mail.setHtmlBody('New Purchase Order is Created');
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
}
}
}

 

Thank you.

 

I'm new to the APEX development world, though I have quite a bit of experience using the API.  I feel like I'm very close to getting this to work, I just want to increase my test coverage of my trigger.  The trigger has two tasks:

 

1.  After the record has been inserted, a field should be updated

2.  Send an e-mail

 

The trigger is pretty simple:

 

trigger UpdateMostRecentCommentOnCase on CaseComment (after insert) {
	Case relatedCase;
	Contact relatedCaseContact;
	Messaging.Singleemailmessage customerEmail;
	
	for (CaseComment caseComment : trigger.new) {
		//Find the related case.
		relatedCase = [SELECT Id FROM Case WHERE Id = :caseComment.ParentId];
		
		//If the case was found, updated the most recent comment.
		if (relatedCase != null) {
			relatedCase.Most_Recent_Case_Comment__c = caseComment.CommentBody;
			update relatedCase;
			
			if (caseComment.IsPublished == true) {
				//Fetch the related case contact.
				relatedCaseContact = [SELECT Email FROM Contact WHERE Id = :relatedCase.ContactId];

				if (relatedCaseContact != null && relatedCaseContact.Email != null) {
					customerEmail = new Messaging.Singleemailmessage();
					customerEmail.setToAddresses(new List<String> { relatedCaseContact.Email });
					customerEmail.setReplyTo('foo@bar.com');
					customerEmail.setSubject('New comment for case ' + relatedCase.CaseNumber);
					customerEmail.setTemplateId('myActualIdIsHere');
					
					Messaging.sendEmail(new List<Messaging.Email> { customerEmail });
				}
			}	
		}
	}
}

 The test class that I have is very simple as well, though, I am not entirely sure how to test e-mails with the test methods:

 

@isTest
private class TestCase {
    static testMethod void testUpdateMostRecentCommentOnCase() {
        Case testCase;
        CaseComment testCaseComment;
        Contact testContact;
        Contact testQueriedContact;
        Messaging.Singleemailmessage testEmail;
        List<Messaging.Sendemailresult> testEmailResults;
        
        testContact = new Contact();
        testContact.FirstName = 'Foo';
        testContact.LastName = 'Bar';
        insert testContact;
        
        testCase = new Case();
        testCase.Subject = 'Test Case';
        testCase.ContactId = testContact.Id;
        insert testCase;
        
        test.startTest();
        
        testCaseComment = new CaseComment();
        testCaseComment.ParentId = testCase.Id;
        testCaseComment.CommentBody = 'Test Case Comment';
        insert testCaseComment;

        //What else do I need here to test?
        
        test.stopTest();
    }
}

 

This only puts me at 52% code coverage; everything after the comment, "//Fetch the related case contact." is not covered.

 

How do I provide coverage for the e-mail piece of the trigger?

 

Thanks for any input!

Can anybody tell  how can i find General User permission setting in summer 12 . i went through profile and when i click any profile there is object setting,app setting Apec class access but i am not getting   any section for General user permission.Please tell me where can i get this.

Hi All,

 

My apologies for not learning more I am gradually learning Apex but I have hit an error and I am hoping its something simpler then I think it seems to be saying.

 

I am getting the following error:

 

Error: Compile Error: Invalid initial expression type for field Account, expecting: SOBJECT:Account (or single row query result of that type) at line 20 column 11

 

Code

 

@isTest
Public class TestMigrateRelatedOb{
static testMethod void myPage_Test()
{

//Test converage for the myPage visualforce page

Account newAccount = new Account (name='XYZ Organization',
BillingCity ='TestCity',
BillingCountry ='TestCountry',
BillingStreet ='TestStreet',
BillingPostalCode ='t3stcd3'
);

insert newAccount;

Contact NewContact = new Contact (
FirstName = 'xyzFirst',
LastName = 'XyZLast',
Account = newAccount.id,
Email = 'xyzmail@mail.com'
);

Insert NewContact;

Task NewTask = new Task (Who = NewContact.id,
Subject = 'TestTask',
ActivityDate = date.today()
);

Insert NewTask;

Event NewEvent = new Event (Who = NewContact.id,
Subject = 'TestEvemt',
ActivityDate = date.today()
);

Insert NewEvent;

Lead NewLead = new Lead (Company = 'XYZ Organization',
FirstName = 'xyzFirst',
LastName = 'XyZLast',
Email = 'xyzmail@mail.com',
Old_Contact_ID__c = NewContact.ID
);

Insert NewLead;
}
}

 

 

Now I am hoping that the error doeans meen I have to do and SOQL query to get the ID of the new account when inserting the new contact for the test.

 

Thanks for any help.

 

R

hi everyone 

 

i have one class below which is used as a component,but i unable to deploy due to code coverage.

 

Apex Class :

 

public with sharing class ItineraryBuilderController {
public List<Test_Flight_Request__c> listFR;
public Id opportunityID;
public string result;
public Id getopportunityID(){ return opportunityID; }

public void setopportunityID(Id s){
opportunityID = s;
ItineraryBuilderController();
}
public void ItineraryBuilderController() {
listFR = [select Name From Test_Flight_Request__c where Opportunity__c = :opportunityID
and Customer_Approved__c = true
order by Name asc limit 1 ];


}

public string getIB()
{

Http h = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint('http://testsite/GetCustomerView?opportunityId='+listFR[0].Opportunity__c+'&flightRequestID='+listFR[0].Id);
req.setMethod('GET');

HttpResponse res = h.send(req);
result = res.getBody();

return result;

}


}

 

Test class

 

@isTest
private class ItineraryBuilderControllerTestCase {

static testMethod void ItineraryBuilderController_TestMetho() {
Opportunity opp = new Opportunity();
opp.Name = 'Test Opp';
opp.StageName = 'Ticketing';
opp.p1_First_Name__c ='A';
opp.p1_Last_Name__c ='D';
opp.p1_Gender__c = 'S';
opp.p1_First_Name__c ='S';
opp.p1_Last_Name__c ='A';
opp.p1_Gender__c = 'D';
opp.DOB_Main_Passenger__c = System.now().date();
opp.Number_of_Passengers__c = 4;
opp.CloseDate = System.now().date();
opp.Departure_Date__c = System.now().date();
opp.Origin_City__c = 'DEL';
opp.Destination_City__c= 'MUI';
opp.Return_Date__c = System.now().date();
insert opp;

Test_Flight_Request__c fr = new Test_Flight_Request__c();
fr.Budget__c = '23';
fr.Publish_Fare__c = '35';
fr.Opportunity__c = opp.Id;
fr.From__c = opp.Origin_City__c;
fr.To__c = opp.Destination_City__c;
fr.Outbound_del__c = opp.Departure_Date__c;
fr.Pax_del__c = opp.Number_of_Passengers__c;
fr.Region_del__c = opp.Destination_Zone__c;
fr.Inbound_del__c = opp.Return_Date__c;
fr.Outbound_Flexibility__c = opp.Flexibility_From__c;
fr.Inbound_Flexibility__c = opp.Flexibility_To__c;
fr.Email_To__c ='anil@swiftsetup.com';
fr.Email_Content__c= 'Test';
fr.Subject__c ='subject test';

insert fr;


}
}

 

please let me know where i am going wrong.

 

thanks in advance


 

 

Hi,

 

I am writing the code below to update the fields on different objects. But I have a hard time writing the test code. Please have a look at the code and a 66% test code below, and please give me some ideas pointing me to the right direction.

 

Thanks in advance.

 

Main Code:

 

Trigger UpdateUpcoming on Task (after insert, after update)
{
    Set<id>AccountsIDs = new Set<id>();
    List<Account>AcctList = new List<Account>();
    
//This section will address the account

    For (task t:Trigger.new)
    {
    For (Account at:[Select id,upcoming_due__c,upcoming_due_2__c From Account where id =: t.accountid])
{

//This section will pick up the due date of the task

    If (at.upcoming_due__c == null)
        at.upcoming_due__c = date.valueof(t.activitydate);
    Else
    If (date.valueof(t.activitydate) < at.upcoming_due__c)
        at.upcoming_due__c = date.valueof(t.activitydate);
    Else
    If (date.valueof(t.activitydate) > at.upcoming_due__c)
        at.upcoming_due_2__c = date.valueof(t.activitydate);
    AcctList.add(at);
}
}

//This section will update the due date into the Upcoming Due in the corresponding Account

    update AcctList;
}

 

66% Code (Need 75% at least..):

 

@isTest
private class TestUpcomingDueDate
{
private static TestMethod void testTrigger()
{
account ac=new account(name='abc');
insert ac;
task t=new task(activitydate=system.today(),whatid=ac.id);
insert t;
update ac;
}
}


Hi,

 

I need to write test class for wrapper class coverage.

 

CLASS
----------
public without sharing class OppController {
    
    public OppController() {

    }
private class wrapOpp {
        public Integer index { get; set; }
        public Opportunity opp {get; set;}
        public String error {get; set; } 
        public List<SelectOption> allEquipments {
            get {
                List<SelectOption> Equipments = new List<SelectOption>();
                Equipments = OppUtil.allEquipmentOptions;
                return Equipments;
            }
        }
        
        public List<SelectOption> allNotifyDates {
            get {
                List<SelectOption> NotifyDates = new List<SelectOption>();
                if(opp.Property__c != null) {
                    NotifyDates = OppUtil.allNotifyDateOptions.get(opp.Equipment__c);
                }
                return NotifyDates;
            }
        }

    private wrapOpp(Integer ndx, Opportunity o, String err) {
            index = ndx;
            opp = o;
            error = err;           
        }
    }
  }
 

 

  TEST CLASS (wrapper line)
  -------------------------------------
 
 public class testOppclass{

 

 public static testmethod void TestOppMethod(){


  OppController.wrapperOpp Wrapvar = new OppController.wrapperOpp();

}

}

 

 

When I declare a variable I am getting error message as

" Type not visible ; OppController.wrapperOpp" on the line "OppController.wrapperOpp Wrapvar = new OppController.wrapperOpp();"

 

Please help me in identifying the issue.

 

Thanks,

JBabu.

  • May 08, 2012
  • Like
  • 0

I created a controller to pull both Open and Closed task for a custom object I built.  The controller code is:

 

public class SDTasks {

    public SDTasks (ApexPages.StandardController controller) {
    }

    public PageReference edit() {
        return null;
    }
private User user;    
private boolean isEdit = false;        
public User getUser() {        
    return user;}

List<Task> OpenTasks;
List<Task> ClosedTasks;

Public List<Task> getOpenTasks () {

    Return ([select subject, Status, Priority, ActivityDate, whatid, id 
            From Task
            Where whatid = :system.currentPageReference().getParameters().get('id')
            And IsClosed = False]);
}

Public List<Task> getClosedTasks () {

    Return ([select subject, Status, Priority, ActivityDate, whatid, id 
            From Task
            Where whatid = :system.currentPageReference().getParameters().get('id')
          And IsClosed = True
          Order by ActivityDate desc
          Limit 5]);              
}

Public String getName() {
    Return 'Get Open Task';
    }
    
  public string SdMemberId {get;set;}    
}

 Now I am trying to create the test class and receive this error:   Error: Compile Error: Constructor not defined: [SDTasks].<Constructor>() at line 8 column 13

 

My test class code is

public class testSDTasks {
static testMethod void myPage_Test()
{
//Test converage for the Page.ToDo_ControlPanel_V8 visualforce page
PageReference pageRef = Page.ToDo_ControlPanel_V8;
Test.setCurrentPageReference(pageRef);
// create an instance of the controller
SDTasks t = new SDTasks();

//try calling methods/properties of the controller in all possible scenarios
// to get the best coverage.
SD_Member__c tTask = t.getSD_Member__c();
//test when type == null
t.viewSD_Member__c();
}
}

 Since I am new to this, I am not sure how to proceed?  Any help would be appreciated.  

Hi,

 

Below is my trigger and Test Class

 

Red Colur line i am not covering in test class means if condition is not checking here

Trigger:
trigger Recruitervalidation on Recruiter__C (before Update) {  
    for (Recruiter__c a : Trigger.new) {
        system.debug('a.Status__c '+a.Status__c);
        system.debug('a.jobname__C '+a.jobname);
        
        if ((a.Status__c == 'waiting')&&(a.jobname__c==null)) {
                
            a.addError('Please fill the "Jobname" for the Job');
        }
       else if ((a.Status__c == 'Pending')&&(a.Jobdesc==null)) {
                
            a.addError(‘Some Error Message');
        }                                                         
    }
}

Test Class:

@istest

private class Recruitervalidation_test{

public static testmethod void Recruitervalidation_test()

{

Recruiter__c rc = new Recruiter_c();

rc.status__c='waiting';

rc.jobname__c='';

rc.joblocation__C='INDIA';

rc.jobtype__C='Technical';

insert rc;

rc.status__C='pending';

rc.jobdesc__C='';

rc.joblocation__C='INDIA';


update rc;

}}

 

Thanks

  • April 25, 2012
  • Like
  • 0

Hi,

 

I am new to write test class for trigger Please tell me how to write the test class for below trigger

 

trigger Recruitervalidation on Recruiter__C (before Update) {  
    for (Recruiter__c a : Trigger.new) {
        system.debug('a.Status__c '+a.Status__c);
        system.debug('a.jobname__C '+a.jobname);
        
        if ((a.Status__c == 'waiting')&&(a.jobname__c==null)) {
                
            a.addError('Please fill the "Jobname" for the Job');
        } 
       else if ((a.Status__c == 'Pending')&&(a.Jobdesc==null)) {
                
            a.addError(‘Some Error Message');
        }                                                         
    }
}

 

Thanks:))))

  • April 24, 2012
  • Like
  • 0

Very new to Apex code, created the following class but I am having a miserable time creating a correct test class for it. Would anyone be able to help me out so I can go back over it and figure it out? Important to note I have already read multiple articles on test classes, just unable to master it.  Thanks.

 

 

 

 

 1  public with sharing class DisplaySectionsController {
 2   public List<Patient_Drugs__c> ptdrugs {get;set;}
 3   public String messages_equi {get;set;}
 4   public void load() {
 5   ptdrugs= [Select Name,Patient__c,Prescriber__c,Patient__r.Notes_from_HC__c,Drug__r.Name,Prescriber__r.Name,Patient__r.Patient_Health_Center__r.Name,Patient__r.Name,Patient__r.Date_of_Birth__c,Patient__r.Center_EMR_Patient_ID_Pt_Act__c,Patient__r.Residence_Phone__c From Patient_Drugs__c WHERE Patient__c=:ApexPages.currentPage().getParameters().get('id') and Rx_Request_Send_To__c = 'Prescriber' AND Rx_Received_Date__c=null order by Prescriber__c];
 6   if(ptdrugs.Size()==0)
 7   {
 8   messages_equi='EQ';
 9  
 10  
 11   }
 12   }
 13   public List<SelectOption> getP() {
 14   Map<String,selectOption> third1 = new Map<String,selectOption>();
 15   List<SelectOption> options= new List<SelectOption>();
 16  
 17   for (Patient_Drugs__c pd : [SELECT Prescriber__c,Prescriber__r.Name FROM Patient_Drugs__c WHERE Patient__c=:ApexPages.currentPage().getParameters().get('id') and Prescriber__r.Name<>'' and Rx_Request_Send_To__c = 'Prescriber' AND Rx_Received_Date__c=null order by Prescriber__r.Name])
 18   {
 19  
 20   if(pd.Prescriber__r.Name!= null)
 21   {
 22  
 23   third1.put('',new selectOption('', '-- None --'));
 24   third1.put(pd.Prescriber__r.Name,new selectOption(pd.Prescriber__c,pd.Prescriber__r.Name));
 25  
 26   }
 27  
 28   }
 29  
 30   options= third1.values();
 31   return options;
 32   }
 33  
 34  
 35  }

I m getting following error

 

"Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required"

Here is my trigger

 

trigger FlightRequestTrigger on Flight_Request__c (after insert) {

    List<Opportunity> listOpp = new List<Opportunity>();
    boolean flag = true;
    for (Flight_Request__c fr: trigger.new)
    {
        Opportunity oppNew = [SELECT Id,StageName FROM Opportunity WHERE Id =:fr.Opportunity__c];
        if(oppNew.StageName == 'To Be Searched')
        {
            oppNew.StageName = 'Search';
            listOpp.add(oppNew);
        }
    }
    if (listOpp != null && !listOpp .isEmpty())
    {
       Database.update(listOpp);
    }
}

 

 

And this is the test case

 

@isTest
public  class FlighRequestTestCase {
   private  static testMethod void myUnitTest() {
        Opportunity oppNew =  new Opportunity();
        oppNew.Name = 'Test Opp';
        oppNew.StageName = 'To Be Searched';
        oppNew.CloseDate = System.now().date();
        insert oppNew;
        
        Flight_Request__c fr = new Flight_Request__c();
        fr.From__c ='Ani';
        fr.To__c ='Ani';
        fr.Opportunity__c = oppNew.Id;
        insert fr;
          
           List<Opportunity> listOpp = new List<Opportunity>();
        oppNew =  [SELECT Id,StageName FROM Opportunity WHERE Id =:fr.Opportunity__c];
           if(oppNew.StageName == 'To Be Searched')
        {
            oppNew.StageName = 'Search';
            listOpp.add(oppNew);
        }
        
        if (listOpp != null && !listOpp .isEmpty())
           {
              Database.update(listOpp);
           }
    }
}

 

Please help me, what i m doing wrong here?

 

how to create boolean field to the object !

 

Need to add a field to contact, If it's Validated that defaults to true

I wrote a test method to cover code for the class shown below.

But its not covering the wrapper class .

please direct me to test wrapper class.

 

public with sharing class sno_in_table
{

public list<wrap> getRecords()

{
integer sno=1;
list<wrap>emps=new list<wrap>();
list<employee__c>emp_records=[select name,phone__c from employee__c];

for(employee__c em:emp_records)
{

emps.add(new wrap(sno,em));
sno++;

}
return emps;
}

 

//wrapper class

 

public class wrap
{
public integer sno{get;set;}
public employee__c emp{get;set;}

public wrap(integer sn, employee__c e)
{
emp=e;
sno=sn;
}

}

public static testmethod void m1()
{
sno_in_table sno=new sno_in_table();
sno.getrecords();
}
}

Hi All,

I have created Visualforce page and controller to upload a file to Box.com, but due to limit of file size is 10MB so, I want to write the Rest API in Javascript and through <input file tag I need to upload 50MB file i.e. all the code should be in Javascript.

Can anyone please send me the sample code.

Thanks In Advance
Rajesh
We have created a Connected App to connect Salesforce by external source and If we keep the Session Times Out After to 24 hours Max for patiuclar user and if they didn't hit the Salesforce API within 24 hours then Session will expire and again they need to generate new access token to login.
We need to have the automated process for a long time without Session expire. Please implement the this fucntionality.

Thanks In Advance.
Hi All,

can we send email from Apex class with From address as no-reply @saleforce.com without setting Organization-Wide Addresses?

If we set Organization-Wide Addresses as no-reply @saleforce.com mail means Salesforce will sends a verification link to that email id, so that cannot be verified from us.
Can anyone advice on this.

Thanks,
Rajesh
Hi Salesforcians,

can we send email from Apex class with From address as no-reply @saleforce.com without setting Organization-Wide Addresses?

If we set Organization-Wide Addresses as no-reply @saleforce.com mail means Salesforce will sends a verification link to that email id, so that cannot be verified from us.
Can anyone advice on this.

Thanks In Advance
Rajesh
Hi All,

I have array of string : one,two,three,four,"five1,five2", six ,seven,"eight1,eight2","nine",,eleven

I need output as :
one
two
three
four
five1,five2
six
seven
eight1,eight2
nine

eleven

Thanks in advance
User-added image
In Change Management --> Deploying from Sandbox with Change Sets

They have given the question as mentioned above.

But in option the answer they have given the above 4 steps and I tried with all option, finally it passed and answer is first step i.e 'Autohrize the deployment connection'

But it's wrong please check once.

Thanks,
Rajesh
Hi All,

I have start date time field in sales cloud and when ever user creates a record with the start time date field value means a reminder email need to send 2 hrs or 2days before of that start time date field value.

for eg: if start time date field is 12/12/2016 means a reminder mail needs to send on 10/12/2016.

Thanks In Advance.

Rajesh.
HI,

How to refresh or reload the embedded vf page not whole detail page.

Thanks in advance.
HI,

How to refresh or reload the embedded vf page not whole detail page.

Thanks in advance.

 
HI Guys,
While scanning in ZAP scanner I got below issue.
Remote OS Command Injection in visualforce  page.
Please help on this.
Thanks In Advance.
HI Guys,

While scanning in ZAP scanner I got below issue:
Remote OS Command Injection in visualforce  page
Please help on this :)

Thanks In Advance

Hi EveryOne,

 

When I try to export data from workbench when Iquery means it showing all records but when I try to download means it's showing error like this.

 

InvalidJob: Unable to find object: attachments.

 

query is SELECT id,(SELECT id FROM attachments) FROM Account where owner.isactive = false and owner.email like '%@gmail.com'.

 

Could any one please help on this.

And if any one knows how to export records displayed in developer console.

 

 

Thanks in Advance.

 

Thanks,

 

Rajesh.

HI,

 

what is trigger handler pattern  in salesforce  and could u give some examples on it.

 

Regards,

Rajesh.

Hi,

 

I need to hide some picklist values for paticulat profile.But there is no recordtype in opportunity product.

 

please give any advice on it.

 

Thanks,

Rajesh.

Hi,

 

I have developer editiion and when i login to http://boards.developerforce.com.

 

it showing the error like this: You are not allowed to access this site.

 

Please let me know if any setting need to be change.

 

Thanks,

Rajesh.

 

 

Hi,

 

I have Rank field as picklist and having picklist values as:

 

A1-poor
A2- Below Low
A3-Low
A4-Average
A5-Above Average
A6-below high
A7-High

 

 

and having date fields like

 

date_A1

date_A2

date_A3

date_A4

date_A5

date_A6

date_A7

 

 

I need to check if old value is lower and updated  value is higher means, then  between the other values needs to update today date as higher value date.

 

for eg:   Rank has changed from "A2- Below Low" to "A6-below high" then "date_A6"high is updated by today date and also between

 

them 3 fields also need update by today date i.e "date_A3,date_A4,date_A5".

 

It may change the rank from any way. There are 20 picklist values are there.So we can't check every value.

 


Can any one know how to do this requirement.

 

 

Thanks in Advance.

Rajesh.

 

 

 

 

 

 

 

 

 

 

Hi

 

Already I have one visual force page I need to create another visual page in that VF page is it possible? if yes means give me some examples.

 

 

Regards,

Rajesh

HI ,

 

Can we insert  the records of any object when page is loaded? Please reply me.

 

 

Regards,

Rajesh.

Hi

 

for Account, I need to hide one view.I didn't add my public group to share in that view but it showing the name, when we click  "GO" none of the records showing,  I need to hide that view name

any one help on this plz.


 

Regards,

SRS8.

Hi

 

for Account, I need to hide one view.I didn't add my public group to share in that view but it showing the name, when we click  "GO" none of the records showing,  I need to hide that view name

any one help on this plz.

 

 

Regards,

SRS8.

Hi All,

can we send email from Apex class with From address as no-reply @saleforce.com without setting Organization-Wide Addresses?

If we set Organization-Wide Addresses as no-reply @saleforce.com mail means Salesforce will sends a verification link to that email id, so that cannot be verified from us.
Can anyone advice on this.

Thanks,
Rajesh
Hi All,

I have array of string : one,two,three,four,"five1,five2", six ,seven,"eight1,eight2","nine",,eleven

I need output as :
one
two
three
four
five1,five2
six
seven
eight1,eight2
nine

eleven

Thanks in advance
We have a custom object Price Reuqest and have complex approval processes defined for it. We want to capture the Actual Approver for each step of the approval process. I checked forums about using ProcessInstanceHistory and ProcessInstanceWorkItem but i do not understand where to start from. Any help or code or steps on how to accomplish this will be helpful.
HI,

How to refresh or reload the embedded vf page not whole detail page.

Thanks in advance.
HI,

How to refresh or reload the embedded vf page not whole detail page.

Thanks in advance.

 
this is the trigger code:
trigger updateSeatTaken on Reservation__c (before insert, before update, after insert, after update) {
    List<Id> seatIdsForUpdate = new List<Id>();
    for (Reservation__c r : trigger.new) {
        seatIdsForUpdate.add(r.Seat__c);
    }
    List<Seat__c> seatsForUpdate = [SELECT taken__c FROM Seat__c WHERE Id IN: seatIdsForUpdate];

    for (Seat__c seat: seatsForUpdate) {
        seat.Taken__c = true;
    }
    update seatsForUpdate;
}


it works perfectly when the lookup field Seat__c has no filter.
but i need to have filter criterias for this lookup field.
these are the filter criterias:
Seat:Schedule__c     equals       Field        Reservation:Schedule__c  AND
Taken__c                     equals      Value       False

anyone knows what is the problem here?
  • January 10, 2014
  • Like
  • 0
Hi,

I have two text field A & B and one checkbox. I want when i click the check box address from A will get copy to B before saving.
Could you please suggest what should i do. Weather a trigger, Workflow or formula field.

Regards

Hi,

I need to write test class for inner class coverage. 

Class:

public class PerformanceReport
{
public String strFromDate {get; set;}
public String strToDate {get; set;}
public List<PerformanceReportClass> LstPerformanceReportClass {get;set;}
public Class PerformanceReportClass
{
public String strMRName{get;set;}
public String strMonth1{get;set;}
public String strMonth2{get;set;}
public String strMonth3{get;set;}
public String strMonth4{get;set;}
public String strMonth5{get;set;}
public String strMonth6{get;set;}
public String strMonth7{get;set;}
public String strMonth8{get;set;}
public String strMonth9{get;set;}
public String strMonth10{get;set;}
public String strMonth11{get;set;}
public String strMonth12{get;set;}
public List<ReqmtDetailsClass> lstReqmtDetailsClass1{get; set;}
public List<ReqmtDetailsClass> lstReqmtDetailsClass2{get; set;}
public List<ReqmtDetailsClass> lstReqmtDetailsClass3{get; set;}
public List<ReqmtDetailsClass> lstReqmtDetailsClass4{get; set;}
public List<ReqmtDetailsClass> lstReqmtDetailsClass5{get; set;}
public List<ReqmtDetailsClass> lstReqmtDetailsClass6{get; set;}
public List<ReqmtDetailsClass> lstReqmtDetailsClass7{get; set;}
public List<ReqmtDetailsClass> lstReqmtDetailsClass8{get; set;}
public List<ReqmtDetailsClass> lstReqmtDetailsClass9{get; set;}
public List<ReqmtDetailsClass> lstReqmtDetailsClass10{get; set;}
public List<ReqmtDetailsClass> lstReqmtDetailsClass11{get; set;}
public List<ReqmtDetailsClass> lstReqmtDetailsClass12{get; set;}
}
public class ReqmtDetailsClass
{
public string ReqmtName {get; set;}
public string ReqmtStatus {get; set;}
public string ReqmtPostdDate {get; set;}
public string ResumeReqstd {get; set;}
public string ResumeSubmtd {get; set;}
public string ResumeFirstPosted {get; set;}
public string ElapsedTimeFirstResumePosted {get; set;}
public string ReqmtClosedDate {get; set;}
public string ReqmtClosedHrs {get; set;}
public List<CandtDetailsClass> lstCandtdetailClass {get; set;}
public List<CandtDetailsClass> lstCandtdetailClass2 {get; set;}
public List<CandtDetailsClass> lstCandtdetailClass3 {get; set;}
public List<CandtDetailsClass> lstCandtdetailClass4 {get; set;}
public List<CandtDetailsClass> lstCandtdetailClass5 {get; set;}
public List<CandtDetailsClass> lstCandtdetailClass6 {get; set;}
public List<CandtDetailsClass> lstCandtdetailClass7 {get; set;}
public List<CandtDetailsClass> lstCandtdetailClass8 {get; set;}
public List<CandtDetailsClass> lstCandtdetailClass9 {get; set;}
public List<CandtDetailsClass> lstCandtdetailClass10 {get; set;}
public List<CandtDetailsClass> lstCandtdetailClass11 {get; set;}
public List<CandtDetailsClass> lstCandtdetailClass12 {get; set;}
}

public class CandtDetailsClass
{
public string CandtName{get; set;}
public string CandtEmail{get; set;}
}
public PageReference GetReportDetails()
{
List<User> lstAllUser = new List<User>([SELECT id, name, LastModifiedDate, isActive from user where userroleid in (select id from userrole where name='Management Representative')]);
List<User> lstUser = new List<User>();
List<RequirementAssignment__c> lstReqmtAssign = new List<RequirementAssignment__c>();
List<RequirementAssignment__c> FilterReqmtAssign ;
List<RequirementAssignment__c> FilterReqmtAssignMonthly ;
List<Requirement__c> lstReqmts = new List<Requirement__c>();
if(strFromDate != null && strToDate != null)
{
DateTime startDT = DateTime.parse(strFromDate);
system.debug('Date:' + startDT);
DateTime endDT = DateTime.parse(strToDate);
system.debug('Date:' + endDT);
Date NewStartDate;
Integer startMonth = startDT.monthgmt();
Integer endMonth = endDT.monthgmt();
Integer startYear = startDT.yeargmt();
Integer endYear = endDT.yeargmt();
for(User allUser : lstAllUser)
{
if(allUser.IsActive == true)
{
lstUser.add(allUser);
}
else
{
if(allUser.LastModifiedDate > startDT)
{
lstUser.add(allUser);
}
}
}
lstReqmtAssign = [select Status__c, Requirement__c, Lead_Recruiter__c, Recruiter__c, createddate, createdbyid from RequirementAssignment__c where createddate >: startDT and createddate <: endDT ];

LstPerformanceReportClass = new List<PerformanceReportClass>();
for(User MRUSer : lstUser)
{
FilterReqmtAssign = new List<RequirementAssignment__c>();
for(RequirementAssignment__c ReqmAssign : lstReqmtAssign)
{
if(MRUSer.id == ReqmAssign.createdbyid)
{
FilterReqmtAssign.Add(ReqmAssign);
}
}
PerformanceReportClass objPerformanceReportClass = new PerformanceReportClass();
objPerformanceReportClass.strMonth1 = objPerformanceReportClass.strMonth2 = objPerformanceReportClass.strMonth3 = objPerformanceReportClass.strMonth4 = objPerformanceReportClass.strMonth5 = objPerformanceReportClass.strMonth6 = objPerformanceReportClass.strMonth7 = objPerformanceReportClass.strMonth8 = objPerformanceReportClass.strMonth9 = objPerformanceReportClass.strMonth10 = objPerformanceReportClass.strMonth11 = objPerformanceReportClass.strMonth12 = string.valueOf(0);
Integer count = 0;
NewStartDate = startDT.date();
Integer incrMonth = NewStartDate.month();
objPerformanceReportClass.strMRName = MRUSer.name;
if(FilterReqmtAssign != null)
{
for(integer i=startMonth; i<=endMonth; i++)
{
FilterReqmtAssignMonthly = new List<RequirementAssignment__c>();
for(RequirementAssignment__c ReqmAssignUser : FilterReqmtAssign)
{
DateTime ReqmtAssignDt = ReqmAssignUser.createddate;
Date ReqmAssignDate = Date.NewInstance(ReqmtAssignDt.yeargmt(), ReqmtAssignDt.monthgmt(), ReqmtAssignDt.daygmt());
System.Debug('Reqmt Assign Date:' +ReqmAssignDate);
System.Debug('Original Date:' + NewStartDate.month());
if((ReqmAssignDate.month() == incrMonth) && (ReqmAssignDate.year() == NewStartDate.year()))
{
FilterReqmtAssignMonthly.Add(ReqmAssignUser);
}
}
incrMonth++;
System.Debug('List Size:' +FilterReqmtAssignMonthly.size());
if(i==1)
{
objPerformanceReportClass.strMonth1 = string.valueOf(FilterReqmtAssignMonthly.size());
System.Debug('objReqmtAssignClass.strDate1:' +objPerformanceReportClass.strMonth1);
objPerformanceReportClass.lstReqmtDetailsClass1 = new List<ReqmtDetailsClass>();
Set<ID> setReqId = new Set<ID>();
for(RequirementAssignment__c Reqmt : FilterReqmtAssignMonthly)
{
System.Debug('Filter List Monthly'+FilterReqmtAssignMonthly);
System.Debug('Monthly Reqmt' +Reqmt);
setReqId.add(Reqmt.Requirement__c);
}
System.Debug('Id Set:' +setReqId);
if(setReqId.size()>0)
{
for(ID ReqID : setReqId)
{
System.Debug('Reqmt Id:' + ReqID);
List<Requirement__c> lstReqmtsResume= [Select id, Name, Status__c, createddate, No_Of_Resumes__c, Resumes_Submitted__c, Assign_Candidate_date__c, First_Response__c, Req_Closed_Date__c, Req_Closed_hrs__c from Requirement__c where id =:ReqID];
System.Debug('list Reqmts Resume:' +lstReqmtsResume);
List<Candidate_Mapping__c> lstCandtMapping = [select Candidate__r.Candidate_Full_Name__c , Candidate__r.Email__c from Candidate_Mapping__c where Requirement__c =:ReqID];
System.Debug('Candidates List:' +lstCandtMapping);
if(lstReqmtsResume.size()>0)
{
for(Requirement__c req:lstReqmtsResume)
{
ReqmtDetailsClass objReqmtDetailsClass1 = new ReqmtDetailsClass();
objReqmtDetailsClass1.lstCandtdetailClass = new List<CandtDetailsClass>();
System.Debug('Reqmt Resume:' +req);
objReqmtDetailsClass1.ReqmtName = string.valueOf(req.Name);
objReqmtDetailsClass1.ReqmtStatus = string.valueOf(req.Status__c);
objReqmtDetailsClass1.ReqmtPostdDate = string.valueOf(req.createddate);
objReqmtDetailsClass1.ResumeReqstd = string.valueOf(req.No_Of_Resumes__c);
objReqmtDetailsClass1.ResumeSubmtd = string.valueOf(req.Resumes_Submitted__c);
objReqmtDetailsClass1.ResumeFirstPosted = string.valueOf(req.Assign_Candidate_date__c);
objReqmtDetailsClass1.ElapsedTimeFirstResumePosted = string.valueOf(req.First_Response__c);
objReqmtDetailsClass1.ReqmtClosedDate = string.valueOf(req.Req_Closed_Date__c);
objReqmtDetailsClass1.ReqmtClosedHrs = string.valueOf(req.Req_Closed_hrs__c);
System.Debug('objReqmtDetailsClass1:'+objReqmtDetailsClass1);
objPerformanceReportClass.lstReqmtDetailsClass1.add(objReqmtDetailsClass1);
for(Candidate_Mapping__c candt :lstCandtMapping)
{
CandtDetailsClass objCandtDetailsClass1 = new CandtDetailsClass();
objCandtDetailsClass1.CandtName = string.valueOf(candt.Candidate__r.Candidate_Full_Name__c);
objCandtDetailsClass1.CandtEmail = string.valueOf(candt.Candidate__r.Email__c);
objReqmtDetailsClass1.lstCandtdetailClass.add(objCandtDetailsClass1);
}
}
}
}
}

}
else if(i==2)
{
objPerformanceReportClass.strMonth2 = string.valueOf(FilterReqmtAssignMonthly.size());
System.Debug('objReqmtAssignClass.strDate2:' +objPerformanceReportClass.strMonth2);
objPerformanceReportClass.lstReqmtDetailsClass2 = new List<ReqmtDetailsClass>();
Set<ID> setReqId = new Set<ID>();
for(RequirementAssignment__c Reqmt : FilterReqmtAssignMonthly)
{
System.Debug('Filter List Monthly'+FilterReqmtAssignMonthly);
System.Debug('Monthly Reqmt' +Reqmt);
setReqId.add(Reqmt.Requirement__c);
}
System.Debug('Id Set:' +setReqId);
if(setReqId.size()>0)
{
for(ID ReqID : setReqId)
{
System.Debug('Reqmt Id:' + ReqID);
List<Requirement__c> lstReqmtsResume= [Select id, Name, Status__c, createddate, No_Of_Resumes__c, Resumes_Submitted__c, Assign_Candidate_date__c, First_Response__c, Req_Closed_Date__c, Req_Closed_hrs__c from Requirement__c where id =:ReqID];
System.Debug('list Reqmts Resume:' +lstReqmtsResume);
if(lstReqmtsResume.size()>0)
{
for(Requirement__c req:lstReqmtsResume)
{
ReqmtDetailsClass objReqmtDetailsClass2 = new ReqmtDetailsClass();
System.Debug('Reqmt Resume:' +req);
objReqmtDetailsClass2.ReqmtName = string.valueOf(req.Name);
objReqmtDetailsClass2.ReqmtStatus = string.valueOf(req.Status__c);
objReqmtDetailsClass2.ReqmtPostdDate = string.valueOf(req.createddate);
objReqmtDetailsClass2.ResumeReqstd = string.valueOf(req.No_Of_Resumes__c);
objReqmtDetailsClass2.ResumeSubmtd = string.valueOf(req.Resumes_Submitted__c);
objReqmtDetailsClass2.ResumeFirstPosted = string.valueOf(req.Assign_Candidate_date__c);
objReqmtDetailsClass2.ElapsedTimeFirstResumePosted = string.valueOf(req.First_Response__c);
objReqmtDetailsClass2.ReqmtClosedDate = string.valueOf(req.Req_Closed_Date__c);
objReqmtDetailsClass2.ReqmtClosedHrs = string.valueOf(req.Req_Closed_hrs__c);
System.Debug('objReqmtDetailsClass2:'+objReqmtDetailsClass2);
objPerformanceReportClass.lstReqmtDetailsClass2.add(objReqmtDetailsClass2);
}}}}}}
LstPerformanceReportClass.add(objPerformanceReportClass);
}}}
return null;
}}

Test Class:

@isTest
private class testclassperformancereport
{
static testmethod void myTestclass()
{
Candidate_Mapping__c cm = new Candidate_Mapping__c();

Candidate__c cc1=new Candidate__c();
cc1.Name='test';
cc1.Last_name__c='testonek';
cc1.Current_city__c='chennai';
cc1.Current_state__c='Maine';
cc1.Gender__c='Male';
cc1.Employer_Name__c='ttt';
cc1.Email__c='test@gmail.com';
cc1.interview_contact_phone__c='Mobile Phone';
cc1.Contract_type__c='Corp to Corp';
cc1.visa_type__c='H1 B';
cc1.cost__c =100;
cc1.mobile_phone_no__c='9890043500';
cc1.employer_contact_email__c='test@gmail.com';
cc1.Employer_Contact_Name_Name__c='tt';
cc1.Employer_Mobile_No__c='9988009876';
cc1.Employer_Name__c = 'jos';
cc1.Employer_Work_Phone_No__c = '(425) 264-6771';
cc1.Followup_Date__c =date.today();

System.test.startTest();
insert cc1;

cm.Candidate__c=cc1.id;
system.debug('candid:'+cc1.id);

Requirement__c rc1=new Requirement__c();

rc1.Name='SampathReq';
rc1.Job_Title__c='.net';
rc1.Duration__c='6';
rc1.No_Of_Resumes__c=2;
rc1.Min_Cost__c=100;
rc1.Max_Cost__c=200;
rc1.Rate__c=200;
rc1.Rate_Basis__c='Hourly';
rc1.Status__c='open';
rc1.Position_Type__c='Contract';
rc1.State__c='CA';
rc1.City__c='CA';
rc1.Est_Start_Date__c=date.today();
insert rc1;
User lruser = [select u.id from user u where (u.Profile.Name ='Lead Recruiter' or u.Profile.Name ='LR Chatter Only User') and u.ManagerId!=null and u.IsActive= True limit 1] ;
User ruser = [select u.id from user u where (u.Profile.Name ='Recruiter' or u.Profile.Name ='R Chatter Only User') and u.ManagerId!=null and u.IsActive= True limit 1] ;

RequirementAssignment__c reqas = new RequirementAssignment__c();

reqas.Requirement__c = rc1.id;
reqas.AssignStatus__c= 'true';
reqas.Won__c= 'no';
reqas.Lead_Recruiter__c = lruser.id;
//reqas.Recruiter__c = ruser.id;
insert reqas;

cm.Requirement__c=rc1.id;
system.debug('candid:'+cc1.id);

cm.Employer_s_Authorization__c = 'test';
cm.status1__c = 'Applied';
cm.LR_Comments__c = 'test by lr';
cm.MR_Comments__c = 'test by MR';
cm.Requirement_Owner_Email__c = 'testOwner@preludesys.com';
cm.Manager_Email_ID__c = 'testOwner1@preludesys.com';
cm.LR_Status__c = 'Approved';
cm.MR_Status__c = 'Approved';
cm.LR_Status_Date__c = string.valueOf(date.today());
cm.Submitted_to_Client__c = 'Yes';
cm.Interview_Scheduled__c = 'Yes';
cm.Interview_Accepted__c = 'Yes';
cm.Client_Interviewed__c = 'Yes';
cm.Client_Offered__c = 'Yes';
cm.Comments__c = '';
cm.MR_Status1__c = 'Approved' ;

User user = [Select Id from User limit 1] ;

EmailTemplate et = [Select Id, Subject, HtmlValue, Body from EmailTemplate where Name = 'Candidate Approval Email with link EZRE'];
List<ContentVersion> contentList = new List<ContentVersion>();

ContentWorkspace library = [SELECT id FROM ContentWorkspace LIMIT 1];
System.Debug('library.id:'+ library.id);

ContentVersion contentVersionObj = new ContentVersion();

contentVersionObj.title = 'Google';//contentVersionObj.Enablement_Area__c = 'Acct Mgmt';
contentVersionObj.FirstPublishLocationId = library.id;
contentVersionObj.Candidate_Id__c = cc1.Id;
contentVersionObj.VersionData = Blob.valueOf('Ayangar') ;
contentVersionObj.PathOnclient = 'http://www.google.com';
contentVersionObj.Title ='Management Approach';

insert contentVersionObj;
System.Debug('ContentVersionObj:'+ contentVersionObj);

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
efa.setFileName('Sasikumar.Word');
efa.setBody(Blob.ValueOf(et.Body));
System.Debug('efa:' +efa);
String[] toAddresses = new string[]{'dummy@yahoo.com'};
mail.setTargetObjectId(user.Id);
mail.setToAddresses(toAddresses);

mail.setTemplateId(et.Id);

mail.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
mail.saveAsActivity = false;
// Sends the email
Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});

insert cm;

datetime nowdate = datetime.now();

string strfromdate = nowdate.format('MM/dd/yyyy hh:mm a');

datetime newdate= nowdate.addMonths(2);

string strtodate = newdate.format('MM/dd/yyyy hh:mm a');

List<RequirementAssignment__c> lstReqmtAssign = new List<RequirementAssignment__c>();

PerformanceReport pr = new PerformanceReport();

list<PerformanceReportClass> c = new List<PerformanceReportClass>();

datetime startdate = datetime.parse(strfromdate);
system.debug('startdate :' + startdate);

datetime enddate = datetime.parse(strtodate);
system.debug('enddate :' + enddate);

lstReqmtAssign = [select Status__c, Requirement__c, Lead_Recruiter__c, Recruiter__c, createddate, createdbyid from RequirementAssignment__c where createddate >= 2013-09-01T00:00:00.000+0000 and createddate <=2013-09-25T00:00:00.000+0000 ];

System.debug('lstReqmtAssign: ' + lstReqmtAssign);


List<Requirement__c> lstReqmtsResume= [Select id, Name, Status__c, createddate, No_Of_Resumes__c, Resumes_Submitted__c, Assign_Candidate_date__c, First_Response__c, Req_Closed_Date__c, Req_Closed_hrs__c from Requirement__c where id =:rc1.id];
System.Debug('list Reqmts Resume:' +lstReqmtsResume);

List<Candidate_Mapping__c> lstCandtMapping = [select Candidate__r.Candidate_Full_Name__c , Candidate__r.Email__c from Candidate_Mapping__c where Requirement__c =:rc1.id];
System.Debug('Candidates List:' +lstCandtMapping);

pr.GetReportDetails();

}
}

 

What ever i modify in the test class, the code coverage is 3% only, Kindly help meto fix this.

 

Regards,

Abinaya.

Hi,

I have a requirement where in I have table with 6 fields. The first 5 fields are picklist and sixth one is Number field.

Now ,the user can select any values from each of the picklists and based on the selection of values from the picklist , I will need to perform some numeric calculation and display the numerica value in the 6th field on the fly.

 

Currently my sixth field is a formula field , but the issue is , that formula field calculates and displays only after clicking on the save; Whereas my requirement is that the user can see the change in the value of the 6th field on the fly as and when the user selects or changes the value in any of the first 5 fields.

 

Please help!

 

 

I'm new on salesforce.

I'm trying to create dependent fields according to picklist value selection.

In the following code I want:

1: when I select "None" in picklist no field should display.

2: if I select 1st option in the picklist; only field1 should get display.

3: if I select 2nd option in the picklist; only field2 should get display.

3: and if I select 3rd option in the picklist; all the fields1,2&3 should get display.

 

Please Help me out of this task.. Thanks!

 

/////////////////////Visualforce///////////////////////

<apex:page controller="FieldSelection">
      <apex:pageBlock title="fields">
          <apex:form >
                <b>State:</b> <t/><t/>
                <apex:selectList id="sta" value="{!SelectedState}" size="1">
                    <apex:selectOptions value="{!StateList}" />
                </apex:selectList>
                <br/><br/>
                <b>Field1:</b><t/><t/>
                <apex:inputText required="true" id="city1" value="{!city1}" />
                <br/><br/>
                <b>Field2:</b><t/><t/>
                <apex:inputText required="true" id="city2" value="{!city2}" />
                <br/><br/>
                <b>Field3:</b><t/><t/>
                <apex:inputText required="true" id="city3" value="{!city3}" />
                
          </apex:form>
      </apex:pageBlock>
</apex:page>

 

 

 

/////////////////////////Controller/////////////////////////////////

public with sharing class FieldSelection {

    public String city3 { get; set; }

    public String city2 { get; set; }

    public String city1 { get; set; }

    public String SelectedState { get; set; }
    
    public list<SelectOption> StateList{
    get{
            list<SelectOption> st= new list<SelectOption>();
            st.add(new SelectOption('','- None -'));
            List<UV_Account__c> lFINAL = New List<UV_Account__c>();
            list<UV_Account__c> cc=[select State__c from UV_Account__c];
            Set<String> sNames = New Set<String>();
            for (UV_Account__c c : cc){
            if (sNames.Contains(c.State__c) == FALSE){
               sNames.add(c.State__c);
               lFINAL.add(c);
        }
        }
            
            for( UV_Account__c fc : lFINAL)
            {
                st.add(new SelectOption(fc.id,fc.State__c));
            }
            return st;
       }
     set; }

}

Hi,

 

I want to display list like below.

 

 

------------------------------------------------------------------

 - | Parent 1

------------------------------------------------------------------

    | X | child 1

------------------------------------------------------------------

    | X | child 2

------------------------------------------------------------------

    | X | child 3

------------------------------------------------------------------

 + | Parent 2

------------------------------------------------------------------

 + | Parent 3

------------------------------------------------------------------

 

There is "+" before parent records, if we click on "+", it should be expand its childs.

If it is possible that child records can be display using pageblock table then it is very good.

 

Anyone have idea how to develop this in vf page?

Hi EveryOne,

 

When I try to export data from workbench when Iquery means it showing all records but when I try to download means it's showing error like this.

 

InvalidJob: Unable to find object: attachments.

 

query is SELECT id,(SELECT id FROM attachments) FROM Account where owner.isactive = false and owner.email like '%@gmail.com'.

 

Could any one please help on this.

And if any one knows how to export records displayed in developer console.

 

 

Thanks in Advance.

 

Thanks,

 

Rajesh.

We have a custom button that executes JavaScript on our case record:

{!REQUIRESCRIPT("/soap/ajax/14.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/14.0/apex.js")}
this.disabled=true;
try{
var accId='{!Account.Id}';
var objectId = '{!Case.Id}';

var result = sforce.apex.execute("ForceJiraComm", "createIssue",
{case_id : objectId});
alert(result);
location = location;
}
catch(err) {
txt="There was an error on this page.\n\n";
txt+="Error description: " + err + "\n\n";
txt+="Click OK to continue.\n\n";
alert(txt);
}
this.removeAttribute('disabled');

We want it to also write the full name of the user that clicked the button to the custom field JIRA_Escalated_By__c on the case object.  How do we do this?

Basically, how can update our APEX to store who clicks a custom button?”

trigger users on User (before insert, before update) {

    if(Test.isrunningtest()) {
        system.debug('Allowing user create/edit.');
    } else {
        List<User> oUser = [SELECT Id, Security_user__c, ProfileId, UserName FROM User WHERE Id = :System.UserInfo.getUserId() LIMIT 1];
        If(oUser[0].UserName.endsWith('.dev10')){
          
            system.debug('IS DEV USER: Allowing user create/edit.');
        } else {
            Boolean isSecurityUser = oUser[0].Security_user__c;
            if(isSecurityUser) {
              
             
            } else {
                if(Trigger.isUpdate) {
                    List<Profile> list_pAdmin = [SELECT Id FROM Profile WHERE Name IN ('System Administrator','SL: System Administrator','SL: Sys Admin ','SL: Read Only Admin','SL: Read Only Admin Non ') LIMIT 5];
                    Set<String> set_pAdmin = new Set<String>();
                    for(Profile pAdmin : list_pAdmin) {
                        set_pAdmin.add(pAdmin.Id);
                    }
                    for(User oUserRec : Trigger.New) {
                        if((oUserRec.Id == System.UserInfo.getUserId()) && (!set_pAdmin.contains(oUser[0].ProfileId))) {
                            system.debug('IS THE USERS OWN RECORD AND THEY ARE NOT A SYS ADMIN: Allowing user create/edit.');
                        } else {
                            system.debug('IS NOT A TEST, DEV ENVIRONMENT, A SECURITY USER OR THE USERS OWN RECORD: Forbidding user create/edit.');
                            oUserRec .addError('You do not have permission to create or edit user records!');
                        }
                    }
                } else {
                    for(User oUserRec : Trigger.New) {
                        system.debug('IS NOT A TEST, DEV ENVIRONMENT, A SECURITY USER OR THE USERS OWN RECORD: Forbidding user create/edit.');
                        oUserRec .addError('You do not have permission to create or edit user records!');
                    }
                }
            }
        }
    }

}

Hi..

     can we create an simple calculater application in the apex page.if it s possible in saelsforce..

        help me..

  • January 24, 2012
  • Like
  • 0

Hello All,

 

I have an inline visulaforce page in my Case Pagelayout. I want to refresh it on a particular click event. How can we make it possible. Please help me regarding this issue.

 

 

Thank you!

 

Regards,

Lakshman

Today we’re excited to announce the new Salesforce Developers Discussion Forums. We’ve listened to your feedback on how we can improve the forums.  With Chatter Answers, built on the Salesforce1 Platform, we were able to implement an entirely new experience, integrated with the rest of the Salesforce Developers site.  By the way, it’s also mobile-friendly.

We’ve migrated all the existing data, including user accounts. You can use the same Salesforce account you’ve always used to login right away.  You’ll also have a great new user profile page that will highlight your community activity.  Kudos have been replaced by “liking” a post instead and you’ll now be able to filter solved vs unsolved posts.

This is, of course, only the beginning  and because it’s built on the Salesforce1 Platform, we’re going to be able to bring you more features faster than ever before.  Be sure to share any feedback, ideas, or questions you have on this forum post.

Hats off to our development team who has been working tirelessly over the past few months to bring this new experience to our community. And thanks to each of you for helping to build one of the most vibrant and collaborative developer communities ever.
 

Hi

 

            I was facing a telephonic round of an interview and the interviewer had asked me this question.. I tried to ask people working for over 2 years on salesforce and a team Lead as well but couldn't find the answer.. So here I am.. where I've always got the help, when looked for.. So here Is the Question

 

Int: can we  use use Multiple extensions?

Me: Yes, we can.

Int: we have three extensions ext1, ext2, ext3.. and all of them have the method Method1.. and I call this method  in a VFPage whose method will be called..

Me: The one which is on he left most side.

Int: I want to call the Method of Ext2/Ext3.. How will I do so?

Me: Numb!! Job Gone!! Me yet Jobless..  :(