• Developers
  • NEWBIE
  • 25 Points
  • Member since 2011

  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 27
    Questions
  • 29
    Replies

Hi,

 

I am facing an issue like "too many sqol queries : 101" when i run a test class.

 

I will post my code here:

 

 

trigger updateassreqwon on Requirement__c (after update) 


if(Trigger.isUpdate) 

string reqId = Trigger.old[0].Id;

Requirement__c listR = [Select Id, Name, job_title__c, won__c from Requirement__c where Id =:reqId limit 1]; 

// List<RequirementAssignment__c> listreq = [Select Id, Name, won__c, Lead_Recruiter__c, Recruiter__c,Requirement__c from RequirementAssignment__c where requirement__c=:reqId limit 1];

// System.Debug('listreq :' +listreq); 

for(Requirement__c req:Trigger.old) 


Requirement__c R = new Requirement__c(won__c = listR.won__c);

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

{
for(RequirementAssignment__c pc: [Select Id, Name, won__c, Lead_Recruiter__c, Recruiter__c,Requirement__c from RequirementAssignment__c where requirement__c=:reqId limit 1])

System.Debug('pc.Lead_Recruiter__c :' + pc.Lead_Recruiter__c); 
if(pc.Lead_Recruiter__c == null) 
{

System.Debug('pc.Lead_Recruiter__c :' + pc.Lead_Recruiter__c); 

user up = [Select u.Id from User u where (u.Profile.Name ='Lead Recruiter' or u.Profile.Name ='LR Chatter Only User') and Isactive = true limit 1]; 
pc.Lead_Recruiter__c = up.id; 

if(R.won__c == true) 
pc.won__c = 'Yes'; 
else 
pc.won__c = 'No'; 
System.Debug('pc.won__c :' + pc.won__c); 
RAA.add(pc); 



if(RAA.size() >0 )

Database.DMLOptions dml = new Database.DMLOptions(); 
// dml.optAllOrNone = false;
database.update(RAA,dml); 


} // if listreq.size Ends 
}

}
}

 

 

In this trigger, i am facing soql limit error in for(RequirementAssignment__c pc: [Select Id, Name, won__c, Lead_Recruiter__c, Recruiter__c,Requirement__c from RequirementAssignment__c where requirement__c=:reqId limit 1]) line.

 

trigger updateresumessubmitted on Candidate_Mapping__c (after insert, after update)
{

integer ressubmitted;
integer ressubmitted1;
string UserId = UserInfo.getUserId();
System.Debug('UserId =' + UserId);

if(Trigger.isUpdate || Trigger.isInsert)
{

for(Candidate_Mapping__c cm : Trigger.new)
{
system.debug('cm:' + cm);

List<Requirement__c> reqlist = [Select Id, Submitted_Resumes__c, status__c,cumulative_resumes_submitted__c from requirement__c where id =:cm.requirement__c limit 1];

system.debug('reqlist :' +reqlist);

//List <AggregateResult> ar = [SELECT count(Id) cnt FROM Candidate_Mapping__c where (Status1__c != 'rejected' and Status1__c != 'LR Rejected' ) and requirement__c =:cm.requirement__c];

//List <Candidate_Mapping__c> ar = [SELECT Id FROM Candidate_Mapping__c where (Status1__c != 'rejected' and Status1__c != 'LR Rejected' ) and requirement__c =:cm.requirement__c limit 1];
// system.debug('ar:' +ar);

for(AggregateResult ar1 : [SELECT count(Id) cnt FROM Candidate_Mapping__c where (Status1__c != 'rejected' and Status1__c != 'LR Rejected' ) and requirement__c =:cm.requirement__c])
{
ressubmitted = Integer.valueOf(ar1.get('cnt'));
system.debug('ressubmitted :' +ressubmitted);

for(requirement__c req : reqlist)
{
req.cumulative_resumes_submitted__c = ressubmitted;
system.debug('cumulative_resumes_submitted__c :' + req.cumulative_resumes_submitted__c);
system.debug('status__c12 :'+ req.status__c);
if(req.status__c == 'Open')
{
system.debug('status__c123 :'+ req.status__c);
for(integer i = 0 ; i< reqlist.size(); i++)
{
reqlist[i].Submitted_Resumes__c = ressubmitted;
}
}

if(req.status__c == 'Re-open' )
{
system.debug('status__c1 :'+ req.status__c);
system.debug('cm.Status1__c11 :'+ cm.Status1__c);
system.debug('submitted_resumes :' + req.Submitted_Resumes__c);
system.debug('cm.LRdate__c :' + cm.LRdate__c);
if(cm.status1__c == 'applied' && cm.createdbyid == UserId || cm.status1__c == 'LR Approved' && cm.createdbyid == UserId || cm.status1__c == 'Approved' && cm.createdbyid == UserId )
{
system.debug('status__c00:'+ req.status__c);
req.Submitted_Resumes__c = req.Submitted_Resumes__c + 1;
system.debug('submitted_resumes0 :' + req.Submitted_Resumes__c);
}
else if (cm.status1__c == 'LR Rejected' && cm.createdbyid == UserId && req.Submitted_Resumes__c == 0 || cm.status1__c == 'Rejected' && cm.createdbyid == UserId && req.Submitted_Resumes__c == 0)
{
system.debug('status__c 1123:'+ req.status__c);
req.Submitted_Resumes__c = 0;
system.debug('submitted_resumes3 :' + req.Submitted_Resumes__c);
}

else if (cm.status1__c == 'rejected' || cm.status1__c == 'LR Rejected')
{
// system.debug('cm.LRdate__c :' + cm.LRdate__c);
system.debug('status__c 1122:'+ req.status__c);
req.Submitted_Resumes__c = req.Submitted_Resumes__c - 1;
system.debug('submitted_resumes2 :' + req.Submitted_Resumes__c);
}
else
{
system.debug('status__c 1121:'+ req.status__c);
req.Submitted_Resumes__c = req.Submitted_Resumes__c;
system.debug('submitted_resumes1 :' + req.Submitted_Resumes__c);
}
}

system.debug('cm.Status1__c :'+ cm.Status1__c);
system.debug('status__c :'+ req.status__c);
system.debug('submitted_resumes3 :' + req.Submitted_Resumes__c);

upsert reqlist;
system.debug('reqlist1:' +reqlist);

}

}
}
}

}

 

In this trigger, i am facing soql limit error in for(AggregateResult ar1 : [SELECT count(Id) cnt FROM Candidate_Mapping__c where (Status1__c != 'rejected' and Status1__c != 'LR Rejected' ) and requirement__c =:cm.requirement__c].

 

 

When i run the below test class i am facing error in any one of the above 2 stmts. 

 

 

@isTest
private class testclassCandidateMapfromCandidatesEdit
{
static testMethod void myUnitTest()
{

String oppid;
String cid;
String Userid;
Integer i,j,k;

Id id1 = UserInfo.getUserRoleId();
UserRole test1 = [Select Name from UserRole where id = :id1 limit 1];
system.test.starttest();

Profile p = [SELECT Id FROM Profile where Name = 'R Chatter Only User' ];
userRole r=[select id from userrole where Name = 'Recruiter' ];
User u = new User(Alias = 'testa', Email='standarduser1@testorg.com',
EmailEncodingKey='UTF-8', LastName='Testaa', LanguageLocaleKey='en_US',
LocaleSidKey='en_US', ProfileId = p.Id,
TimeZoneSidKey='America/Los_Angeles', UserName='standarduser1@testorg.com.ezredev',userRoleid=r.id);

System.runAs(u)
{
Candidate_Mapping__c coa =new Candidate_Mapping__c();

coa.status1__c = 'Applied';
coa.Employer_s_Authorization__c = 'test';
coa.LR_Comments__c = 'test by lr';
coa.MR_Comments__c = 'test by MR';
coa.Requirement_Owner_Email__c = 'testOwner@preludesys.com';
coa.Manager_Email_ID__c = 'testOwner1@preludesys.com';
coa.R_Comments__c = '';
coa.LR_Status__c = 'Rejected';
coa.MR_Status__c = 'Applied';
coa.LR_Status_Date__c = DateTime.now().format('MM-dd-yyyy hh:mm a z', 'America/Los_Angeles');
coa.MR_Status_Date__c = DateTime.now().format('MM-dd-yyyy hh:mm a z', 'America/Los_Angeles');
coa.Submitted_to_Client__c = 'Yes';
coa.Interview_Scheduled__c = 'Yes';
coa.Interview_Accepted__c = 'Yes';
coa.Client_Interviewed__c = 'Yes';
coa.Client_Offered__c = 'Yes';
coa.Candidate_started__c = 'Yes';
coa.Comments__c = '';

candidate__c cc1=new candidate__c();

cc1.Name='test';
cc1.Last_name__c='testoneo';
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();
insert cc1;
coa.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();
rc1.won__c = true;
insert rc1;
coa.Requirement__c=rc1.id;

RequirementAssignment__c oppa=new RequirementAssignment__c();
oppa=new RequirementAssignment__c();
oppa.Requirement__c=rc1.Id;
oppa.Recruiter__c =u.Id;
oppa.won__c = 'yes';
System.Debug('U:'+ oppa.Recruiter__c);
insert oppa;

insert coa;

List<ContentVersion> cv = new List<ContentVersion>();
cv = [Select Id, Candidate_ID__c From ContentVersion where Candidate_ID__c =:coa.Candidate__c limit 1] ;
System.Debug('CV : '+ cv);
if(cv.Size()>0)
{
for(ContentVersion cv1 : cv)
{
Candidate__c can = new Candidate__c(Id = cc1.Id);
can.Resume_Attach__c = '0584000000003RrAAI';
update can;
}
}

CandidateMapfromCandidatesEdit cc = new CandidateMapfromCandidatesEdit();

cc.save();
apexpages.currentpage().getparameters().put('cid' , coa.id);
cc.save();
system.assert(coa!= null);
cc.cancel();
cc.save();
}

Profile p1 =[SELECT Id From Profile where Name= 'LR Chatter Only User'];
userRole r1 =[SELECT Id FROM UserRole where Name = 'Lead Recruiter'];
User u1 = new User(Alias = 'testuser', Email='testUser@testorg.com',
EmailEncodingKey='UTF-8', LastName='TestUseraa', LanguageLocaleKey='en_US',
LocaleSidKey='en_US', ProfileId = p1.Id,
TimeZoneSidKey='America/Los_Angeles', UserName='testUser@testorg.com.ezredev',userRoleid=r1.id);
System.runAs(u1){
Candidate_Mapping__c coa1 =new Candidate_Mapping__c();

coa1.status1__c = 'Applied';
coa1.Employer_s_Authorization__c = 'test';
coa1.LR_Comments__c = 'test by lr';
coa1.MR_Comments__c = 'test by MR';
coa1.Requirement_Owner_Email__c = 'testOwn1@preludesys.com';
coa1.Manager_Email_ID__c = 'testOwn1@preludesys.com';

coa1.R_Comments__c = '';
coa1.LR_Status__c = 'Rejected';
coa1.MR_Status__c = 'Applied';
coa1.LR_Status_Date__c = DateTime.now().format('MM-dd-yyyy hh:mm a z', 'America/Los_Angeles');
coa1.MR_Status_Date__c = DateTime.now().format('MM-dd-yyyy hh:mm a z', 'America/Los_Angeles');
coa1.Submitted_to_Client__c = 'Yes';
coa1.Interview_Scheduled__c = 'Yes';
coa1.Interview_Accepted__c = 'Yes';
coa1.Client_Interviewed__c = 'Yes';
coa1.Client_Offered__c = 'Yes';
coa1.Candidate_started__c = 'Yes';
coa1.Comments__c = '';

candidate__c cc1=new candidate__c();
cc1.Name='testtwo';
cc1.last_name__c='testtwo';
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='w2';
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='tyt';
cc1.Employer_Mobile_No__c='9988009876';

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

requirement__c rc1=new requirement__c();
rc1.Name='SampathReq0';
rc1.Job_Title__c='.net0';
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();
rc1.won__c = true;
insert rc1;
coa1.Requirement__c=rc1.id;

RequirementAssignment__c oppa=new RequirementAssignment__c();
oppa=new RequirementAssignment__c();
oppa.Requirement__c=rc1.Id;
oppa.lead_recruiter__c =u1.Id;
oppa.won__c = 'yes';
System.Debug('U:'+ oppa.lead_recruiter__c);
insert oppa;
insert coa1;

List<ContentVersion> cv = new List<ContentVersion>();
cv = [Select Id, Candidate_ID__c From ContentVersion limit 1] ;
if(cv.Size()>0)
{
for(ContentVersion cv1 : cv)
{
Candidate__c can = new Candidate__c(Id = cv1.Id);

//can.Cost__c = 0;
can.Resume_Attach__c = cv1.Id;
update can;
}
}

CandidateMapfromCandidatesEdit cc = new CandidateMapfromCandidatesEdit();
cc.save();
apexpages.currentpage().getparameters().put('cid' , coa1.id);

cc.save();

system.assert(coa1!= null);

cc.cancel();

cc.save();
}
system.test.stoptest();
}
}

 

Some times i am facing issue in the first trigger and some times i am facing this issue in 2nd trigger.

 

Kindly advice.

 

 

 

 

 

  • September 11, 2013
  • Like
  • 0
Hi Friends,

I have some requirement to calculate the due date excluding weekends. But, this could be calculated in apex controllers to be used in adhoc report. This calculations requires in apex controller to get no.of business days to calculate the due date value. It may be 30 days, 60 days, 90 days or 180 days due date from the source date. For Ex; Record createdDate.addDays(30), generally gives post date value after 30 days from this created date. But, I need to get Date value as 30th Business day from the createdDate value which excludes weekends. 

I have gone through some urls which suggests to create a formula field on object level. But, in my case, i need to do this calculation in apex controller and need to display due date value on my custom vf page and no need to capture in any salesforce object. I also used some custom logic which is used to get no.of business days between two dates. But, that login throws me CPU time limit exceed error while doing calculation for bulk records.

Please help me how to do this calculation.

Thanks,
Phanikumar
Hi Friends,

I would like to display existed profiles and vf pages on the vf page.

I have idea about using sobject.getdescribe() methods to fetch the metadata values with out using soql queries. I used these to fetch the recordtype id details.

Now, the same i would like to fetch all the existed profiles(standard and custom profiles both) and all the developed VFPages in the salesforce org.

Please help me in this how to fetch these details without using SOQL queries.

Thanks,
Phanikumar

Hi,

In case object, there is a lookup relation from case to account is available. I need to populate the account details on case related list when the case is created for that account. Case details are populated in the accout related list on account object page layout. But, the same thing when i am trying add the account as a related list to the case, it is not available.

Please suggest me how to populate the account information on case page layout in a related list?

 

Regards,

Kumar

Hi,

 

In my project, i got the requirement to execute the apex methods from java script. For that, i need to change the existed normal apex method to web service methods to be used in java script.

 

In my project, the apex controller developed already. while changing the code to web service i am getting the error like:

Variable does not exist.

 

The variables which are declared with in the class can not be accessed in the method with in the same class.

 

Please suggest how to change the normal apex to web services.

 

Thanks in advance.

 

Regarsd,

Kumar

Hi,

 

I am facing issue to display the whole text of long text area field in the browsers of chrome and safari.

 

But, in Firefox and IE, the whole text is displaying. I used apex:outputText to display the text.

 

Please suggest me how to fix this issue.

 

Thanks in advance.

 

Regards,

kumar

 

Hi,

 

I created one custom field called Casenotes which is LongTextArea and given the value for #Visible Lines: 5 at the time of field creation. I have used this field in my VF Page to display the case details.

In my code, i used <apex:outputField value="{!case.CaseNotes__c}"/> to display the text for that field. But, it doesnot display the whole text in the vf page. I have entered the text of around 15 lines. But, on the page, it doesnot display the whole text.

 

I tried to use of apex:outputText to display the text. But, it doesnot display the text how i entered.

 

Can anyone please support to fix this issue.

 

Thanks in advance.

 

Regards,

kumar

Hi,

 

In my project, we enable chatter and publisher actions to use case feed pagelayout.

 

In that case feed pagelayout, we checked the highlight panel to be visible in Service console application.

In the highlight panel, we are mapping some fields to show on the Case detail page in Service console. In that, in middle pane,

we used to display below four fileds:

1. Case Number 2. Created date 3. Subject 4. Description

Here, Case number is auto number and created date(Date/Time Opened), both are standard fields. These two fields we cannot move and remove in the highlight panel.

 

We have give visibility and Read only permissions for each profile. So, every user can able to see these two fields.

 

When the user clicks on any case, these two fields Case number and Created Date are not appearing in the highlight panel.

 

I checked profile wise, field level security and pagelayout assignment also. In each level, those feilds are visible and read only.

 

But, i don't know how to fix this issue. How to make display these two values visible when the user clicks any case in Service Console.

 

Any one can suggest and support me in this.

 

Thanks in advance.

 

Regards,
Kumar

Hi,

 

In my project, i am facing deploying issue while uploading the Apex trigger from Sandbox to Production. While deploying the code, i am facing below issue.

 

Error:

System.DmlException: Update failed. First exception on row 0 with id 001L000000DbXA1IAN; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, The Account record is locked until the SAP Customer / Master creation has been completed.: []

 

Can any one help me to solve this issue.

 

Thanks in advance.

 

Regards,

Kumar

Hi,

 

In my project, i have the below scenario. On Case object, two custom buttons used. For those two custom buttons, they used Visual force pages.

 

On loading the page, it executes the corresponding action method. Like below:

 

<apex:page standardController="Case" extensions="Case_Remake_Repair_Controller" action="{!remake}">

 

Now, on defining custom button, behaviour is selected as "Open in a new window" and displaying some status message as:

"Your REMAKE has been sent to ECC."


Now, i want to show this message instead of new window, as an alert message in javascript.
I thought of using Javascript here. And the behaviour is: Onclick - Execute javascript.

 

Now, please suggest me how to call the above apex method in javascript while clicking on the custom button.

 

Thanks in advance.

 

Regards,

Kumar

 

Hi,

 

In my project, i developed trigger on Task object. My requirement is:

 

1. Task has the field Description which is text-area long.

2. When we try to update the description with the new data, it should append to the existed value.

3. But, here on clicking edit button, the old value is appearing in the text area and the user adds the notes to that existed data.

4. Then, the existed data along with new data is appending with the existed value.

 

For example:

 

Task Object

 

1. Task description field old value: "Testing One"

2. Task description field new value: "Testing One Testing Two". (Because, here while clicking on edit, existed data is available. The user enters the new data along with old value).

 

Now, the updated task description field value is: "Testing One Testing One Testing Two". But, the user expect that it should be "Testing One Testing Two.".

 

I thought of using javascript here. When clicking on Edit button, it clears the old value of the description field. Then, the user enters the new data only. that will append to the existed one.

 

How could i use javascript while clicking on edit(Standard button) and how to implement the functionality for clearing the text area field?

 

Please suggest me in this how to fix this issue?

 

Thanks in advance.

 

Regards,

kumar

Hi,

 

Can any one tell me that how to attach file while creating document by using apex controller code?

 

I need to automate the process of replacing the document daily wise. Instead of that, we decided to make this as automated process by using E-mail services.

 

I am able to create the record under document. But, i could not able to attach the file which is available in the email attachment.

 

Please help me in this how to upload that email attachment for the document record.

 

Thanks in advance.....

 

Regards,

Phanikumar

Hi,

 

We have developed one customized VF page for executing the Batch apex. Now, we want to restrict the users accessing the same at a time. Means, if one user accessing the page, at the same time, if any one wants to access the same page, we need show the message saying that, the page is accessed by so and so user. 

 

How to identify that which user access the page first and how to restrict the other users, for using the same page which is accessed by the other one.

 

Kindly give me any suggestions for this. Thanks in advance.

 

Regards,

Phanikumar

Hi Friends,

At present, i am working on Salesforce Integration from SAP to SFDC.

I have worked on the concepts of generate WSDL from Apex code and used SOAP API to check the WSDL File. Now, i want to know how to generte apex code from the given WSDL file.

We get the WSDL file from Client team, based on that, we have to develop the Apex code in SFDC.

Is there any necessary pre-requisite steps are there.

Please give me solution for this.

Thanks in advance.

 

Regards,

Phanikumar

Hi Friends,

 

I created labels for the content of VF Pages, which is used to display the content based on user selection language. For this, the available content of the VF Pages are labelized. Now, we created translations for the created labels into Spanish and German.

 

Now, we want to export/deploy these translations from DEV environment to Production. By using Force.com IDE, i am not getting the translations of the labels from DEV to target environment.

 

Please help me in this, how to export the labels along with translations from DEV environment to Production/QA Sandbox environment.

 

Thanks in advance.

 

Regards,

Phanikumar

Hi Friends,

 

I need to know how to the query the records from custom label object. Is it possible to query the data from this object? As we do the same from other objects like Account, Contact, ......

We can use labels in our controller, like Label.<Label_Name>.

 

while i am trying to query the data from customLabel, it is throwing error like :

 

"line 1, column 20: sObject type 'CustomLabel' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names."

 

Please help me in this, how to use this object in apex controller.

 

Thanks in advance.

 

Regards,

Phanikumar

Hi Friends,

 

I want to learn the concepts of Web Services and HTTP Callouts for SFDC Integrations. I need to suggestions and information how to learn these advanced concepts.

 

- Web Services (SOAP UI, SSO Implementation)

- HTTP Callouts (Pust,Get,Post,...)

 

Please give me guidelines and imp tutorial sites to learn these advanced concepts.

 

Regards,

Phanikumar

Hi,

 

I want to use the multi-lingual feature of Salesforce. I need to dispaly the contents on the visual force pages in user-selected language. By default, it displays in English.

 

When, the user selects his preferred language to other than english, then i need to display the content in that selected language.

 

We create the labels for the content which are dispalyed on the VF Page. Now, i want to implement multi-lingual support.

 

So, please help me in this, how to use this feature.

 

Thanks in advance.

 

Regards,

Phanikumar

Hi Friends,

 

Please give me the information, how to write the test methods for Webservices callouts.

 

Regards,

Phanikumar

Hi Friends,

 

I developed one page using RSS Feed. Due to this, from a site of "http://phx.corporate-ir.net/corporate.rss?c=61500&Rule=Cat=news|subcat=ALL" which  i am getting the daily updates about myWD. 

 

Now, i want to store the details which are displaying on the page has to be captured and load into the custom object.

 

I got the source code from community itselft, by using the keyword like 'rss feed'.

 

In that, getFeedContent method is used to display the details on the page. The same details, i want to capture in a list and inset into the custom object.

 

whie i am trying to capture the content in getFeedContent(), i am getting following error:

 

System.LimitException: DML currently not allowed
Class.RssFeed.getfeedcontent: line 98, column 1

 

Please help me in this, how to capture the content from the page(rssFeed Page).

 

 

Regards,

Phanikumar

Hi Friends,

 

I need detailed information about the creation of Sites in SFDC. In Sites, Login functionality is mandatory.

 

can we develop sites with out login credentials?

 

I developed site : AppSetup -> Develop -> Sites and click New and i gave the all the required details and click on the Save button.

 

Now, i want to use how to use this site and want to assign the developed pages to it.

 

Please proivde me detailed documentation about the creation of Sites.

 

Thanks in advance.

 

Regards,

Phanikumar

Hi Friends,

 

I need to know how to the query the records from custom label object. Is it possible to query the data from this object? As we do the same from other objects like Account, Contact, ......

We can use labels in our controller, like Label.<Label_Name>.

 

while i am trying to query the data from customLabel, it is throwing error like :

 

"line 1, column 20: sObject type 'CustomLabel' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names."

 

Please help me in this, how to use this object in apex controller.

 

Thanks in advance.

 

Regards,

Phanikumar

Hi Friends,

I have some requirement to calculate the due date excluding weekends. But, this could be calculated in apex controllers to be used in adhoc report. This calculations requires in apex controller to get no.of business days to calculate the due date value. It may be 30 days, 60 days, 90 days or 180 days due date from the source date. For Ex; Record createdDate.addDays(30), generally gives post date value after 30 days from this created date. But, I need to get Date value as 30th Business day from the createdDate value which excludes weekends. 

I have gone through some urls which suggests to create a formula field on object level. But, in my case, i need to do this calculation in apex controller and need to display due date value on my custom vf page and no need to capture in any salesforce object. I also used some custom logic which is used to get no.of business days between two dates. But, that login throws me CPU time limit exceed error while doing calculation for bulk records.

Please help me how to do this calculation.

Thanks,
Phanikumar

Hi,

In case object, there is a lookup relation from case to account is available. I need to populate the account details on case related list when the case is created for that account. Case details are populated in the accout related list on account object page layout. But, the same thing when i am trying add the account as a related list to the case, it is not available.

Please suggest me how to populate the account information on case page layout in a related list?

 

Regards,

Kumar

Hi,

 

I am facing an issue like "too many sqol queries : 101" when i run a test class.

 

I will post my code here:

 

 

trigger updateassreqwon on Requirement__c (after update) 


if(Trigger.isUpdate) 

string reqId = Trigger.old[0].Id;

Requirement__c listR = [Select Id, Name, job_title__c, won__c from Requirement__c where Id =:reqId limit 1]; 

// List<RequirementAssignment__c> listreq = [Select Id, Name, won__c, Lead_Recruiter__c, Recruiter__c,Requirement__c from RequirementAssignment__c where requirement__c=:reqId limit 1];

// System.Debug('listreq :' +listreq); 

for(Requirement__c req:Trigger.old) 


Requirement__c R = new Requirement__c(won__c = listR.won__c);

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

{
for(RequirementAssignment__c pc: [Select Id, Name, won__c, Lead_Recruiter__c, Recruiter__c,Requirement__c from RequirementAssignment__c where requirement__c=:reqId limit 1])

System.Debug('pc.Lead_Recruiter__c :' + pc.Lead_Recruiter__c); 
if(pc.Lead_Recruiter__c == null) 
{

System.Debug('pc.Lead_Recruiter__c :' + pc.Lead_Recruiter__c); 

user up = [Select u.Id from User u where (u.Profile.Name ='Lead Recruiter' or u.Profile.Name ='LR Chatter Only User') and Isactive = true limit 1]; 
pc.Lead_Recruiter__c = up.id; 

if(R.won__c == true) 
pc.won__c = 'Yes'; 
else 
pc.won__c = 'No'; 
System.Debug('pc.won__c :' + pc.won__c); 
RAA.add(pc); 



if(RAA.size() >0 )

Database.DMLOptions dml = new Database.DMLOptions(); 
// dml.optAllOrNone = false;
database.update(RAA,dml); 


} // if listreq.size Ends 
}

}
}

 

 

In this trigger, i am facing soql limit error in for(RequirementAssignment__c pc: [Select Id, Name, won__c, Lead_Recruiter__c, Recruiter__c,Requirement__c from RequirementAssignment__c where requirement__c=:reqId limit 1]) line.

 

trigger updateresumessubmitted on Candidate_Mapping__c (after insert, after update)
{

integer ressubmitted;
integer ressubmitted1;
string UserId = UserInfo.getUserId();
System.Debug('UserId =' + UserId);

if(Trigger.isUpdate || Trigger.isInsert)
{

for(Candidate_Mapping__c cm : Trigger.new)
{
system.debug('cm:' + cm);

List<Requirement__c> reqlist = [Select Id, Submitted_Resumes__c, status__c,cumulative_resumes_submitted__c from requirement__c where id =:cm.requirement__c limit 1];

system.debug('reqlist :' +reqlist);

//List <AggregateResult> ar = [SELECT count(Id) cnt FROM Candidate_Mapping__c where (Status1__c != 'rejected' and Status1__c != 'LR Rejected' ) and requirement__c =:cm.requirement__c];

//List <Candidate_Mapping__c> ar = [SELECT Id FROM Candidate_Mapping__c where (Status1__c != 'rejected' and Status1__c != 'LR Rejected' ) and requirement__c =:cm.requirement__c limit 1];
// system.debug('ar:' +ar);

for(AggregateResult ar1 : [SELECT count(Id) cnt FROM Candidate_Mapping__c where (Status1__c != 'rejected' and Status1__c != 'LR Rejected' ) and requirement__c =:cm.requirement__c])
{
ressubmitted = Integer.valueOf(ar1.get('cnt'));
system.debug('ressubmitted :' +ressubmitted);

for(requirement__c req : reqlist)
{
req.cumulative_resumes_submitted__c = ressubmitted;
system.debug('cumulative_resumes_submitted__c :' + req.cumulative_resumes_submitted__c);
system.debug('status__c12 :'+ req.status__c);
if(req.status__c == 'Open')
{
system.debug('status__c123 :'+ req.status__c);
for(integer i = 0 ; i< reqlist.size(); i++)
{
reqlist[i].Submitted_Resumes__c = ressubmitted;
}
}

if(req.status__c == 'Re-open' )
{
system.debug('status__c1 :'+ req.status__c);
system.debug('cm.Status1__c11 :'+ cm.Status1__c);
system.debug('submitted_resumes :' + req.Submitted_Resumes__c);
system.debug('cm.LRdate__c :' + cm.LRdate__c);
if(cm.status1__c == 'applied' && cm.createdbyid == UserId || cm.status1__c == 'LR Approved' && cm.createdbyid == UserId || cm.status1__c == 'Approved' && cm.createdbyid == UserId )
{
system.debug('status__c00:'+ req.status__c);
req.Submitted_Resumes__c = req.Submitted_Resumes__c + 1;
system.debug('submitted_resumes0 :' + req.Submitted_Resumes__c);
}
else if (cm.status1__c == 'LR Rejected' && cm.createdbyid == UserId && req.Submitted_Resumes__c == 0 || cm.status1__c == 'Rejected' && cm.createdbyid == UserId && req.Submitted_Resumes__c == 0)
{
system.debug('status__c 1123:'+ req.status__c);
req.Submitted_Resumes__c = 0;
system.debug('submitted_resumes3 :' + req.Submitted_Resumes__c);
}

else if (cm.status1__c == 'rejected' || cm.status1__c == 'LR Rejected')
{
// system.debug('cm.LRdate__c :' + cm.LRdate__c);
system.debug('status__c 1122:'+ req.status__c);
req.Submitted_Resumes__c = req.Submitted_Resumes__c - 1;
system.debug('submitted_resumes2 :' + req.Submitted_Resumes__c);
}
else
{
system.debug('status__c 1121:'+ req.status__c);
req.Submitted_Resumes__c = req.Submitted_Resumes__c;
system.debug('submitted_resumes1 :' + req.Submitted_Resumes__c);
}
}

system.debug('cm.Status1__c :'+ cm.Status1__c);
system.debug('status__c :'+ req.status__c);
system.debug('submitted_resumes3 :' + req.Submitted_Resumes__c);

upsert reqlist;
system.debug('reqlist1:' +reqlist);

}

}
}
}

}

 

In this trigger, i am facing soql limit error in for(AggregateResult ar1 : [SELECT count(Id) cnt FROM Candidate_Mapping__c where (Status1__c != 'rejected' and Status1__c != 'LR Rejected' ) and requirement__c =:cm.requirement__c].

 

 

When i run the below test class i am facing error in any one of the above 2 stmts. 

 

 

@isTest
private class testclassCandidateMapfromCandidatesEdit
{
static testMethod void myUnitTest()
{

String oppid;
String cid;
String Userid;
Integer i,j,k;

Id id1 = UserInfo.getUserRoleId();
UserRole test1 = [Select Name from UserRole where id = :id1 limit 1];
system.test.starttest();

Profile p = [SELECT Id FROM Profile where Name = 'R Chatter Only User' ];
userRole r=[select id from userrole where Name = 'Recruiter' ];
User u = new User(Alias = 'testa', Email='standarduser1@testorg.com',
EmailEncodingKey='UTF-8', LastName='Testaa', LanguageLocaleKey='en_US',
LocaleSidKey='en_US', ProfileId = p.Id,
TimeZoneSidKey='America/Los_Angeles', UserName='standarduser1@testorg.com.ezredev',userRoleid=r.id);

System.runAs(u)
{
Candidate_Mapping__c coa =new Candidate_Mapping__c();

coa.status1__c = 'Applied';
coa.Employer_s_Authorization__c = 'test';
coa.LR_Comments__c = 'test by lr';
coa.MR_Comments__c = 'test by MR';
coa.Requirement_Owner_Email__c = 'testOwner@preludesys.com';
coa.Manager_Email_ID__c = 'testOwner1@preludesys.com';
coa.R_Comments__c = '';
coa.LR_Status__c = 'Rejected';
coa.MR_Status__c = 'Applied';
coa.LR_Status_Date__c = DateTime.now().format('MM-dd-yyyy hh:mm a z', 'America/Los_Angeles');
coa.MR_Status_Date__c = DateTime.now().format('MM-dd-yyyy hh:mm a z', 'America/Los_Angeles');
coa.Submitted_to_Client__c = 'Yes';
coa.Interview_Scheduled__c = 'Yes';
coa.Interview_Accepted__c = 'Yes';
coa.Client_Interviewed__c = 'Yes';
coa.Client_Offered__c = 'Yes';
coa.Candidate_started__c = 'Yes';
coa.Comments__c = '';

candidate__c cc1=new candidate__c();

cc1.Name='test';
cc1.Last_name__c='testoneo';
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();
insert cc1;
coa.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();
rc1.won__c = true;
insert rc1;
coa.Requirement__c=rc1.id;

RequirementAssignment__c oppa=new RequirementAssignment__c();
oppa=new RequirementAssignment__c();
oppa.Requirement__c=rc1.Id;
oppa.Recruiter__c =u.Id;
oppa.won__c = 'yes';
System.Debug('U:'+ oppa.Recruiter__c);
insert oppa;

insert coa;

List<ContentVersion> cv = new List<ContentVersion>();
cv = [Select Id, Candidate_ID__c From ContentVersion where Candidate_ID__c =:coa.Candidate__c limit 1] ;
System.Debug('CV : '+ cv);
if(cv.Size()>0)
{
for(ContentVersion cv1 : cv)
{
Candidate__c can = new Candidate__c(Id = cc1.Id);
can.Resume_Attach__c = '0584000000003RrAAI';
update can;
}
}

CandidateMapfromCandidatesEdit cc = new CandidateMapfromCandidatesEdit();

cc.save();
apexpages.currentpage().getparameters().put('cid' , coa.id);
cc.save();
system.assert(coa!= null);
cc.cancel();
cc.save();
}

Profile p1 =[SELECT Id From Profile where Name= 'LR Chatter Only User'];
userRole r1 =[SELECT Id FROM UserRole where Name = 'Lead Recruiter'];
User u1 = new User(Alias = 'testuser', Email='testUser@testorg.com',
EmailEncodingKey='UTF-8', LastName='TestUseraa', LanguageLocaleKey='en_US',
LocaleSidKey='en_US', ProfileId = p1.Id,
TimeZoneSidKey='America/Los_Angeles', UserName='testUser@testorg.com.ezredev',userRoleid=r1.id);
System.runAs(u1){
Candidate_Mapping__c coa1 =new Candidate_Mapping__c();

coa1.status1__c = 'Applied';
coa1.Employer_s_Authorization__c = 'test';
coa1.LR_Comments__c = 'test by lr';
coa1.MR_Comments__c = 'test by MR';
coa1.Requirement_Owner_Email__c = 'testOwn1@preludesys.com';
coa1.Manager_Email_ID__c = 'testOwn1@preludesys.com';

coa1.R_Comments__c = '';
coa1.LR_Status__c = 'Rejected';
coa1.MR_Status__c = 'Applied';
coa1.LR_Status_Date__c = DateTime.now().format('MM-dd-yyyy hh:mm a z', 'America/Los_Angeles');
coa1.MR_Status_Date__c = DateTime.now().format('MM-dd-yyyy hh:mm a z', 'America/Los_Angeles');
coa1.Submitted_to_Client__c = 'Yes';
coa1.Interview_Scheduled__c = 'Yes';
coa1.Interview_Accepted__c = 'Yes';
coa1.Client_Interviewed__c = 'Yes';
coa1.Client_Offered__c = 'Yes';
coa1.Candidate_started__c = 'Yes';
coa1.Comments__c = '';

candidate__c cc1=new candidate__c();
cc1.Name='testtwo';
cc1.last_name__c='testtwo';
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='w2';
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='tyt';
cc1.Employer_Mobile_No__c='9988009876';

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

requirement__c rc1=new requirement__c();
rc1.Name='SampathReq0';
rc1.Job_Title__c='.net0';
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();
rc1.won__c = true;
insert rc1;
coa1.Requirement__c=rc1.id;

RequirementAssignment__c oppa=new RequirementAssignment__c();
oppa=new RequirementAssignment__c();
oppa.Requirement__c=rc1.Id;
oppa.lead_recruiter__c =u1.Id;
oppa.won__c = 'yes';
System.Debug('U:'+ oppa.lead_recruiter__c);
insert oppa;
insert coa1;

List<ContentVersion> cv = new List<ContentVersion>();
cv = [Select Id, Candidate_ID__c From ContentVersion limit 1] ;
if(cv.Size()>0)
{
for(ContentVersion cv1 : cv)
{
Candidate__c can = new Candidate__c(Id = cv1.Id);

//can.Cost__c = 0;
can.Resume_Attach__c = cv1.Id;
update can;
}
}

CandidateMapfromCandidatesEdit cc = new CandidateMapfromCandidatesEdit();
cc.save();
apexpages.currentpage().getparameters().put('cid' , coa1.id);

cc.save();

system.assert(coa1!= null);

cc.cancel();

cc.save();
}
system.test.stoptest();
}
}

 

Some times i am facing issue in the first trigger and some times i am facing this issue in 2nd trigger.

 

Kindly advice.

 

 

 

 

 

  • September 11, 2013
  • Like
  • 0

Hi,

 

I created one custom field called Casenotes which is LongTextArea and given the value for #Visible Lines: 5 at the time of field creation. I have used this field in my VF Page to display the case details.

In my code, i used <apex:outputField value="{!case.CaseNotes__c}"/> to display the text for that field. But, it doesnot display the whole text in the vf page. I have entered the text of around 15 lines. But, on the page, it doesnot display the whole text.

 

I tried to use of apex:outputText to display the text. But, it doesnot display the text how i entered.

 

Can anyone please support to fix this issue.

 

Thanks in advance.

 

Regards,

kumar

Hi,

 

In my project, i am facing deploying issue while uploading the Apex trigger from Sandbox to Production. While deploying the code, i am facing below issue.

 

Error:

System.DmlException: Update failed. First exception on row 0 with id 001L000000DbXA1IAN; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, The Account record is locked until the SAP Customer / Master creation has been completed.: []

 

Can any one help me to solve this issue.

 

Thanks in advance.

 

Regards,

Kumar

Hi,

 

In my project, i have the below scenario. On Case object, two custom buttons used. For those two custom buttons, they used Visual force pages.

 

On loading the page, it executes the corresponding action method. Like below:

 

<apex:page standardController="Case" extensions="Case_Remake_Repair_Controller" action="{!remake}">

 

Now, on defining custom button, behaviour is selected as "Open in a new window" and displaying some status message as:

"Your REMAKE has been sent to ECC."


Now, i want to show this message instead of new window, as an alert message in javascript.
I thought of using Javascript here. And the behaviour is: Onclick - Execute javascript.

 

Now, please suggest me how to call the above apex method in javascript while clicking on the custom button.

 

Thanks in advance.

 

Regards,

Kumar

 

Hi,

 

In my project, i developed trigger on Task object. My requirement is:

 

1. Task has the field Description which is text-area long.

2. When we try to update the description with the new data, it should append to the existed value.

3. But, here on clicking edit button, the old value is appearing in the text area and the user adds the notes to that existed data.

4. Then, the existed data along with new data is appending with the existed value.

 

For example:

 

Task Object

 

1. Task description field old value: "Testing One"

2. Task description field new value: "Testing One Testing Two". (Because, here while clicking on edit, existed data is available. The user enters the new data along with old value).

 

Now, the updated task description field value is: "Testing One Testing One Testing Two". But, the user expect that it should be "Testing One Testing Two.".

 

I thought of using javascript here. When clicking on Edit button, it clears the old value of the description field. Then, the user enters the new data only. that will append to the existed one.

 

How could i use javascript while clicking on edit(Standard button) and how to implement the functionality for clearing the text area field?

 

Please suggest me in this how to fix this issue?

 

Thanks in advance.

 

Regards,

kumar

Hi,

 

In Service Console, I have created a custom button in lead detail page. On click of that button, I need to open a Service Console subtab(passing the lead Id). Please let me know how to achieve this. I dont know much about Service Cloud.

Its very urgent, so a immediate response is very very helpful to me.  Thanks a lot.

 

--Jaya.

I have a javascript variable which gets the current app name.

 

var myappname = document.getElementById("tsidLabel").innerText;

 

I want this 'myappname' in my apex class. I am not going to make any action on my visualforce page. On my page load i am doing some functionalities.

 

Please help me out. I am new to salesforce.

I've looked around for a couple hours trying to figure this out but have been unable.  I am trying to pass a variable from javascript to my VF extension. The exact variable is 'sforce.console.isInConsole()' to determine if my users are accessing the page via the Console or not.  Below is the javascript I have included within my VF page:

 

<script type="text/javascript" >
    document.getElementById('{!$Component.Console}').value = sforce.console.isInConsole();
</script>

 

Below is the inputHidden field:

<apex:inputHidden id="Console" value="{!ConsoleVal}" />

 

Lastly, below is what I have included within my APEX class:

public String ConsoleVal {get; set;}

 

 

All resources I have found lead me to believe that this should work.  However, the ConsoleVal variable is null when I look at the debug logs, so there is a disconnect...  What am I missing?

Hi all

  I have created Visualforce page for PDF usage. I have listed some Rich text values from controller class like given below

<page  standardController="Shipment_Header__c">

<apex:outputText value="{!PackingSlipSignature}"/>

</page>

 

The 'packingSlipSignature'  Return some company address from controller class. This i want dispaly one by one but this  display as given below

CompanyName<br> RK Salai<br> chennai<br> <br>

 

What can i do for this.

Hi,

I've got a VF page in my service cloud that has a number of links in it. 

 

Can someone help me - when i click on the links they just stay in the same tab, is there a way that when the link is clicked it brings up the item in a new tab?

 

this is the current code i use on the link

 

<apex:outputLink value="/{!contact.id}">{!contact.account.name}</apex:outputLink>

 

I am trying to implement the service console and am stuck on a button issue.

 

Currently  I have a custom "New Case" button that displays within a contact.  It uses javascript to auto-pop some fields based on user settings

Ex:

window.parent.location.href ="%2F500%2Fe?00N800000034wTE={!$User.Language_Support__c}&cas3_lkid={!Contact.Id}&00N80000003MDbe={!$User.Default_Country_cases__c}&retURL=%2F500%2Fo";

 

In testing within the console, this will load the case creation form outside the console.  To get around this, I am using the following code (some hard coding in place right now to eliminate variables):

 

{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")} 
if (typeof(srcUp) == 'function') 
{
} else {    
     window.parent.location.href ="%2F500%2Fe?00N800000034wTE={!$User.Language_Support__c}&cas3_lkid={!Contact.Id}&00N80000003MDbe={!$User.Default_Country_cases__c}&retURL=%2F500%2Fo";
}
Now the behavior is working in console (as well as if not in console), however I believe that because the button originates from a "Contact" page, that somehow the controller class is not changing to a case controller.  Even though the main page is laid out correctly, I am not getting the Knowledge or other side bars that should be there (getting contact one still).
Any suggestions on how to fix this, or a more elegant way of doing this would be appreciated.  The built in "New Case" works fine, but I need to pass some $user parameters into case fields during submission, all while remaining within console.

 

Hi Friends

 

I have attached the  Visual force Snippet in one custom object. The  Visual force snippet information will stored in one object. This object  have master detailed relationship with  above object. 

 
If I click the save button in the visual force snippet , the information will saved into the child object. After refresh the page manually  I can see the child object information. some information will update into parent object.  I would like to refresh the whole page when click the save button in the Visual force snippet. please any one Suggest me to resolve this requirement 
 

 

Thanks

Sundar