• Karthik P
  • NEWBIE
  • 60 Points
  • Member since 2014

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 18
    Replies
I need to get all of the leads that do not have "Demo" In the name of the opportunity it was converted to.

So I need to get all leads and, if they have been converted, check the name for "demo in it".  I.e. a left outer join on Leads to Opportunities

I have tried all the following without any luck in workbench:
  • Tried to Reference ConvertedOpportunityId__r.Name in the query i.e.: SELECT id, ConvertedOpportunityId FROM Lead where (Not ConvertedOpportunityId__r.Name like '%demo%') - this gives me a syntax error (Didn't understand relationship 'ConvertedOpportunityId__r' in field path)
Any help much appreciated.

 
I was tryng to do Catter Trailhead but I could not find Cat Treat in my Salesforce Developer Edition. Can anyone help me with this issue?
Hey All,

Is there any chance to undo or revert back the old layout from the new one in the production? Unfortunately, I have overridden the old page layout with the new one. I didn't took any backups for the layout from the production. Any help please!

Thank you all in advance!
I need to get all of the leads that do not have "Demo" In the name of the opportunity it was converted to.

So I need to get all leads and, if they have been converted, check the name for "demo in it".  I.e. a left outer join on Leads to Opportunities

I have tried all the following without any luck in workbench:
  • Tried to Reference ConvertedOpportunityId__r.Name in the query i.e.: SELECT id, ConvertedOpportunityId FROM Lead where (Not ConvertedOpportunityId__r.Name like '%demo%') - this gives me a syntax error (Didn't understand relationship 'ConvertedOpportunityId__r' in field path)
Any help much appreciated.

 

I posted this on the Stack Exchange but haven't got much of a response there (after bountying it too). I have the following query:
 

SELECT Column1__c, Column2__c, Column3__c, Column4__c, Column5__c, Column6__c FROM Table__c where Column5__c >= 2016-09-29
 



Columns1 and Column2 fail to return data for me. If I execute the same query in WorkBench it works fine so I think it must be a setting I'm missing. Column1 and Column2 are booleans. I'm using the PHP Tool Kit version 20.

API Code:
 

try {
    $salesforce = new SforceEnterpriseClient();
    $salesforce->createConnection('salesforce_connector/soapclient/enterprise.wsdl.xml');
    $salesforce->login('user', 'pass');
    $query = 'SELECT Column1__c, Column2__c, Column3__c, Column4__c, Column5__c, Column6__c
    FROM Table__c
    where Column3__c >= ' . date('Y-m-d');
    $options = new QueryOptions(2000);
    $salesforce->setQueryOptions($options);
    $response = $salesforce->query($query);
    die(print_r($response));
 



Response:

 

[1878] => SObject Object ( 
     [type] => 
     [fields] => 
     [Column3__c] => 2016-12-31 
     [Column4__c] => 0022000000abcHcAAI 
     [Column5__c] => 43892 
     [Column6__c] => 2013-06-01 
)
I was tryng to do Catter Trailhead but I could not find Cat Treat in my Salesforce Developer Edition. Can anyone help me with this issue?
We have a lead that has been converted to opportunity. We want to merge opportunity stage, back in the lead status field.

We are able to view the converted lead, and manually update the converted lead (salesforce settings allow this).

Now we're trying to update the lead "automatically" using the "process builder". The process builder needs to look at any updates to the opportunity-> stage field and based on that, update the corresponding lead (lead->status field). We have the lead ID stored in the opportunity for the lookup.

Somehow the process builder is not able to find the "converted lead", hence the update is failing.

In case this is not possible using "process builder", should we implement this use case using "apex code development"? appreicate any pointers you may have.
 
Hello Everyone ,

I am trying to write the test class i am getting the code coverage of 34 % i writing the first time the test class.The bold part of code is not getting covered
it would be great if you can help.
Visual force Page
<apex:page standardController="case" extensions="GlobalComplaintExt" tabStyle="Case" id="myPage" showHeader="False">
<!--<apex:pageMessages id="MsgId" ></apex:pageMessages>-->

<script>
function handleEnter (field, event) {
        var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
        if (keyCode == 13) {
            var i;
            for (i = 0; i < field.form.elements.length; i++)
                if (field == field.form.elements[i])
                    break;
            i = (i + 1) % field.form.elements.length;
            field.form.elements[i].focus();
            return false;
        }
        else
        return true;
    }      


</script>

<apex:form id="myForm">
           <apex:pageBlock id="block1" title="Complaint Details" >
        <apex:pageMessages id="MsgId" ></apex:pageMessages>
        <apex:outputPanel >
            <apex:pageBlockSection title="Complaint Details" collapsible="true" id="section1" columns="2">
               <apex:outputField value="{!com.Contact.Name}"/>
               <apex:outputField value="{!com.contact.AccountId}"/>
                     </apex:pageBlockSection>
         
         <!--Replacement / Order Section  -->    
            
      <apex:pageBlockSection title="Replacement/Order Section" collapsible="true"  >
            <apex:inputField value="{!com.Replacement_Product__c}"  onkeypress="return handleEnter(this, event)"/>
            <apex:inputField value="{!com.Credit__c}" onkeypress="return handleEnter(this, event)"/>
            <apex:inputField value="{!com.Replacement_Product_Quantity__c }" onkeypress="return handleEnter(this, event)" />
            <apex:inputField value="{!com.Credit_Note_Number__c}" onkeypress="return handleEnter(this, event)"/>
            <apex:inputField value="{!com.DE_Replacment_Unit_of_Measure__c}" onkeypress="return handleEnter(this, event)"/>
            <br></br>
            <apex:inputField value="{!com.Replacement_Order_Number__c}" onkeypress="return handleEnter(this, event)"/>
            <br></br>
            <apex:inputField value="{!com.Replacement_Lot_Number__c}" onkeypress="return handleEnter(this, event)"/>
             <br></br>
            <apex:inputField value="{!com.Replacement_Order__c}" onkeypress="return handleEnter(this, event)"/>
            
        </apex:pageBlockSection>

        
        <!--  Claims Handling Section -->
        
        <apex:pageBlockSection title="Claims Handling" collapsible="true"  id="section2">
            <apex:inputField value="{!com.Claim_for_Damages__c}" onkeypress="return handleEnter(this, event)"/>
            <apex:inputField value="{!com.Type_of_damage__c }" onkeypress="return handleEnter(this, event)"/>
            <apex:inputField value="{!com.DE_Period_of_record_keeping__c}"   id="otherTerm" onkeypress="return handleEnter(this, event)"/>
            <apex:inputField value="{!com.Apology_Letter__c }" onkeypress="return handleEnter(this, event)" />
            <apex:inputField value="{!com.Damage_Compensation_form_sent__c }" onkeypress="return handleEnter(this, event)"/>
            <apex:inputField value="{!com.Send_flowers__c }"   rendered="{!com.Country__c != "Denmark"}" id="textpop" onkeypress="return handleEnter(this, event)" />
            <apex:inputField value="{!com.PM_informed__c}"     rendered="{!com.Country__c != "Denmark"}"  id="textpop1" onkeypress="return handleEnter(this, event)" />
       </apex:pageBlockSection>

    </apex:outputPanel>
                
    <apex:pageblockbuttons >
    <apex:commandbutton action="{!SaveItem}" value="Save As Draft" reRender="MsgId" />
    <apex:commandbutton action="{!cancel}" value="Cancel" />
     
   </apex:pageblockbuttons>
   </apex:pageBlock>
           
</apex:form>

</apex:page>

Apex Class

global class GlobalComplaintExt
{
        private List<String> fieldErrors = new List<String>();
        public final Contact ContactName;
        private string contactID = '';
        private string complaintID = '';
      
        public Account Acct {get;set;}
        public Product2 pro {get;set;}
        public Case com{get;set;}
        PageReference MainPage;
        public GlobalComplaintExt(ApexPages.StandardController controller)
        {
                Id uid = userInfo.getUserId();
                User u = [select Id,User_Country_Location__c  from user where Id =: uid];
                com = (case)controller.getRecord();
                con = [select Id, Name,AccountId from Contact where id = :ApexPages.currentPage().getParameters().get('conId')];     
                if(con != null)
                com.contact = con;    
                if(u!=null)
                com.country__c = u.User_Country_Location__c;
        }
        public pageReference SaveItem()
        {
                    Country_code=com.Country__c;
                    Product_code=com.Entered_Product__c;
                    Country_code=com.Country__c;
                    system.debug('County_code120'+Country_code);
                    Product_code=com.Entered_Product__c;
                    system.debug('Prodcut_code125'+Product_code);
                    List<Product2> Product_codeList=[Select Id,Name,Country__c from Product2 where Name=:Product_code and Country__c=:Country_code LIMIT 1];
                    Map<string,Country_Customers__c> CountryCodes = Country_Customers__c.getAll();
                    List<Country_Customers__c> ListCountyCodes= new List<Country_Customers__c>();
                    ListCountyCodes=[Select Country_Code__c,Country__c,Cust_Number__c,Distribution_Channel__c,Division__c,Sales_Org__c from Country_Customers__c where Country_Code__c =:Country_code LIMIT 1];
                    
                    if(Product_codeList.size()>0 && Product_codeList!=null )
                       {
                            case CaseInsert = new Case();
                            CaseInsert.Product__c=Product_codeList[0].Id;
                            system.debug('CaseInsert.Product__cId142---------------'+Product_codeList[0].Id);
                            CaseInsert.Entered_Product__c=com.Entered_Product__c;
                            CaseInsert.country__c=Product_codeList[0].country__c;
                            CaseInsert.Voice_of_Customer__c=com.Voice_of_Customer__c;
                            CaseInsert.Complaint_Code__c=com.Complaint_Code__c;
                            CaseInsert.Problem_Damage_Code__c=com.Problem_Damage_Code__c;
                            CaseInsert.Samples_to_be_Sent__c=com.Samples_to_be_Sent__c;
                            CaseInsert.Replacement_Product__c=com.Replacement_Product__c;
                            CaseInsert.Replacement_Product_Quantity__c=com.Replacement_Product_Quantity__c;
                            CaseInsert.DE_Replacment_Unit_of_Measure__c=com.DE_Replacment_Unit_of_Measure__c;
                            CaseInsert.Credit__c=com.Credit__c;
                            CaseInsert.Credit_Note_Number__c=com.Credit_Note_Number__c;
                            CaseInsert.Replacement_Order__c=com.Replacement_Order__c;
                            Caseinsert.ContactId=con.id;
                            //Caseinsert.Product__c=com.Entered_Product__c;
                            CaseInsert.Replacement_Order_Number__c=com.Replacement_Order_Number__c;
                            CaseInsert.Replacement_Lot_Number__c=com.Replacement_Lot_Number__c;
                         
                            CaseInsert.Complaint_Lot2__c =com.Complaint_Lot__c;
                            CaseInsert.Complaint_Lot3__c =com.Complaint_Lot3__c;
                            CaseInsert.Complaint_Lot_Unknown__c=com.Complaint_Lot_Unknown__c;
                            CaseInsert.Normal_Usage__c=com.Normal_Usage__c;
                            CaseInsert.Actual_Usage__c=com.Actual_Usage__c;
                            
                            if(ListCountyCodes.size() > 0) {
                           
                            CaseInsert.GCS_Distribution_Channel__c=ListCountyCodes[0].Distribution_Channel__c;
                            CaseInsert.GCS_Sales_Org__c=ListCountyCodes[0].Sales_Org__c;
                            CaseInsert.GCS_Customer_Number__c=ListCountyCodes[0].Cust_Number__c;
                            CaseInsert.GCS_Divsion__c=ListCountyCodes[0].Division__c
;
                            }
                            try{
                            Country_Customers__c c = Country_Customers__c.getInstance(Country_code);
                            if(c != null){
                                CaseInsert.GCS_Customer_Number__c= c.Cust_Number__c;
                                CaseInsert.Sales_Org__c = c.Sales_Org__c;
                                CaseInsert.Distribution_Channel__c = c.Distribution_Channel__c;
                                CaseInsert.Division__c = c.Division__c;
                            }
                            insert CaseInsert;
                            pageReference p = new PageReference('/'+CaseInsert.Id);
                            p.setRedirect(true);
                            //system.debug('MainPageaftercaseinsert======'+MainPage);
                            return  p;
                            }
                            catch(Exception e){
                           // ApexPages.addMessage(new ApexPages.message(ApexPages.severity.Error,e));
                            return null;

                            }
                    }
                    else if(Product_codeList.size()==0 )
                    {
                            system.debug('Line179');
                                ApexPages.addMessage(new ApexPages.message(ApexPages.severity.Error,'Product Entered is not avaliable for Country  '+Country_code+' '));
                            return null;
                    }
                    return null;
        }

      
}

Test Class

@isTest(SeeallData=true)
public class GlobalComplaintExtTest {
    public Case com{get;set;}
    static testMethod void UnitTest(){
        test.startTest();
       Account Test_Account= new Account(Name='TestAccount',Account_Type__c='ABC',Category__c='ABC');
       insert Test_Account;
       String Accountids;
       String ContactIds;
       List<Account> AccountQuery= new List<Account>();
       AccountQuery=[Select Id ,Name from Account Where Id =:Test_Account.Id];
       for(Account AccountList:AccountQuery)
       {
          Accountids= AccountList.id;
       }
       Contact Test_Contact= new Contact(LastName='ABC',firstName='ABC',Accountid=Accountids,Status__c='ABC',Sample_Shipping_City__c='ABC',Sample_Shipping_Street__c='ABC',
                                        Sample_Shipping_Zip_Postal_Code__c='60543',Sample_Shipping_Country__c='US',Data_Protection_Authorization__c='US',Brand__c='ABC',
                                        Type_of_Consumer__c='ABC',Source__c='ABC',Source2__c='ABC');
        insert Test_Contact;
        List<Contact> ContactQuery=[Select Id,Name from Contact Where Id=:Test_Contact.Id];
        for(Contact Cnt:ContactQuery)
        {
            ContactIds=cnt.id;
        }
        Case Caseinsert = new Case(Origin='ABC',Complaint_Source__c='ABC',Status='ABC',Voice_of_Customer__c='ABC',Entered_Product__c='ABC',GCS_Customer_Number__c='2500',GCS_Distribution_Channel__c='12'
                                   ,GCS_Divsion__c='00',GCS_Sales_Org__c='61',ContactId=Test_Contact.Id,Country__c='US',Normal_Usage__c='1',Actual_Usage__c='2');
     
        String Product='ABC';
        String Country='US';
       List<case> accountPlans= new List<case>{};
       ApexPages.currentPage().getParameters().put('conId',Test_Contact.id);
       ApexPages.StandardController sc = new ApexPages.StandardController(Caseinsert);
       GlobalComplaintExt Global_Extension= new GlobalComplaintExt(sc);
        
        PageReference pageRef =Page.GlobalComplaint;
        pageRef.getParameters().put('id', String.valueOf(Caseinsert.Id));
        Test.setCurrentPage(pageRef);
        Product2 Test_Product= new Product2(Name='28125',country__c='AU');
        insert Test_Product;
        List<Product2> ProductQuery=[Select Id,Name,Country__c from Product2 Where NAME='28125' AND country__c='AU' LIMIT 1];
        system.debug('ProductQuery@@@@@@@'+ProductQuery.size());
        Global_Extension.SaveItem();
        if(ProductQuery.size()>0 && ProductQuery!=null )
          {
              Case InsertCases= new Case();
             //s   
              InsertCases.Product__c=ProductQuery[0].id;
             
                            InsertCases.Actual_Usage__c=com.Actual_Usage__c;
*/
              insert InsertCases;
         
        }else if(ProductQuery.size()==0){
            ApexPages.addMessage(new ApexPages.message(ApexPages.severity.Error,'Product Entered is not avaliable for Country  '+country+' '));
        }
        
            
        test.stopTest();
        
    
        
    }

}
 

Hi,

When I convert a lead, the standard lead fields Company and Website are automatically converted to the account fields Account Name and Account Website the way it is described in the following link https://help.salesforce.com/apex/HTViewHelpDoc?id=lead_conversion_mapping.htm&language=en.

I have a custom object with the same fields Company and Website but when converting to account the fields are not mapped to Account Name and Account Website. Please advise how exactly to map the custom object fields with the respective account fields the way it is done with the lead?

Hi all,

I am trying to display a line chart for Opportunity object fields- name,amount. I reffered an example. But am able to display only the data table and facing problem to display the line chart. Am even not getting any error.

Here is my code:-
--------------------------------

<apex:page controller="DynamicSalesChartController">
<apex:chart data="{!opportunities}" width="600" height="400">
     <apex:axis type="Category" position="left"   fields="Name"   title="Opportunities"/>
     <apex:axis type="Numeric"  position="bottom" fields="Amount" title="Amount"/>
     <apex:lineseries orientation="horizontal" axis="bottom" xField="Name" yField="Amount"/>
</apex:chart>
<apex:dataTable value="{!opportunities}" var="opportunity">
    <apex:column headerValue="Opportunity" value="{!opportunity.name}"/>
    <apex:column headerValue="Amount"      value="{!opportunity.amount}"/>
</apex:dataTable>    
</apex:page>


public class DynamicSalesChartController {
    
    // Get a set of Opportunities
    public ApexPages.StandardSetController setCon {
        get {
            if(setCon == null) {
                setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
                      [SELECT name, type, amount, closedate FROM Opportunity]));
                setCon.setPageSize(20);
            }
            return setCon;
        }
        set;
    }
    
    public List<Opportunity> getOpportunities() {
         return (List<Opportunity>) setCon.getRecords();
    }
}
I've learned something today about the following query:

Id sysAdminProfileId = [select Id from Profile where Name = 'System Administrator' limit 1].Id;

When this query is run as part of a trigger fired by a user whose language isn't English, the query doesn't return a result.  So how can I get a consistent result to this query no matter what language the user is set to?  I really don't want to hardcode in profile Id's.  I also don't want to put in a million "or" statements.

Thanks!!
Is there a way to determine if a user has Live Agent permissions?  I tried {!$User.USERPERMISSIONSLIVEAGENTUSER} which is what Data Loader returned, but it didn't work in the VF page.  Could not find it in the API doc for User either.  Thanks.

Hi ,

I am learning how to use visualforce. And I copy an example of visualforce developer guide.  And when I save to salesforce server from ecilpse, I meet this error message"Attribute taborderhint is not supported for <apex:inputField> when this component is a direct or indirect child of <apex:dataTable>". codes as below:

<apex:page controller="OppsController">
<apex:form>
<apex:dataTable value="{!OpportunitiesWithIndex}" var="oppWrapped">
<apex:column>
<apex:facet name="header">Opportunity</apex:facet>
<apex:outputField value="{!oppWrapped.opp.name}"/>
</apex:column>
<apex:column>
<apex:facet name="header">Amount</apex:facet>
<apex:inputField value="{!oppWrapped.opp.amount}"
taborderhint="{!oppWrapped.tabIndex}"/>
</apex:column>
</apex:dataTable>
</apex:form>
</apex:page>

 

 

apex:

public class OppsController {
// Get a set of Opportunities
public ApexPages.StandardSetController setCon {
get {
if(setCon == null) {
setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
[SELECT name, type, amount, closedate FROM Opportunity]));
setCon.setPageSize(5);
}
return setCon;
}
set;
}
public List<Opportunity> getOpportunities() {
return (List<Opportunity>) setCon.getRecords();
}
public List<OppWrapper> getOpportunitiesWithIndex() {
List<Opportunity> opps = this.getOpportunities();
List<OppWrapper> oppsWrapped = new List<OppWrapper>();
Integer idex = 1;
for (Opportunity opp : opps) {
oppsWrapped.add(new OppWrapper(opp, idex));
idex++;
}
return oppsWrapped;
}

 

 

 

When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.  

 

That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it. 

When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.  

 

That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it.