• Gunish
  • NEWBIE
  • 120 Points
  • Member since 2010

  • Chatter
    Feed
  • 4
    Best Answers
  • 2
    Likes Received
  • 1
    Likes Given
  • 6
    Questions
  • 37
    Replies

Hi Friends,

 

I have a requirement to write the following Trigger.

 

Trigger MyTrg on contact (Before insert){

 

            for (contact c : Trigger.new){

 

               list<account> lst = [Select Id,Name From Account];

   }

          

}

 

But as the SOQL query is inside the FOR loop,it hits the Governor Limit.

 

How to avoid it in a meaningful way.

 

Thanks in Advance,

 

Vijay

In the highlighted query below.  The result only returns 1 of 2 records.  Any help into how to resolve this.  There does exist 2 opportunities in this contact.  Thanks in Advance.

 

 

public OfferStatusChangeFlowHelper (List <Offer__c> triggerNew) {

if (triggerNew != null)
this.triggerNew = triggerNew;

//get opps and con ids
for (Offer__c offer : triggerNew) {
contactIds.add(offer.Candidate_Name__c);
oppIds.add (offer.opportunity__c);
}

for (Offer__c o:[SELECT Id, Name, Offer_Status__c, Candidate_Name__c FROM Offer__c WHERE Candidate_Name__c IN :contactIds
AND (Offer_Status__c = 'Offer Accepted' OR Offer_Status__c = 'Offer Extended') ]) {
//check map for contact id
if (contactOffersMap.get(o.Candidate_Name__c)==null) {//no entry yet
contactOffersMap.put (o.Candidate_Name__c, new List <Offer__c> {o});
} else {//otherwise get list of opps and add a new one
contactOffersMap.get(o.Candidate_Name__c).add(o);
}
}

for (Opportunity o:[SELECT Id, Name, StageName, Contact__c FROM Opportunity WHERE Id IN :oppIds AND isClosed = false]) {// comment out to test bring back open and closed for first part of step 9.
System.debug('OPPORTUNITY IDS: ' + oppIds);
//for (Opportunity o:[SELECT Id, Name, StageName, Contact__c FROM Opportunity WHERE Id IN :oppIds]) {
//check map for contact id
if (oppMap.get(o.Contact__c)==null) {//no entry yet
oppMap.put (o.Contact__c, new List <Opportunity> {o});
} else {//otherwise get list of opps and add a new one
oppMap.get(o.Contact__c).add(o);
}
}
}

  • October 17, 2013
  • Like
  • 0

Hi,

 

I am attempting to load contacts data in SF and am i getting the following issue from data loader:

 

CSV Error: Invalid CSV file format. Please select a different file.
com.sforce.async.CSVReader$CSVParseException: Not expecting more text after end quote.

 

What does that mean exactly?

 

Thanks!

  • October 15, 2013
  • Like
  • 0

I've inherited a large Apex project, 10s of KLOC. I don't think any UML diagrams for this exist. For my own clear understanding of what's happening in this code I am looking for an Eclipse plugin (preferably FREE) that supports generating UML from my Apex code. Any suggestions? Have you tried any of the similar plugins for Java RE? Were they accurate? Thanks.

 

--Boman.

  • February 18, 2010
  • Like
  • 0
I am aware that this might no longer be possible because of clickjacking being disabled by default.
I want to know if there is a workaround for this at the moment ?

Currenrlt I see a blank page with the following code.
 
<apex:page showHeader="true" sidebar="true" standardController="Lead">
		<apex:iframe src="/lead/leadmergewizard.jsp?goNext=+Next+&id=00Q7E000000xkIV&cid=00Q7E000000xkHw&cid=00Q7E000000xkIV&isdtp=vw" scrolling="true" id="theIframe"/>
</apex:page>

Appriciate any help with this!

Thanks!
 
  • January 12, 2016
  • Like
  • 0
I would like to re-rder recent object order, which is account, contact, etc. to custom objects. Is this possible at all ?
  • January 31, 2014
  • Like
  • 1

Can anyone recommend a Bootstrap based Datepicker which works with Visualforce ?

I have tried my hand at a few options but none of them seem to work properly!

 

 

  • November 28, 2013
  • Like
  • 0

Hi All

I am trying to deploy an entitlement process using Eclispe / The Migration Tool, and I keep getting this error message. 

 

Error: The Entitlement Process start date field must be date/time type and belong to Case.

 

I dont see a start date option in the metadata and there is no place to set it in salesforce. Can someone share there experience deploying these ?

 

-Gunish

  • October 25, 2013
  • Like
  • 0

Hello,

 

I have been looking for a way to access the setup audit trail programatically, using apex or webservice api. But without any luck. 

Is there a way to achieve this.. 

 

Maybe by using some URL Tricks ?

 

The basic requirement is to get a list of all the actions performed by a user in a given time (as displayed in the setup audit trail). It would be great if I could simply query that from some Table ?

 

Any Ideas , Leads, Comments please.

 

 

  • September 14, 2011
  • Like
  • 1

Hello,

 

I am trying to Implement the Email to Case functionality. It seems to work fine, apart from when i send emails without a subject line. 

It does not create a case, in this situation. 

Is there something within Salesforce which blocks this? Or  Should i be looking someplace else ?

 

Thanks for everyones help in advance!

 

  • February 19, 2010
  • Like
  • 0
I would like to re-rder recent object order, which is account, contact, etc. to custom objects. Is this possible at all ?
  • January 31, 2014
  • Like
  • 1

Hello,

 

I have been looking for a way to access the setup audit trail programatically, using apex or webservice api. But without any luck. 

Is there a way to achieve this.. 

 

Maybe by using some URL Tricks ?

 

The basic requirement is to get a list of all the actions performed by a user in a given time (as displayed in the setup audit trail). It would be great if I could simply query that from some Table ?

 

Any Ideas , Leads, Comments please.

 

 

  • September 14, 2011
  • Like
  • 1
I am aware that this might no longer be possible because of clickjacking being disabled by default.
I want to know if there is a workaround for this at the moment ?

Currenrlt I see a blank page with the following code.
 
<apex:page showHeader="true" sidebar="true" standardController="Lead">
		<apex:iframe src="/lead/leadmergewizard.jsp?goNext=+Next+&id=00Q7E000000xkIV&cid=00Q7E000000xkHw&cid=00Q7E000000xkIV&isdtp=vw" scrolling="true" id="theIframe"/>
</apex:page>

Appriciate any help with this!

Thanks!
 
  • January 12, 2016
  • Like
  • 0

I gave a .Net desktop application that can successfully authenticate using either the web-server oAuth authentication flow or the username password oAuth flow and I have it working using SAML in a Federated SSO environment.

I now have to get it working in a Delegated SSO environement. I can obtain a token from the client's token generator. But it is not clear how I can sign in and exchange that for the token that I need to use in the REST API calls. 
Anyone know how to do this?

Hi All

I am trying to deploy an entitlement process using Eclispe / The Migration Tool, and I keep getting this error message. 

 

Error: The Entitlement Process start date field must be date/time type and belong to Case.

 

I dont see a start date option in the metadata and there is no place to set it in salesforce. Can someone share there experience deploying these ?

 

-Gunish

  • October 25, 2013
  • Like
  • 0

 

Just had a call from a client and think we've found found an interesting bug and wondered if anyone else has had the same issue before and if I'm on the right track...

 

Sometimes code coverage on classes would show Zero when actually they have tests against them after a lot of fiddling the issue seems to be because the test class and the code class were assigned to different versions after matching up the versions the code coverage %age then appears.

 

Anyone else have had the same issue?

 

  • October 18, 2013
  • Like
  • 0

Hi

 

I  have created custom field on Account of Lookup(User) Type.  now i want to write workflow rule and in rule i want to create task which will be assigned to account manager. but when i assign task then only Users, role and Account Owner show.  how is it Possible?

Hi,

 

I have a situation here. I have a custom object lets say SAAS_Profile__c. It has 2 text fields that contain queries like :

 

Query_Total_Records__c  : Select Count() FROM Case where RecordTypeID='012a0000001RRKBAA4' 

 

Query_Records_Per_Week__c : Select Count() FROM Case where RecordTypeID='012a0000001RRKBAA4'  and CreatedDate = LAST_N_DAYS:7

 

Now my requirement is I have to get all the rows of   SAAS_Profile__c object(total rows less than 100). And for each row returned I have to execute these 2 queries and update 2 fields : Records_pWeek__c(for weekly counts) and Records_Total__c (Total record count). These 2 fields are for statistics purposes and we intend to run this batch job on a weekly basis. Each row of this SAAS_Profile__c object queries on different objects both custom and standard . Here is the batch job that I have written:

 

global class batchSAASProfileUpdate implements Database.Batchable<sObject>
{
global Database.QueryLocator start(Database.BatchableContext BC)
{
String query = 'SELECT Id,Name,Query_Records_Per_Week__c,Query_Total_Records__c,Records_pWeek__c,Records_Total__c FROM SAAS_Profile__c where Query_Records_Per_Week__c !=\'\' and Query_Total_Records__c != \'\') ';
system.debug('Query String : '+query);
return Database.getQueryLocator(query);
}

global void execute(Database.BatchableContext BC, List<SAAS_Profile__c> scope)
{
system.debug('******************Inside execute');
for(SAAS_Profile__c s : scope){
String queryPerWeek = s.Query_Records_Per_Week__c;
String queryTotalRec = s.Query_Total_Records__c;
system.debug('****************name :'+ s.name +'values : queryPerWeek :'+queryPerWeek +' queryTotalRec '+queryTotalRec );
try{
s.Records_pWeek__c = Database.countQuery(queryPerWeek);
s.Records_Total__c = Database.countQuery(queryTotalRec);
system.debug('****************values : s.Records_pWeek__c :'+s.Records_pWeek__c+' s.Records_Total__c '+s.Records_Total__c );
update s;
}
catch(Exception e){
system.debug('********Exception occured' + e.getMessage());
}
}

}
global void finish(Database.BatchableContext BC)
{
}
}

 

This batch job is working for the records that have total count values < 50,000. Its failing for the count() more than that. I am stuck here. I dont know how to work around this issue. Any help is really appreciated. This is really critical for us now!

 

 

Hi Friends,

 

I have a requirement to write the following Trigger.

 

Trigger MyTrg on contact (Before insert){

 

            for (contact c : Trigger.new){

 

               list<account> lst = [Select Id,Name From Account];

   }

          

}

 

But as the SOQL query is inside the FOR loop,it hits the Governor Limit.

 

How to avoid it in a meaningful way.

 

Thanks in Advance,

 

Vijay

Hello,

Given an object ID is there a way to get its fields info without using SOQL? See example below:

 

I have an aid = accountID given below

 

instead of writing

select id, parentId, name, Type from Account where Id =: aid

 

can I write something like below

 

string sname;

string stype;

 

sname = aid.name;

stype = aid.type;

 

basically it is similar to below statements and it works when I write a trigger like this one below.

Case CaseUpdated:trigger.new

GroupNo = CaseUpdated.Group__c;

 

Please advise

Paul

 

  • October 17, 2013
  • Like
  • 0

I have some problem with search in salesforce.
One of our custom objects has lookup to user, when Im trying search for this object by user name - I dont get this object.
So question is : is it possible to search all object field based on value in lookup field/user name in standard salesforce search (not in the code)?

In the highlighted query below.  The result only returns 1 of 2 records.  Any help into how to resolve this.  There does exist 2 opportunities in this contact.  Thanks in Advance.

 

 

public OfferStatusChangeFlowHelper (List <Offer__c> triggerNew) {

if (triggerNew != null)
this.triggerNew = triggerNew;

//get opps and con ids
for (Offer__c offer : triggerNew) {
contactIds.add(offer.Candidate_Name__c);
oppIds.add (offer.opportunity__c);
}

for (Offer__c o:[SELECT Id, Name, Offer_Status__c, Candidate_Name__c FROM Offer__c WHERE Candidate_Name__c IN :contactIds
AND (Offer_Status__c = 'Offer Accepted' OR Offer_Status__c = 'Offer Extended') ]) {
//check map for contact id
if (contactOffersMap.get(o.Candidate_Name__c)==null) {//no entry yet
contactOffersMap.put (o.Candidate_Name__c, new List <Offer__c> {o});
} else {//otherwise get list of opps and add a new one
contactOffersMap.get(o.Candidate_Name__c).add(o);
}
}

for (Opportunity o:[SELECT Id, Name, StageName, Contact__c FROM Opportunity WHERE Id IN :oppIds AND isClosed = false]) {// comment out to test bring back open and closed for first part of step 9.
System.debug('OPPORTUNITY IDS: ' + oppIds);
//for (Opportunity o:[SELECT Id, Name, StageName, Contact__c FROM Opportunity WHERE Id IN :oppIds]) {
//check map for contact id
if (oppMap.get(o.Contact__c)==null) {//no entry yet
oppMap.put (o.Contact__c, new List <Opportunity> {o});
} else {//otherwise get list of opps and add a new one
oppMap.get(o.Contact__c).add(o);
}
}
}

  • October 17, 2013
  • Like
  • 0

I'm getting a weird issue with this bit of code. It's a visualforce controller, and on the visualforce page I have fields to insert/update 2 contact records. At the end I want one of the contact records, to be populated in a contact lookup on the 2nd contact page.

 

Here is the code:

public with sharing class ReferralFormController {
    Contact referrer;
    Contact candidate;
    List<SelectOption> referreroptions;
    
    public ReferralFormController() {
    // blank constructor
    }
    
    // the contact record you are adding values to
    public Contact getReferrer() {
        Id id = ApexPages.currentPage().getParameters().get('id');
        referrer = (id == null) ? new Contact() :
            [SELECT FirstName, LastName, Title, Personal_Email__c, Work_Email__c FROM Contact WHERE Id = :id];
        return referrer;    
    }
    public Contact getCandidate() {
        if(candidate == null) candidate = new Contact();
        return candidate;    
    }

    // save button is clicked
    public PageReference save() {
        try {
            Contact existingref = New Contact();
                for(Contact refchecker : [Select ID, FirstName, LastName, Title, Personal_Email__c, Work_Email__c
                                          From Contact
                                          Where Work_Email__c = :referrer.Work_Email__c OR
                                                Personal_Email__c = :referrer.Personal_Email__c OR
                                                (FirstName = :referrer.FirstName AND LastName = :referrer.LastName)
                                          LIMIT 1]){
                    existingref = refchecker;
                }
                if(existingref.Id != Null){
                    existingref.Title = 'Referrer Found!';
                update existingref;
                }
                if(existingref.Id == Null){
                    referrer.AccountId = '001L000000GFQip'; //change this when deploying to production!
                insert referrer;
                }
            Contact existingcan = New Contact();
            system.debug('CanFirstName =' + candidate.FirstName + 'CanLastName =' +candidate.LastName);
                for(Contact canchecker : [Select ID, FirstName, LastName, Title, Personal_Email__c, Work_Email__c  
                                          From Contact
                                          Where Work_Email__c = :candidate.Work_Email__c OR
                                                Personal_Email__c = :candidate.Personal_Email__c OR
                                                (FirstName = :candidate.FirstName AND LastName = :candidate.LastName)
                                          LIMIT 1]){
                    existingcan = canchecker;
                }
                system.debug('existing can =' + existingcan);
                if(existingcan.Id != Null){
                    existingcan.Title = 'It works a last time!';
                    if(existingcan.Referral_1__c == Null && existingref.Id != Null){
                        existingcan.Referral_1__c = existingref.id;
                    }
                    if(existingcan.Referral_1__c == Null && existingref.Id == Null){
                        existingcan.Referral_1__c = referrer.id;
                    }
                    if(existingcan.Referral_1__c != Null && existingref.Id != Null){
                        existingcan.Referral_2__c = existingref.id;
                    }
                    if(existingcan.Referral_1__c != Null && existingref.Id == Null){
                        existingcan.Referral_2__c = referrer.id;
                    }
                update existingcan;
                }
                if(existingcan.Id == Null){
                    candidate.AccountId = '001L000000GFQip'; //change this when deploying to production!
                    if(existingcan.Referral_1__c == Null && existingref.Id != Null){
                        existingcan.Referral_1__c = existingref.id;
                    }
                    if(existingcan.Referral_1__c == Null && existingref.Id == Null){
                        existingcan.Referral_1__c = referrer.id;
                    }
                    if(existingcan.Referral_1__c != Null && existingref.Id != Null){
                        existingcan.Referral_2__c = existingref.id;
                    }
                    if(existingcan.Referral_1__c != Null && existingref.Id == Null){
                        existingcan.Referral_2__c = referrer.id;
                    }
                insert candidate;
                }
    } catch (DMLException e) {
      ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error creating new contact.'));
      return null;
    }
    // if successfully inserted new contact, then displays the thank you page.
    return Page.referralthankyou;
  }
}

 

Not sure how the code as it currently stands (though probably very inneffient, so advice on improving would be great) could have the possibility to have a record reference itself?

 

Any help would be MUCH appreciated!

I have to integrate CTI system with Salesforce. I have installed open CTI from following link.

http://wiki.developerforce.com/page/Open_CTI#Installing_The_Demo_Open_CTI_Adapter

 

Can anyone guide me How can I configure it with my CTI System? I have simple requirement. I have to open relative account page as a pop up when a call is reached at CTI System.Please help.

two pageblock table


1 is Account


2nd is contact


one save button


Add row and remove row button


1st pageblock  I added 3 Account and 2nd page block 6 contact ... 1st pageblock Account  1st fied called radio button .. if i select radio button and add contact in 2nd pageblcok table.. foreign key for Account is selected radio button..and click save button


3 diff Account  and 5 diff contact save


do u have any idea? how i pass Account value in contact in this scenario?

  • October 17, 2013
  • Like
  • 0

I heard a rumor that setup is moving to Dev Console.  Anyone thing it's true?

 

Please say it ain't so.

 

I really am not at all impressed with Dev Console.

 

First, javascript in a web browser is just not a robust architecture.  It's slow. It hangs.  I loses some of the regular old browser features.

 

Second, the best thing about SF it it is mostly just web pages retrieved with HTTP gets.  That makes it simple and reliable.  It lets you cut and paste links.  So  you want another developer to look at a field definition, just copy the URL.  You want the same window, a new tab, a new tab, just click or right-click and pick where you want the link target in to appear.

 

 

I gave a .Net desktop application that can successfully authenticate using either the web-server oAuth authentication flow or the username password oAuth flow and I have it working using SAML in a Federated SSO environment.

I now have to get it working in a Delegated SSO environement. I can obtain a token from the client's token generator. But it is not clear how I can sign in and exchange that for the token that I need to use in the REST API calls. 
Anyone know how to do this?