• Priyasoft
  • NEWBIE
  • 30 Points
  • Member since 2009

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 10
    Replies

I am working on a Lead Request system.

Every user has a Lead Center record from which they can manage all their leads and submit Lead Requests.

Each user is only responsible for some set of states.

 

I am trying to make the process of finding the leads for a given request automatic

In the code below I pass in the Lead Request ID as a parameter using a button.

Using the Lead Request ID I then run a query to find the Lead Request Record.

 

On the Lead Request Record there is a text field which lists all the states that a given user is responsible for.

In the findLeads() function below I am trying to run a query on Consumer_Leads__c to find the requested number of leads 

that are in the states listed on the Lead Request.

 

My code work if there is only one state listed.

The IN Clause works in such a way that the parameters need to be single quoted and comma separated

 

If there is only one state listed then the string looks like 'FL' which is in the proper syntax

The problem occurs when there are multiple states listed, the string the looks like 'FL,CT,TX' which is incorrect format

For the IN Clause to accep the input it would have to be 'FL','CT','TX'

 

I would really appriciate if someone could help me figure out how to convert the text field listing the states into the proper format that the IN Clause would accept.

 

This is the code I have so far, Currently it only works if there is only one state listed in the Territory__c text field on the Lead Request

 

public class MyLeadsController {

    public List<Consumer_Leads__c> allLeads {get; set;}
    public String leadRequestID {get; set;}
    public Integer numLeads {get; set;}
    
    public MyLeadsController(ApexPages.StandardController controller) {
    
        leadRequestID = ApexPages.currentPage().getParameters().get('lc');
        
    }
    
    public void findLeads(){
        Lead_Request__c leadRequest = [select id, Number_of_Leads_Requested__c, Territory__c, Lead_Center__c
                                    from Lead_Request__c
                                    where id =: leadRequestID];
        
        allLeads = [select Lead_Center__c, Lead_Request_NEW__c, First_Name__c, Last_Name__c, State__c, City__c, ZIP_Code__C, Lead_Source__c, CreatedDate
                    from Consumer_Leads__c
                    where Lead_Center__c = 'a19Q0000001OaRM' AND State__c IN (:leadRequest.Territory__c)
                    limit :(Integer)leadRequest.Number_of_Leads_Requested__c];
                    
       numLeads = allLeads.size();
    }
}

 

Hi,

 

I am trying to upload a managed package from Developer Org  but I am getting an error (see below). Any idea what could be the solution?

 

 

Upload Failed
An unexpected error occurred when uploading your package. Please contact Salesforce Support and provide the following error code: 987559111-150056 (-1335788226)

 

 

I am getting exception while trying to retrieve object details from Salesforce by passing mutilpe email IDs in search call query.

 

I tried with below two ways:

 

First try: binding.search("find {\"dummy1@priyanet.com\", \"dummy2@priyanet.com\" , \"dummy3@pryanet.com\"} in email fields returning contact(id, firstname, lastname),lead(id, firstname, lastname)";

 

Second try: binding.search("find {dummy1@priyanet.com, dummy2@priyanet.com, dummy3@pryanet.com} in email fields returning contact(id, firstname, lastname),lead(id, firstname, lastname)";

 

Is there any other way to get result. Please help me out.Its urgent.

I apprecialte if you provide any soulution.

I am getting exception while trying to retrieve object details from Salesforce by passing mutilpe email IDs in search call query.

 

I tried with below two ways:

 

First try: binding.search("find {\"dummy1@priyanet.com\", \"dummy2@priyanet.com\" , \"dummy3@pryanet.com\"} in email fields returning contact(id, firstname, lastname),lead(id, firstname, lastname)");

 

Second try: binding.search("find {dummy1@priyanet.com, dummy2@priyanet.com, dummy3@pryanet.com} in email fields returning contact(id, firstname, lastname),lead(id, firstname, lastname)");

 

Is there any other way to get result. Please help me out.Its urgent.

I apprecialte if you provide any soulution.

Hi All,

I get this error all the time when I try to create an 'ApexClass' from one apex class using metadata:
Web service callout failed: WebService returned a SOAP Fault: INVALID_TYPE: This type of object is not available for this organization faultcode=sf:INVALID_TYPE faultactor=

The code is similar than create an 'ApexPage', although 'ApexPage' works.
So could you help me with this?

Code to create 'ApexClass':
public PageReference mCreateApexClass(){
  MetadataService.MetadataPort service = createService();    
     MetadataService.ApexClass lvApexClass = new MetadataService.ApexClass();
     lvApexClass.apiVersion = 29;
     lvApexClass.fullName = myApexClassName;
     lvApexClass.status = 'Active';
     
     lvApexClass.content = EncodingUtil.base64Encode(Blob.valueOf(myApexClassContentAsString));
     MetadataService.AsyncResult[] results = service.create(new List<MetadataService.Metadata> { lvApexClass });
     result = results[0];
     displayStatus();
     return null;
}

 

Thanks in advance.

Hi,

 

I am trying to upload a managed package from Developer Org  but I am getting an error (see below). Any idea what could be the solution?

 

 

Upload Failed
An unexpected error occurred when uploading your package. Please contact Salesforce Support and provide the following error code: 987559111-150056 (-1335788226)

 

 

Hi,

i have following SOQL query using in apex class,it is working fine for all profiles except one profile. When I run the following SOQL query in workbench with user login who has problematic profile,it is returning result . Same SOQL query is not returning results in apex class for this user. i am not using with sharing key word to class,it runs system mode.

Is there any specific profile permission to set? If you any idea please help me on this issue.

SOQL query:

[select id,name from user where (name='Pending Assignment 01' OR name='Pending Assignment 02' OR name='Pending Assignment 03' OR name='Pending Assignment 04') ORDER By Name ASC

 

Thanks

Praveen

Hi,

 

I am a newbie Iknow nothing.. I am completely dumb.. The guy who knows nothing.

 

I have a Json which I got as a reply when I made a callout This JSON contains the access_token how can I write the code so as to store the value of this access_token in a string and so that I could move on.. Any Help here?

 

 

Regards

  • September 06, 2013
  • Like
  • 0

Hi,

 

I have enabled the customer portal and configured it.

 

I also created the trigger which sends the notification when the case is created either via email or customer portal.

 

The following is my trigger code,

trigger mailNotification on Case ( after insert) {
    contact CaseContact;
    
    for(case Cases :trigger.new){
                    //Fetch the related case contact.
                
          Messaging.SingleEmailMessage CaseNotificationmail = new Messaging.SingleEmailMessage

(); 
          if (CaseContact!= null){ 
          CaseContact = [SELECT Email FROM Contact WHERE Id = :Cases.ContactId];                 

 
                if (CaseContact != null && CaseContact.Email != null) {
    CaseNotificationmail.setToAddresses(new List<string> {CaseContact.Email});
    } }
    else {
    CaseNotificationmail.setToAddresses(new List<string> {Cases.SuppliedEmail});
    }
    CaseNotificationmail.setReplyTo('createcases@i-

1byw7u3dtfg21ai2tii0rpnf6q345ovsuuelzkgmta35336rgt.9-mqfdeae.9.apex.salesforce.com');
    CaseNotificationmail.setSenderDisplayName('Salesforce Support');
    CaseNotificationmail.setSubject('New Case Created : ' + Cases.CaseNumber);
    CaseNotificationmail.setPlainTextBody('Your case:<b> ' + Cases.CaseNumber +' has been 

created.'+'To view your case <a href=https://na1.salesforce.com/'+case.Id);
    Messaging.sendEmail(new Messaging.SingleEmailMessage[] { CaseNotificationmail });
 }  
}

 

 

When I used this trigger, I cant create the new case by customer portal.

 

It shows the following error

"

Error: Invalid Data.

Review all error messages below to correct your data.
Apex trigger mailNotification caused an unexpected exception, contact your administrator: mailNotification: execution of AfterInsert caused by: System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS, Invalid to address : null: []: Trigger.mailNotification: line 20, column 1"

 

If i am using workflow rules , I will not include the sepecified address for reply.

 


Can anybody help to solve this problem?

 

Regards.,

Ambiga

 

Hi,

 

I need to convert a comma seperated string, say 34,987 into a number 34987. How do I remove the comma in an apex class?

I am working on a Lead Request system.

Every user has a Lead Center record from which they can manage all their leads and submit Lead Requests.

Each user is only responsible for some set of states.

 

I am trying to make the process of finding the leads for a given request automatic

In the code below I pass in the Lead Request ID as a parameter using a button.

Using the Lead Request ID I then run a query to find the Lead Request Record.

 

On the Lead Request Record there is a text field which lists all the states that a given user is responsible for.

In the findLeads() function below I am trying to run a query on Consumer_Leads__c to find the requested number of leads 

that are in the states listed on the Lead Request.

 

My code work if there is only one state listed.

The IN Clause works in such a way that the parameters need to be single quoted and comma separated

 

If there is only one state listed then the string looks like 'FL' which is in the proper syntax

The problem occurs when there are multiple states listed, the string the looks like 'FL,CT,TX' which is incorrect format

For the IN Clause to accep the input it would have to be 'FL','CT','TX'

 

I would really appriciate if someone could help me figure out how to convert the text field listing the states into the proper format that the IN Clause would accept.

 

This is the code I have so far, Currently it only works if there is only one state listed in the Territory__c text field on the Lead Request

 

public class MyLeadsController {

    public List<Consumer_Leads__c> allLeads {get; set;}
    public String leadRequestID {get; set;}
    public Integer numLeads {get; set;}
    
    public MyLeadsController(ApexPages.StandardController controller) {
    
        leadRequestID = ApexPages.currentPage().getParameters().get('lc');
        
    }
    
    public void findLeads(){
        Lead_Request__c leadRequest = [select id, Number_of_Leads_Requested__c, Territory__c, Lead_Center__c
                                    from Lead_Request__c
                                    where id =: leadRequestID];
        
        allLeads = [select Lead_Center__c, Lead_Request_NEW__c, First_Name__c, Last_Name__c, State__c, City__c, ZIP_Code__C, Lead_Source__c, CreatedDate
                    from Consumer_Leads__c
                    where Lead_Center__c = 'a19Q0000001OaRM' AND State__c IN (:leadRequest.Territory__c)
                    limit :(Integer)leadRequest.Number_of_Leads_Requested__c];
                    
       numLeads = allLeads.size();
    }
}

 

Hi all,

   i want to insert the record through vf page. and in that page didnt display account name.But in the back end field of account name i want to store the inserted account id as value in that account name field.Any one can you please help me.

 

 

Thanks in advance.

I am getting exception while trying to retrieve object details from Salesforce by passing mutilpe email IDs in search call query.

 

I tried with below two ways:

 

First try: binding.search("find {\"dummy1@priyanet.com\", \"dummy2@priyanet.com\" , \"dummy3@pryanet.com\"} in email fields returning contact(id, firstname, lastname),lead(id, firstname, lastname)";

 

Second try: binding.search("find {dummy1@priyanet.com, dummy2@priyanet.com, dummy3@pryanet.com} in email fields returning contact(id, firstname, lastname),lead(id, firstname, lastname)";

 

Is there any other way to get result. Please help me out.Its urgent.

I apprecialte if you provide any soulution.