• laks
  • SMARTIE
  • 770 Points
  • Member since 2010

  • Chatter
    Feed
  • 25
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 17
    Questions
  • 194
    Replies
Hello,
Please help me, how do I call below class from the anonymous window. I am not finding a way to pass IDs as parameter.
I want pass record Ids of Account for example this 0010I00001hMhFIQA0. 
___________________________ 
public class AccountClass {
    public static void CountMyContacts(Set<ID> recordIds){
    List<Account> accs = [Select Id, Name from Account Where Id IN :recordIds];
    for (Account a : accs){
    List<Contact> Cons = [Select Id, Name from Contact Where AccountId = :a.Id];
        integer ConCount = Cons.size();
        system.debug( Account.Name + 'account has' + ConCount + 'number of contacts');
       }
    }            
}
Challenge: https://developer.salesforce.com/trailhead/force_com_declarative_beginner/business_process_automation/approvals

Step:  Upon entering the approval process, set the Type field to 'Pending' and lock the record.

When I try and create this step above and type the field to Pending I notice the Approval is for the Opportunity object not the Account.  I am sure this is a simple issue but I can't figure out how to approve the Account and not the Opportunity.
Hi, I have never used Eclipse before and want to install and take a look.  I've been using Salesforce for 8+ years and am ADM201 so I am not a techy however I have failed at the first hurdle to actually install this, can someone tell me what is wrong I include a screen shot.
User-added image
Hi,

I have tried all ways searched in google but still couldn't get it. Can i know whats the reason
  • March 24, 2015
  • Like
  • 0
Error: Onaccount111 Compile Error: Incompatible types since an instance of SObject is never an instance of Account at line 30 column 13

VF Page :

<apex:page standardController="Account" extensions="Onaccount111" sidebar="true" id="D001">
<apex:sectionHeader title="Account" id="S001"/>
<apex:form >
<apex:pageBlock id="pb001">
<apex:pageBlockButtons location="top">
<apex:commandButton value="Open"/>
<apex:commandButton value="Delete"/>
</apex:pageBlockButtons>
<apex:pageBlockSection id="pbs" columns="1" title="Search Leads">
<apex:inputField id="f0" label="Parent ParentAccount" value="{!Account.Parentid}"/>
<apex:inputField id="f1" label="Filter by Accountname" value="{!Account.Name}" required="false"/>
<apex:inputField id="f2" label="Filter by Type" value="{!Account.Type}"/>  
<apex:inputField id="f4" value="{!Account.Active__c}" label="Active"/>
<apex:inputfield id="f5" label="Priority" value="{!Account.CustomerPriority__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>



CLASS :

public class Onaccount111
{
    public list<account> acclist{get;set;}
    public Account acc{get;set;}
    public string Accountname{get;set;}
    public boolean pageblk{get;set;}
  //public string parentaccount{get;set}
    public string type{get;set;}
    public string active{get;set;}
   // public integer start{get;set;}  
    public boolean previous{get;set;}
    public boolean next{get;set;}
    public boolean first{get;set;}
    public boolean last{get;set;}
    public string query{get;set;}
    public string priority{get;set;}
    public string accstatus{get;set;}
    public string dispstatus{get;set;}
    public string openstatus{get;set;}
       public string download;
    public string start{get;set;}
    public string finalsort = '';
    public string ss1 = '';   
    public string reqstatus;
    public map<string,string> fieldmap = new map<string,string>();

    public Onaccount111(ApexPages.StandardController controller)
    {
        acc = new Account();
        acc=(Account)controller.getrecord();
        acclist= new list<account>();
        //start=0;
        dispstatus='open';
        openstatus='open';
       // first='true';
       // next='false';
       // previous='true';
       // last='false';
        pageblk =false;
         download = ApexPages.currentPage().getParameters().get('download');
        fieldmap.put('Name','Name');
        fieldmap.put('AccountNumber','AccountNumber');
        fieldmap.put('Owner','Owner');                            
        fieldmap.put('Parent','Parent');
        fieldmap.put('Active','Active__c');
        fieldmap.put('CustomerPriority','CustomerPriority__c');
    }
    
    public void display(string status)
    {
         
        pageblk=true;
        this.parentaccount=acc.Parent;
        this.Accountname=acc.Name;
        this.type=acc.Type;
       this.priority=acc.CustomerPriority__c;
       this.active=acc.Active__c;
       this.accstatus=status;
      this.sortby=acc.Sort_By__c;
       list<string> sortby1= new list<string>();
        
       /*** if(sortby != null)
        {
            sortby1=sortby.split(';');
            integer size= sortby1.size();

            for(string ss: sortby1)
            {
                string search = ss;   
                    if(fieldmap.containskey(search) == true)
                    {
                        ss1 = fieldmap.get(search);
                    }
    
                    if(Ss != sortby1[size-1])
                     {
                        finalsort = finalsort + ss1 + ',';
                     }
                    if(Ss == sortby1[size-1])
                    {
                        finalsort = finalsort + ss1;
                    }
            }        
        }***/
        
        if(status == 'allaccounts')
        {
            //if(sortby1.size() == 0)
           
                query = 'select id,status__c,type__c,name__C,Created_Date__c,Lead_Type__c,Status,Name,LeadAddress__c,Email,Phone,LeadSource,GTM_Appt_Schedule__c,Appt_from__c,Appt_Held__c,qbdialer__LastCallTime__c,pi__score__c,pi__first_activity__c,pi__last_activity__c,Previous_Pardot_Score__c,Pardot_score_change_date__c,qbdialer__Dials__c,Follow_up_Date__c,Trend_of_Pardot_score__c from lead where status=:openstatus';
           
         }
         }
        
    public void open()
     {
       validate();
        dispstatus ='Open';
        reqstatus='Open';
        display(reqstatus);
     }

  public void validate()
     {
        if(acc.Ownerid != null)
        {
             ApexPages.Message msg = new Apexpages.Message(ApexPages.Severity.Warning,'No Record Found' );
             ApexPages.addmessage(msg);
        }
     }
}

I have tried a lot but still cant get this. Can anyone tell why this error is coming?

Thanks in advance :)
 
I would like to fetch the value of count which is written below  in a visualforce page into javascript and modify it. Thereafter I would like to rerender it into another field.
<apex:outputtext id= "count" value ="{!50}" />

Javascript:
 a = document.getElementById('{!$Component.count}').value;
alert('a is' + a);
The above statement is used to fetch the value. When I displaying through alert, it is showing as 'a is undefined'. Can anyone please help on how to fetch the correct value.
 
Hello there.

I have created a visualforce email template and would like to have my user credentials in the bottom like my name,address,phone,fax, email,website etc.
From what I can understand i will need to use the field where I have created my profile in Salesforce. I have been trying to sort it out but sometimes I get errors and other just won't work. 

Any ideas please!!
trigger Comparision on Account(before update)
{
    for(Account acc : Trigger.new)
    {
    Account oldAccount = Trigger.oldMap.get(acc.ID)
        if(acc.AccountNumber!=oldAccount.AccountNumber)
        {
        System.debug('Account number is changed');
        System.debug('old account');
        System.debug('new account');
        acc.Type = 'prospect';
        }
        else
        {
        System.debug('number has not been changed');
        acc.Type = 'other';
        }

    }
}

in this program i got this error like:
Compile Error: unexpected token: 'trigger' at line 1 column 0



 
Hi all,

Please let me know without sharing only overides(excape) sharing setting only or permission setting also (CRUD).

Thanks.
Hi Experts,
 
One custom field named as ERP__c in Account Object.
Initial day’s data entry guy not entering the information about ERP__c field in Account object.
We have an Accounts more than 1,500.
Is there a way in Salesforce to automatically fill the ERP field info for existing account records data?
Anyone help me out.
Thanks in advance.

please find below image.

User-added image
Hi all,

Iam trying to deploy a small changeset into my production org. I have a test class and normla class and these both work fine. However, there is a test class already in the org that seems to be failing. The error message it is giving me is:

System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, You do not have permissions to create a Contact without an Account: [] 
Stack Trace: Class.TalentIntegrationTestSuite.testContactInsertTrigger: line 13, column 1

System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, You do not have permissions to create a Contact without an Account: [] 
Stack Trace: Class.TalentIntegrationTestSuite.testContactUpdateTrigger: line 22, column 1

This particular test class was created several years ago by a different person. I have tried disabling all validation rules in Accounts and Contacts however the error messgae is still the same. Any help would be much appreciated. Thanks.

Test Class:
@isTest
private class TalentIntegrationTestSuite {
   
    static testMethod void testContactInsertTrigger() {
        activateIntegration();
        
        Contact c = new Contact();
        
        c.FirstName = 'John';
        c.LastName = 'Smith';
        
        Test.startTest();
        insert c;
    }
    
    static testMethod void testContactUpdateTrigger() {
        activateIntegration();
        
        Contact c = new Contact();
        c.FirstName = 'John';
        c.LastName = 'Smith';        
        insert c;
        
        c = [Select Id, FirstName, LastName from Contact where Id=:c.Id];
        
        c.FirstName = 'Mary';
        Test.startTest();        
        update c;
    }

    static testMethod void testAccountInsertTrigger() {
        activateIntegration();
        
        Account a = new Account();
        a.RecordTypeId = [Select Id From RecordType Where isPersonType=true and sObjectType='Account' Limit 1].Id;
        a.FirstName = 'John';
        a.LastName = 'Smith';
        
        Test.startTest();
        insert a;
    }
    
    static testMethod void testAccountUpdateTrigger() {
        activateIntegration();
        
        Account a = new Account();
        a.RecordTypeId = [Select Id From RecordType Where isPersonType=true and sObjectType='Account' Limit 1].Id;
        a.FirstName = 'John';
        a.LastName = 'Smith';        
        insert a;
        
        a = [Select Id, FirstName, LastName from Account where Id=:a.Id];
        
        a.FirstName = 'Mary';
        Test.startTest();        
        update a;
    }
    
    static testMethod void testBusinessAccountUpdateTrigger() {
        activateIntegration();
        
        Account a = new Account();
        a.RecordTypeId = [Select Id From RecordType Where isPersonType=false and sObjectType='Account' Limit 1].Id;
    a.Name = 'Fabrikam';       
        
        insert a;
        
        Contact c = new Contact();
        c.FirstName = 'John';
        c.LastName = 'Smith';
        c.AccountId = a.Id;
        
        insert c;
        
                
        a = [Select Id, BillingPostalCode from Account where Id=:a.Id];
        
        a.BillingPostalCode = 'NE30 2PL';
        Test.startTest();        
        update a;        
    }
    
    static void activateIntegration()
    {
      CustomIntegrationSetting__c setting = CustomIntegrationSetting__c.getValues('CustomerTalentIntegration');      
    if (setting.isActive__c==false)
    {
      setting.isActive__c = true;
      update setting;  
    }  
    }
}

 
Hi,

I am getting 'System.NullPointerException: Attempt to de-reference a null object' exception @ line 15(if(accupdt)). Please help what's wrong with the below code.

My requirement is simple for every General Req obj & Act if Merchant/Parent Merchant matches check if there is a change in Account Status/Traing Ind fields and update it on the Account.

        for (General_Request__c gr: grAcc.keyset() ){
            for (Account a : acclist){
                if(gr.Merchant__c == a.Merchant_MID__c || gr.Parent_MID__c == a.Merchant_MID__c){
                   accupdt = false;
                   if (gr.perkaStatus__c != '' && gr.perkaStatus__c != null && a.Perka_Account_Status__c != gr.perkaStatus__c){
                        a.Perka_Account_Status__c = gr.perkaStatus__c;
                         accupdt = true;
                     }                    
                  if(gr.Channel_ID__c != null && gr.Channel_ID__c != '' && gr.Channel_ID__c.contains('ISO') && gr.Perka_Training_Indicator__c != ''                      && gr.Perka_Training_Indicator__c != null && (a.Perka_Training_Indicator__c != gr.Perka_Training_Indicator__c)){
                        a.Perka_Training_Indicator__c = gr.Perka_Training_Indicator__c;   
                        accupdt = true;
                  }
                }  
                if(accupdt){
                    accUpdlist.add(a);
                }                
            }                  
        }//End of For Loop                  
  • November 11, 2014
  • Like
  • 0
I have override the standerd Edit button with VF page this VF page will redirect to other VF page based on the record type, the redirection is working properly but i want to give an error messsage on this this page.
In the below class line number 26 error message is not diplaying if i add "return null" it is redirectiong to standerd page if i remove this line it stay in the page and showes "Attempt to De-reference null object" error. Need help ASAP

Thanks in advance

here c.Sys_Ticket_Count__c is grater than 0 

Apex Class:
public with sharing class escaEditBtnController {
	
	public escaEditBtnController(ApexPages.StandardController controller) {
        this.controller = controller;
    }
    
    public PageReference getredirect() {

        Escalation__c c = [Select id, recordtypeid,Sys_Ticket_Count__c From Escalation__c Where Id = :ApexPages.currentPage().getParameters().get('id')];

        PageReference newPage;

        if (c.recordtypeid == Constants_PicklistVariables.TICKET_RECORDTYPE_ID) {
            newPage = new PageReference('/apex/TicketEdit?retURL=%2F'+c.id);
			newPage.getParameters().put('id', c.id);
	        newPage.getParameters().put('editMode', 'true');
	        
        } else {
        	if(c.Sys_Ticket_Count__c <= 0 ){
        		newPage = new PageReference('/apex/EscalationEdit?retURL=%2F'+c.id);
	            newPage.getParameters().put('id', c.id);
	            newPage.getParameters().put('editMode', 'true');
	            newPage.getParameters().put('nooverride', '1');
        	}else{
        		System.debug('c.Sys_Ticket_Count__c'+c.Sys_Ticket_Count__c);
        		ApexPages.addmessage(new ApexPages.message(ApexPages.Severity.Error,'Ticket has been rised for this escalation you do not have access to edit this Escalation, Please contact the system admin'));
				return null; 
        	}
            
        }
		
        return newPage.setRedirect(true);
    }

    private final ApexPages.StandardController controller;
}
VF page:
<apex:page standardController="Escalation__c" extensions="escaEditBtnController"  
    action="{!nullValue(redirect.url, urlFor($Action.Escalation__c.Edit, Escalation__c.id, null, true))}">
<apex:pageMessages />
</apex:page>


 
I have multiselect Checkboxes for a questions like certifications
Salesforce Admin
Salesforce Advance Admin
Salesforce Developer
Other

So I can select as many as I want but if I select other then there is a text field below to enter what the other certifications are but how to make the below question mandatory if in the previous question only if other is selected?
How exactly do you comment in VisualForce? // Is for a single line if I'm not mistaken. /* is for more then one line I believe as well. However, I've encountered <-----
also. What does that mean? When it's used, it greys out the code, but the code within still seems to function. Can someone help me with what that means?
Hi,
When users are changing the Account Owner, I have made a trigger to change the Owner of the realated Contract as well.
When some mandatory fields are empty in the related contract, users see a red message with the name of the field to fill but it is abit frightning.
I want to add a adderror() method in my trigger to show them the following message : 'Please complete all mandatory field on contract page'
Can you help me add this in my trigger?
Many thanks.

trigger TriggerUpdateContractOwnerFromAcount on Account (after Update) {
for(Account Acc :Trigger.new){

List<Contract> C = [select id, ownerid from Contract where Account.id = :Acc.Id ];

for (Contract Ctrct : C)

If(Ctrct.Ownerid != Acc.Ownerid){
{
Ctrct.Ownerid= Acc.Ownerid;
}
update C;
}
}
}
Hi everyone...

its a simple program to add and subtract two values and display the result in the third...using actionFunction and jscript

no output displayed...

here is the code...

VF code...

<apex:page controller="arithmatic" >
   
   <script>
      
       function java_add()
       {
           alert('entered add1 jscript')
           call_add();
         
       }
      
       function java_sub()
       {
           alert('entered sub1 jscript')
           call_sub();
         
       }
      
   </script>
   
   
  <apex:form >
  <apex:pageBlock >
  <apex:pageBlockSection >
      <apex:pageBlockSectionItem >
          <apex:inputText id="Value1" value="{!value1}"/>
          <apex:inputText id="Value2" value="{!value2}"/>
      </apex:pageBlockSectionItem>
      <apex:pageBlockSectionItem >
          <apex:commandButton value="add"  onclick="java_add();"/>
              <apex:actionFunction name="call_add" action="{!addition}"/>
      </apex:pageBlockSectionItem>
     
      <apex:pageBlockSectionItem >
          <apex:commandButton value="sub"  onclick="java_sub();"/>
              <apex:actionFunction name="call_sub" action="{!subtraction}"/>
      </apex:pageBlockSectionItem>     
     
      <apex:outputlabel id="Value3" value="{!value3}"/>
  </apex:pageBlockSection>
  </apex:pageBlock>
  </apex:form>
</apex:page>


Apex code...

public with sharing class arithmatic {

   public PageReference addition() {
  return null;
    }

  

    public PageReference subtraction() {
        return null;
    }

    public integer addition{set;}
    public integer subtraction{set;}
    public integer value3 {  get;set; }
    public integer value2 { get; set; }
    public integer value1 { get; set; }
   
   public integer getaddition(){
   
     value3 = value1 + value2;
     return null;
    
    }
   
   public integer getsubtraction(){
    
     value3 = value1 - value2;
     return value3;
  
    }

}

Hi,

 

I need to verify 2 conditions based on 1 condition.

 

When IF condition is true then i need to check two more conditions.

 

 

If(InProgress__c == True)

{

     AND(  (ISPICKVALUE('YES') , (ISBLANK(EMP_Num__c) )

}

 

How can i write that formula.  

 

Thanks,

Arjun. 

Hi,

I am following along the "Heroku Enterprise Basics" trail and doing the steps mentioned there -> "Heroku Enterprise Basics - Deploy Your First Heroku App"
However while doing -
git clone https://github.com/heroku/node-js-getting-started <your app’s name>
I get this - "warning: You appear to have cloned an empty repository."

So, I am unable to get the code and proceed further with the trail.

This seems to be the workaround given by the Heroku team, but it doesn't seem to work - https://help.heroku.com/XOBUHLKQ/why-do-i-see-a-message-you-appear-to-have-cloned-an-empty-repository-when-using-heroku-git-clone
Trying to pull code using "git pull origin master" doesn't work.

If anybody has had any luck with this please do help.

Regards,
Lakshmi.
 
  • March 30, 2019
  • Like
  • 0

Hi All,

 

Is it possible to upload images to a Rich text area field using Apex data loader ?

 

 

Regards,

Lakshmi.

  • October 09, 2012
  • Like
  • 0

Hi,

 

I have some textboxes in my VF page. And an Account lookup field.

 

I want to populate the textboxes with the value in Address field of the Account object which I am selecting via the Account lookup.

 

 

 

Regards,

Lakshmi.

  • September 11, 2012
  • Like
  • 0

Hi,

 

I have a pageBlockTable with a column in which the values change dynamically. Rows also get added.

 

I want the sum of the values in that column to be displayed at the bottom of it.

 

How can I achieve the same using Visualforce ?

 

 

Regards,

Lakshmi.

 

 

  • September 10, 2012
  • Like
  • 0

Hi,

 

How can we set a default value to an inputfield component in VF page.

I have an inputfield which is a lookup to an Object. I want a default value to be displayed on the field when the apge is loaded.

 

 

Regards,

Lakshmi.

  • September 06, 2012
  • Like
  • 0

Hi,

 

My requirement is that I want a field(column) in pageBlockTable to be calculated dynamically based on 2 other fields.

I have 3 columns - Order quantity, Unit Price & Total Extended Price.

 

 

What I want to do is :

Whenever the value under Order quantity is changed in a row, the corresponding Total Extended Price should be calculated and refreshed (Total Extended Price = Order quantity * Unit Price ).

 

How can I achieve the same in Visualforce ?

 

Thanks in advance.

 

 

 

Regards,

Lakshmi.

  • September 03, 2012
  • Like
  • 0

Hi,

 

I observed some odd behaviour while deploying some components from Sandbox to Production.

 

When I logged in as "A" and tried to deploy a change set to my Production environment, I got 21 failures due to classes in the Production envt. Where as when I logged in as "B" and tried to deploy the same changeset I got only 2 errors.

The 2 errors were due to the dependency of a test class in Production(it was querying  an object in the envt, which no longer existed)

So I figured out the problem, corrected it and re-deployed using login "B". The 2 errors vanished and I could deploy successfully.

 

However when I login as "A", I can still see 14 errors (all related to Validation rules). Both "A" and "B" are assigned the same Profile. However Role assigned is different.

 

Can anybody tell me why is the behaviour like this ? Is there any setting that can change the behaviour ?

 

 

Regards,

Lakshmi. 

  • August 20, 2012
  • Like
  • 0

Hi All,

 

Does Salesforce support IE9 ?

 

I have some VF pages exposed via Force.com Sites which is working well in other browsers and IE8 too.

But the same hangs in IE9.

 

Is there any workaround which any of you have used and works fine ?

 

 

Regards,

Lakshmi.

  • August 09, 2012
  • Like
  • 0

Hi All,

 

I am facing a problem with visualforce pages behaviour after being moved to Force.com Sites.


When the VF pages were moved to Site, the redirection that was working fine fails to work anymore.

The requirement is that we need to traverse across some 4,5 pages capturing the user entry in each and carrying it till the last page where we are doing a save to an object.


I have associated the same controller with all pages and redirecting using:

PageReference redirect = new PageReference('/apex/survey3');       
return redirect;

 

This works fine before moving to Sites.
But once moved to Sites, it doesn't redirect at all, just refreshes the same page.

 

When the code is changed as below, it redirects but the view state is not maintained I guess and hence the values are not carried over as required.

PageReference redirect = new PageReference('/survey3');
return redirect;

 

Could you provide any information on what might be wrong ?

Thanks in advance.

 

Regards,

Lakshmi.

  • August 08, 2012
  • Like
  • 0

Hi,

 

How can I get the Recipient's details while sending Mass email to users.

 

In the mail I am sending out, I want to access the recipient's FirstName, LastName, Email id etc.

 

For eg: While doing Mass Email Contacts, if the email template has Dear {!Contact.FirstName} it gets replaced by the corresponding contact's name right. Similarly what should be done to get the recipient's information in "Mass Email Users" ?

 

 

Regards,

Lakshmi.

 

  • August 07, 2012
  • Like
  • 0

Hi,

 

Can anybody tell me how to pass parameters across pages via the controller.

 

I have the same controller associated with 3 pages.

 

And I want the value I set in the 1st page to be available for display on the 3rd page.

Is it possible to do the same via the controller ?

 

 

Regards,

Lakshmi.

  • July 27, 2012
  • Like
  • 0

I have a pageBlockTable which is used to display a list of Accounts.
I have a column with a selectList in each row of the table.


My problem is that on selecting a value from the Select list I am unable to get the correctly selected value onto the controller.
From the debug log it is evident that the default selected value from the last row in the table is what gets set in the variable in the controller.


How do I get over this and get the correct value onto the controller ?

 

<apex:column headerValue="Action" width="80px"> 
                             <apex:selectList id="AcctTable" required="true" size="1" value="{!selectedValue}" >
                             <apex:actionSupport event="onchange" action="{!SortTheList}"/ >
                             <apex:selectOptions value="{!Items}"> 
                               <apex:param value="{!selectedValue}"  name="id"/>    
                            </apex:selectOptions> 
                            </apex:selectList> 
                            
				</apex:column>

 

 

  • July 11, 2012
  • Like
  • 0

How can I open a Task creation screen from a button in Visualforce page ?

Basically I have a "Log a Call" button in my VF page, and on click of it I want to open the Log a call/Task screen.

 

Can anybody provide some input on this.

 

Regards,

Lakshmi.

  • July 10, 2012
  • Like
  • 0

I need the kind of calendar in the Salesforce Home page in my Visualforce page.

Can anybody tell me how to achieve the same ?

 

Regards,

Lakshmi.

  • June 21, 2012
  • Like
  • 0

Hi,

Can anybody please tell me what is wrong in this OnClick javacript code.

 

I require to get the Status__c field on the Work objects for checking something down the line.

 

I am getting all the record ids for object Work__c and then trying to retrieve all Work objects whose ids are present in records.

However it is not working and throwing malformed query exception.

var records = {!GetRecordIds($ObjectType.Work__c)}

var result1 = sforce.connection.query("select id, Status__c from Work_Order__c where Id IN ("+records+")") ;

Exception thrown:

A problem with the OnClick JavaScript for this button or link was encountered:

{faultcode:'sf:MALFORMED_QUERY', faultstring:'MALFORMED_QUERY:
from Work_Order__c where Id IN (a0wQ0000002hdyv)
                               ^
ERROR at Row:1:Column:53
unexpected token: 'a0wQ0000002hdyv'', detail:{MalformedQueryFault:{exceptionCode:'MALFORMED_QUERY', exceptionMessage:'
from Work_Order__c where Id IN (a0wQ0000002hdyv)
                               ^
ERROR at Row:1:Column:53
unexpected token: 'a0wQ0000002hdyv'', row:'1', column:'53', }, }, }

  • March 31, 2011
  • Like
  • 0

Hi..am facing a problem with Date formatting.

 

In the below code, 

Am inserting dates into the list in the format Date.newInstance(2011, 01, 01), but while iterating list and retrieving the date, it comes out in a different format.


So my further calculations are failing. Could anybody please advice on the same.

When I run the code I get "Internal Salesforce Error".

 

Problem is because the dates I am comparing are in different formats:

l_dtClosedDate is assigned value: Fri Jan 01 00:00:00 GMT 2010
l_dtMaxCompletedDate is assigned value: 1970-01-01 00:00:00

 

I want l_dtClosedDate  also in the same format as l_dtMaxCompletedDate.
Actually that is the format in which it is created when I do Date.newInstance(2011, 01, 01) and insert it into the list.

 

I am not able to do any conversion with the l_dtClosedDate variable fetched from the List. All functions fail when used with that variable.

 

1. Can anybody advise as to how to convert the l_dtClosedDate variable to this format - 1970-01-01 00:00:00
2. Or how to convert a date in this format - 1970-01-01 00:00:00 to Sat Jan 01 00:00:00 GMT 2011.

 

public class Maxx
{
	public static void getMaxDate()
	{
		List<Date> l_ltClosedDateList = new List<Date>();
		Date l_dtMaxCompletedDate = Date.newInstance(1970, 1, 1);
		Date l_dtClosedDate;
		String Date1;
		
		//Data
		l_ltClosedDateList.add(Date.newInstance(2010, 1, 1));
		l_ltClosedDateList.add(Date.newInstance(2010, 1, 11));
		l_ltClosedDateList.add(Date.newInstance(2010, 1, 12));
		
		Iterator<Date> l_itClosedDateIter = l_ltClosedDateList.iterator();
		while(l_itClosedDateIter.hasNext())
		{
			System.debug('Entered while loop');
			l_dtClosedDate = l_itClosedDateIter.next();
			
			System.debug('Closed date is assigned value: '+l_dtClosedDate);			
			System.debug('Max completed date is assigned value: '+l_dtMaxCompletedDate);

			if( l_dtClosedDate > l_dtMaxCompletedDate )
			{
				System.debug('Entered if loop');
				l_dtMaxCompletedDate = l_dtClosedDate;
			}
		}
		System.debug('Max Completed Date: '+l_dtMaxCompletedDate);
	}
}

 

  • January 14, 2011
  • Like
  • 0

Hi,

 

Can anybody pls tell me how to retrieve list of Tasks for a particular Case using Apex coding.

  • December 29, 2011
  • Like
  • 0
Hello,
Please help me, how do I call below class from the anonymous window. I am not finding a way to pass IDs as parameter.
I want pass record Ids of Account for example this 0010I00001hMhFIQA0. 
___________________________ 
public class AccountClass {
    public static void CountMyContacts(Set<ID> recordIds){
    List<Account> accs = [Select Id, Name from Account Where Id IN :recordIds];
    for (Account a : accs){
    List<Contact> Cons = [Select Id, Name from Contact Where AccountId = :a.Id];
        integer ConCount = Cons.size();
        system.debug( Account.Name + 'account has' + ConCount + 'number of contacts');
       }
    }            
}
I'm trying to write a test class and load bunch of test lead's data but for some reason when I call the static resource (that has my CSV) is not recognizing the custom fields. Example, Lead_insurance_Id__c

My CSV file - static resource:
// Example of how my CSV looks like

Id, Firstname, Lastname, Leads_Insurance_ID__c,..etc

000012, Fares, Alsyoufi, 12184111, ..etc
000011, Fare,syoufi, 12184211, ..etc
000013, Fares, syouf, 12184311, ..etc

My test class:
 
@isTest 
global class DataUtil {
    static testmethod void testLoadData() {
        // Load the test accounts from the static resource
        List<sObject> ls = Test.loadData(Account.sObjectType, 'TestData');
        
       }
}

Error message: 

User-added image

Seems like the standard Salesforce fields didn't cause any execptions but custom fields did (I tried other one beside Lead_Insurance_Id__c) and I still got the same error message. 

P.S:
I've tried to change my CSV header to all of these formats but non helped:

LEADS_INSURANCE_ID__c
Leads_insurance_Id__c
Lead.DLeads_insurance_Id__c
Insurance ID (Field's label)
Hi Guys,

I get an error message when trying to solve Restrict Login Hours and IP Ranges Challenge from Protect Your Data in Salesforce badge:
"We couldn’t find the correct login hours. Review the login hours in the step."
I set the Login Hours as in challenge - Mo-Fr 8am - 6pm and Sa-Su 12am - 12 am. Time zone which is shown in Login Hours is GMT+2 (Berlin). I guess that this times should be in PDT (GMT -7). When I change Company Time Zone to PDT, in Login Hours it is still GMT+2. I read, that once it is set, it won't chang. That means, Considering GMT-7, login hours should be 11pm - 8am. But than I get an error that Start cannot by later then End. Any idea how to set this?

Thanks!
One user belonging to a particular profile not able to save record, while other users with the same profile can able to save the record. There are no permission sets, sharing rules specific to a group/user.
Challenge: https://developer.salesforce.com/trailhead/force_com_declarative_beginner/business_process_automation/approvals

Step:  Upon entering the approval process, set the Type field to 'Pending' and lock the record.

When I try and create this step above and type the field to Pending I notice the Approval is for the Opportunity object not the Account.  I am sure this is a simple issue but I can't figure out how to approve the Account and not the Opportunity.
Hi,
 Can anyone please help me in how to find the below metadata types in Salesforce.

ChannelLayout
UiPlugin
WorkflowSend


Any help is really appreciated.

Thanks in advance
Hi, I have never used Eclipse before and want to install and take a look.  I've been using Salesforce for 8+ years and am ADM201 so I am not a techy however I have failed at the first hurdle to actually install this, can someone tell me what is wrong I include a screen shot.
User-added image
 Hi experts..
I am new to apex coding..
i have written the apex class and the from workbench i want to acces that class ..
in the workbench i have created object for the class.
so please kindly help me.
I need to access the apex class.
my apex class
public class firstclass{
integer i= 10;
integer j= 20;
integer k=i+j;
public firstclass()
    {
    system.debug( The sum of the i and j is :  '+k');
    }
}



 
Hi Experts,
 
Admin user able to logged in as user for few users only.
We need for admin user to logged in as user for all users (i.e. including Salesforce, Salesforce Platform, and Community license users).
Please find below images for admin login in sandbox (i.e. same happened in production also).

Admin able to loggedin as user

Admin User not able to loggedin as community user

Anyone please resolve this.
Thanks in advance.
 
Thanks,
Manu
Hi,

I have tried all ways searched in google but still couldn't get it. Can i know whats the reason
  • March 24, 2015
  • Like
  • 0
Hi all,

i have a requirement where in i need to schedule a batch class using apex code.
The scheduled time & date depends on the input provided by the user in the DateTime custom field

This is what i have done till now
            todaysTime=Date.today();
            secs=String.valueOf(todaysTime.second());
            mins=String.valueOf(todaysTime.minute());
            hrs=String.valueOf(todaysTime.hour());
            sday=String.valueOf(todaysTime.Day());
            smonth=String.valueOf(todaysTime.month());
            syear=String.valueOf(todaysTime.year());
            sweek=todaysTime.format('E');
            
            finalString=secs+' '+mins+' '+hrs+' '+sday+' '+smonth+' '+sweek+' '+syear;
   
OUTPUT:*** final string0 0 1 3 12 Wed 2014


However i get an error as
Support for specifying both a day-of-week AND a day-of-month parameter is not implemented.
I want the batch class to be executed as per the time i have fetched in the string
Can anyone please help?
Hi,
       I have a button in Account detail page like "Create Contact".When i click this button how to create contact with account name related account?
well guys i'm creating a visualforce that search some information on my account,i'm having trouble with the checkbox that i want to search the active users when the checkbox is marked and the inative i
public void getAccounts(){

   	String stringComplemento = '';
     string searchquery='SELECT name, id, Tipo_de_Documento__c, SiteNumber__c, RazaoSocial__c, NomeFantasia__c, '+
     					'N_mero_do_Documento__c, CustomerNumber__c, Cia__c,Ativo__c FROM Account ';
     			
     				if(PesquisaString != '' && PesquisaString!=null){     						
     					stringComplemento = ' WHERE name LIKE '+ '\'%' +PesquisaString+'%\'';
     				}
     					
     			     if(NomeFantasia != '' && NomeFantasia!=null){
     					 	if(stringComplemento!=''){
     					 		stringComplemento += ' and ';
     					 	}else{
     					 		stringComplemento += ' where ';
     					 	}
     						stringComplemento += ' NomeFantasia__c LIKE '+ '\'' +NomeFantasia+'\'';  
     					}
     					 
     					if(PesquisaCodCliente!= '' && PesquisaCodCliente!=null){
     						if(stringComplemento!=''){
     					 		stringComplemento += ' and ';
     					 	}else{
     					 		stringComplemento += ' where ';
     					 	}  
     						stringComplemento += ' CustomerNumber__c LIKE '+ '\'' +PesquisaCodCliente+'\'';
     					}
     					
     					if(PesquisaCodEndereco!= '' && PesquisaCodEndereco!=null){
     						if(stringComplemento!=''){
     					 		stringComplemento += ' and ';
     					 	}else{
     					 		stringComplemento += ' where ';
     					 	}
     						stringComplemento += ' SiteNumber__c LIKE '+ '\'' +PesquisaCodEndereco+'\'';  
     					}
     					
     					if(cia!= '' && cia!=null){
     						if(stringComplemento!=''){
     					 		stringComplemento += ' and ';
     					 	}else{
     					 		stringComplemento += ' where ';
     					 	}
     						stringComplemento += ' Cia__c LIKE '+ '\'' +cia+'\'';  
     					}
     					
     					if(tipoDocumento!= '' && tipoDocumento!=null){
     						if(stringComplemento!=''){
     					 		stringComplemento += ' and ';
     					 	}else{
     					 		stringComplemento += ' where ';
     					 	}
     						stringComplemento += ' Tipo_de_Documento__c LIKE '+ '\'' +tipoDocumento+'\'';  
     					}
     					
     					if(RazaoSocial!= '' && RazaoSocial!=null){
     						if(stringComplemento!=''){
     					 		stringComplemento += ' and ';
     					 	}else{
     					 		stringComplemento += ' where ';
     					 	}
     						stringComplemento += ' RazaoSocial__c LIKE '+ '\'' +RazaoSocial+'\'';  
     					}
     					
     					if(NumeroDocumento!= '' && NumeroDocumento!=null){
     						if(stringComplemento!=''){
     					 		stringComplemento += ' and ';
     					 	}else{
     					 		stringComplemento += ' where ';
     					 	}
     						stringComplemento += ' N_mero_do_Documento__c LIKE '+ '\'' +NumeroDocumento+'\'';  
     					}
     					\********************* HERE IS WHERE I'M HAVING TROUBLE
                                      
     					if(ClienteAtivo){
     					
     						stringComplemento += 'WHERE Ativo__c = true ';  
     						
     					}
     				
     				
     			searchquery =  searchquery + stringComplemento;   
     			Temp=searchquery ;
     			listAccPesquisa = Database.query(searchquery);
   }

f is not.