• mavs
  • NEWBIE
  • 75 Points
  • Member since 2008

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 67
    Questions
  • 54
    Replies
Hi, I´d like to know if there´s a way to check by using ApexCode the field type. i.e: we want to know if the requested field value in a dynamic query is a number, string, boolean, date, datetime, etc.

Select field1__c from MyCustomObject__c

so in this example, I'd like to know what field type is field1__c.

or, lets suppose we got different kinds of values into a string field (only for customization convenience) and then, I query that field and want to establish if that value is a number, date, datetime, etc only by using ApexCode. I didn´t find any IsNumber or IsBoolean methods in Apex documentation.

Thanks,

Wilmer
Hello Team,

Can any of you tell me if we can filter Picklist by recordType through API? If so could someone please provide some sample code on how to do this.


Thanks
  • May 21, 2014
  • Like
  • 0

When the Calculate your Organization's code coverage is clicked it showed us 70% of code is covered in production

We updated around 10 test methods to have the 100% code coverage and deployed to production. Now when we checked Calculate your Organization's code coverage  again it still shows 70%.

 

Can anyone shed some light on what i am missing and what else to look at?

 

Thanks

  • December 02, 2011
  • Like
  • 0

Hello

 

Am looking to update the data in the long text area field to a rich text Area field. Can someone please advise on how to include the new lines?

 

I had an object which holds two fields Long Text Area and Rich Text Area. Rich Text Area field is newly created. Now i would like to update the data from long Text Area field to a Rich Text Area field via data loader. But i am unsure on how to include the data in the new lines.

 

Please Advise

  • November 22, 2011
  • Like
  • 0

Hi

 

on clicking a custom link from Account, i am trying to create contact. It first opens a new contact window and passes in accountId parameter along with retURL parameter. after the contact record is saved i am redirecting it to a document (you can see retURL )

 

parent.frames.location.replace("/003/e?accid={!Account.Id}&retURL=%2Fservlet%2Fservlet.Integration?lid=01H400000000hT9")

 

for some reason, after the contact record is saved i am redirecting to the newly created record. When it should have been redirected to the document, since the ret URL is coded for.

 

 

Can someone please advise what is wrong with the above code? why it is not redirecting to the document???? Please Advise

 

 

Thanks

  • April 19, 2011
  • Like
  • 0

Can we delete apex class from Production environment?

 

i know we can disable but looking to delete them

  • March 31, 2011
  • Like
  • 0

HI

 

I have a String List which holds ContactIds

List<String> contactIds = new List<String>();

 

I need to check if there are any Tasks exits for each ContactId in the List. Can someone please give me a clue on how to do this?

 

I am trying the following but, i get the error   Illegal assignment from Integer to LIST<Integer>

List<Integer> taskcount = new List<Integer>();

taskcount = [Select count() from Task where whoId IN :contactIds];

 

 

Please Advise

 

Thanks

  • December 06, 2010
  • Like
  • 0

Hi

 

The example in this page http://wiki.developerforce.com/index.php/Visualforce_Popup  actually popsup Modal from a Visualforce page.

 

Is there any way Modal can be launched via a URL or from a standard page? If so, how can we call those functions?

Can someone please shed some light on how to do this? May be a sample helps

 

 

Thanks

  • October 26, 2010
  • Like
  • 0

 

Hi

 

I have an issue in finding if radiobutton is checked in the javascript function. Can someone please shed light on this?

 

Thanks

 

<apex:page controller="test_example">
<apex:form id="f1">
 <apex:selectRadio value="{!year_num}" id="ch">
            <apex:selectOption itemValue="2010" itemLabel="2010" />
            <apex:selectOption itemValue="2011" itemLabel="2011" />
            </apex:selectRadio>
            
 <apex:CommandLink onclick="return validate()"  action="{!myaction}" target="_blank">
        <font color="brown" size="3">Run Report</font>
        </apex:CommandLink> 

<script language="javascript">
                       
    function validate(){                                                
        try 
        { 
          var myText = "{!$Component.ch}"        
          var t="hi ";
           for (i=0; i<document.f1.myText.length; i++) 
           {
               
                 if (document.f1.myText[i].checked==true)
                 {
                    t =t +document.f1.myText[i].value
                 }
              

           }
           alert("in alert"+t);
            return false; 
                                 
        }                            
        catch(e)
        {                                                        
            alert(e);                                                        
            return false;                                               
        }                          
    }  
          
</script>   

</apex:form>
</apex:page>

 

public class test_example
{
    public String year_num{get;set;}

    public PageReference myaction()
    {
       return null;
    }

}

 

  • June 01, 2010
  • Like
  • 0

 

Given a report name (custom salesforce report created from Reports tab) in Salesforce, Is there any way to find out how many times it is accessed and the user who accessed it?

 

Thanks

  • May 04, 2010
  • Like
  • 0

Hi

what am i doing wrong here??

I am trying to pass selected value of selectlist to javascript function in the commandLInk onclick event

 

 when the command link is clicked, in the alert it is showing as undefined....

 

How to pass the selected list value here? Please advise

 

<apex:page controller="option_test">
<apex:form 
 <apex:pageBlock>
 <apex:selectList id="ch" value="{!num}" multiselect="false" size="1">
            <apex:selectOption itemValue="" itemLabel=""/>
            <apex:selectOption itemValue="01" itemLabel="01"/>
            <apex:selectOption itemValue="01" itemLabel="02"/>
  </apex:selectList>
<apex:CommandLink onclick="return validate()">click</apex:CommandLink>                 <script language="javascript">
                       function validate()               
                        {                   
                            try 
                            {
                                alert("Hi "+document.getElementById("{!$Component.ch}").value)
                                return false;
                            }
                            catch(e)                   
                            {                       
                                alert(e);                       
                                return false;                   
                            }
                         }
        </Script> </apex:pageBlock> </form> </page>

 

public class option_test
{
  public String num{get;set;}
}

 

 

  • May 02, 2010
  • Like
  • 0

hi

 

I want to pass the selected value of the radio as a parameter to OutputLink value. Below is the code

 

I selected 2008 and clicked on the Run Report Link, this is how the URL value is

 

http://abc=/

 

When it should have been http://abc=2008/

 

Does anyone see issue with the code below? Please advise...

 

Thanks

 

<apex:page controller="output_test">
    <apex:form >
    <apex:pageBlock >
        <apex:outputLabel value="Select Year" />
            <apex:selectRadio value="{!year_num}" rendered="true">
            <apex:selectOptions value="{!items}"/>
            </apex:selectRadio>                  
     <apex:outputlink target="_blank" value="http://abc={!year_num}">Run Report</apex:outputlink>
    
     </apex:pageBlock>
     </apex:form>
</apex:page>

 

public class output_test
{
    String year_num = null;
                
    public List<SelectOption> getItems() 
    {
        List<SelectOption> options = new List<SelectOption>(); 
        options.add(new SelectOption('2008','2008')); 
        options.add(new SelectOption('2009','2009')); 
        options.add(new SelectOption('2010','2010')); 
        options.add(new SelectOption('2011','2011')); 
        
        return options; 
    }
                   
    public String getYear_num() 
    {
        return year_num;
    }
                    
    public void setYear_num(String year_num) 
    { 
        this.year_num = year_num; 
    }
}

 

  • April 23, 2010
  • Like
  • 0

Hi

 

How do we write sql BETWEEN in SOQL?

 

We have a table Startdate enddate week 3/12/2010 3/18/2010 12 3/19/2010 3/22/2010 19 If todays date is between startdate and enddate i need week value datetime t = System.now(); date dt = Date.newInstance(t.year(),t.month(),t.day()); some_Object__c temp=[Select week from some_Object__c where startdate__c>=:dt and enddate<=dt];

 

 

 

This is not giving back any results.

 

Any idea???

  • March 18, 2010
  • Like
  • 0

I know this is simple....not sure where i am doing wrong. Any input???

 

Basically i need the accountid that is just created.

 

Account a=new Account(); a.type='New'; a.Phone='1234567890'; insert a; if(a.isSuccess) { System.debug(a.getId); }

 

 

 

  • March 17, 2010
  • Like
  • 0

Hi - Thanks for the providing neat and clear solution on the validation. I am trying this and having some road blocks. Can some one please address where the issue is?

 

This is the one i am trying.

I am receiving error: Static Resource named jquery does not exist. Check spelling

and sometimes

unexpected token: '' unexpected token: '<EOF>'at line 0 column -1.

 

 

here is my id value for vendor_meet  j_id0:j_id1:j_id2:j_id63: Validation Error: Value is required.

Please advise.Thanks

 

<apex:page controller="My_Controller" showHeader="false" standardStylesheets="false"> <apex:includeScript value="{!$Resource.jquery}"/> <apex:includeScript value="http://ajax.microsoft.com/ajax/jquery.validate/1.6/jquery.validate.min.js"/> <script type="text/javascript"> $(document).ready(function() { $(jq(f)).validate(); $(jq(vendor_meet)).rules("add",{ required: true }); jQuery.validator.messages.required = "Please enter a value"; jQuery.validator.messages.equalTo = "You have to enter a value. Please!!!"; }); </script> <apex:form id="commentForm" > <script> var vendor_meet = "{!$Component.vendor_meet}"; </script> <apex:outputlabel for="vendor_meet">Vendor (required)</apex:outputlabel> <apex:inputText id="vendor_meet" value="{!Vendor_Meetings}"/> <apex:commandButton action="{!save}" value="Save"/> </apex:form> <script> function jq(myid) { return '#' + myid.replace(/(:|\.)/g,'\\\\$1'); } var f = "{!$Component.commentForm}"; </script> </apex:page>

 

 

 

Message Edited by mavs on 03-17-2010 08:51 AM
Message Edited by mavs on 03-17-2010 08:52 AM
Message Edited by mavs on 03-17-2010 02:39 PM
Message Edited by mavs on 03-17-2010 06:38 PM
  • March 17, 2010
  • Like
  • 0

Can someone please let me know how to use SOSL from .Net?

 

I am using the below query and geeting MALFORMED_QUERY: unexpected token: FIND

 

string txt="Acme"; string query="FIND :"+txt+" IN NAME FIELDS RETURNING Account(Id, Name, Type,BillingStreet,Billingcity,BillingState,BillingPostalCode,Owner.Name WHERE RECORDTYPEID='xxxxxxx')";

 

Please advise...

  • March 11, 2010
  • Like
  • 0

I used SOSL in my .net code to retrieve the records.

 

But the search is returning all the records which meet the criteria. Is there any way to filter based on the Userid / Sharing like we do in Apex?

 

Please advise...Thanks

  • March 11, 2010
  • Like
  • 0

Can we display a lookup field without Account Name being populated in the textbox?

 

 

We are grabbing Accountid from Contact Object. Account Name is being populated in the lookup textBox when the component is rendered. Can we remove Account name being populated in the lookup field when the page is rendered?

 

 Please advise

 

<apex:inputField value="{!con.Accountid}"/>

 

lookup 

 

we just need the LookUp field with empty TextBox

  • March 08, 2010
  • Like
  • 0

I am grabbing Accountid (relatedto) from event Object.

 

In my VF page instead of displaying lookup, the actual account name is displayed in reonly format.

 

Cant we display lookup?

 

Why is lookup not being displayed?

 

<apex:inputField value="{!ev.AccountId}" /> Event ev=[Select Accountid,whatid from Event limit 1];

 

Message Edited by mavs on 03-05-2010 10:51 AM
  • March 05, 2010
  • Like
  • 0

Can we redirect User to Visualforce page/SControl Upon logging into salesforce?

 

If so can you please let us know how we can achieve this?

 

Our requirement is, Upon logging into salesforce we need to check to see if it is monday. If it is we will need to popup a window with some message.

 

Can someone please post us some ideas on how we can do this?

 

 

Thanks

 

  • March 01, 2010
  • Like
  • 0

We have a picklist field on Account called status__c.

 

since SFDC does not respect recordtype for picklist in apex:inputfield,  we are planning to go for selectList.

 

Question:

1. We will need to populate/default the picklist value to what ever value was there on the Account record. (this needs to be done for all the records in the pageblocktable. If it would have been one then it will be easier. Sinc ethis is dynamic not sure how to achieve this.)

 

2. And when Save button is clicked we need to capture each select list Value to the controller.

 

We need some help on how to achieve the above two.

 

Please advise

 

PageBlockTable

Account Record

Status

ABC1

Good   (This was value on Account ABC1). This will be picklist prepopulated with Value Good

ABC2

--Select--  (No value on the Account. User have to select for this record). This will be Picklist, since there is no Value User can select

 

<apex:pageBlockTable value="{!Account_Results}" var="eve" > <apex:column headervalue="Status"> <apex:selectList value="{!status}" required="true" multiselect="false" size="1"> <apex:selectOptions value="{!items}"/> </apex:selectList> </apex:column> </apex:pageBlockTable> Public class my_controller( { public List<SelectOption> getItems() { options.add(new SelectOption('--Select--','--Select--')); options.add(new SelectOption('Good','Good')); options.add(new SelectOption('Do not recommend',Do not recommend')); options.add(new SelectOption('Fair','Fair')); options.add(new SelectOption('Very Poor','Very Poor')); return options; } List<String> AcctIds= new List<String>(); List<Account> account_records= new List<Account>(); for(Account ac:[Select Id,status from Account where Id IN:AcctIds]) { account_records.add(ac); } Public List<Account> getAccount_Results() { return account_records; } }

 

 

 

 

  • March 01, 2010
  • Like
  • 0
Hello Team,

Can any of you tell me if we can filter Picklist by recordType through API? If so could someone please provide some sample code on how to do this.


Thanks
  • May 21, 2014
  • Like
  • 0

Hi

 

on clicking a custom link from Account, i am trying to create contact. It first opens a new contact window and passes in accountId parameter along with retURL parameter. after the contact record is saved i am redirecting it to a document (you can see retURL )

 

parent.frames.location.replace("/003/e?accid={!Account.Id}&retURL=%2Fservlet%2Fservlet.Integration?lid=01H400000000hT9")

 

for some reason, after the contact record is saved i am redirecting to the newly created record. When it should have been redirected to the document, since the ret URL is coded for.

 

 

Can someone please advise what is wrong with the above code? why it is not redirecting to the document???? Please Advise

 

 

Thanks

  • April 19, 2011
  • Like
  • 0

HI

 

I have a String List which holds ContactIds

List<String> contactIds = new List<String>();

 

I need to check if there are any Tasks exits for each ContactId in the List. Can someone please give me a clue on how to do this?

 

I am trying the following but, i get the error   Illegal assignment from Integer to LIST<Integer>

List<Integer> taskcount = new List<Integer>();

taskcount = [Select count() from Task where whoId IN :contactIds];

 

 

Please Advise

 

Thanks

  • December 06, 2010
  • Like
  • 0

 

Hi

 

I have an issue in finding if radiobutton is checked in the javascript function. Can someone please shed light on this?

 

Thanks

 

<apex:page controller="test_example">
<apex:form id="f1">
 <apex:selectRadio value="{!year_num}" id="ch">
            <apex:selectOption itemValue="2010" itemLabel="2010" />
            <apex:selectOption itemValue="2011" itemLabel="2011" />
            </apex:selectRadio>
            
 <apex:CommandLink onclick="return validate()"  action="{!myaction}" target="_blank">
        <font color="brown" size="3">Run Report</font>
        </apex:CommandLink> 

<script language="javascript">
                       
    function validate(){                                                
        try 
        { 
          var myText = "{!$Component.ch}"        
          var t="hi ";
           for (i=0; i<document.f1.myText.length; i++) 
           {
               
                 if (document.f1.myText[i].checked==true)
                 {
                    t =t +document.f1.myText[i].value
                 }
              

           }
           alert("in alert"+t);
            return false; 
                                 
        }                            
        catch(e)
        {                                                        
            alert(e);                                                        
            return false;                                               
        }                          
    }  
          
</script>   

</apex:form>
</apex:page>

 

public class test_example
{
    public String year_num{get;set;}

    public PageReference myaction()
    {
       return null;
    }

}

 

  • June 01, 2010
  • Like
  • 0

Hi

what am i doing wrong here??

I am trying to pass selected value of selectlist to javascript function in the commandLInk onclick event

 

 when the command link is clicked, in the alert it is showing as undefined....

 

How to pass the selected list value here? Please advise

 

<apex:page controller="option_test">
<apex:form 
 <apex:pageBlock>
 <apex:selectList id="ch" value="{!num}" multiselect="false" size="1">
            <apex:selectOption itemValue="" itemLabel=""/>
            <apex:selectOption itemValue="01" itemLabel="01"/>
            <apex:selectOption itemValue="01" itemLabel="02"/>
  </apex:selectList>
<apex:CommandLink onclick="return validate()">click</apex:CommandLink>                 <script language="javascript">
                       function validate()               
                        {                   
                            try 
                            {
                                alert("Hi "+document.getElementById("{!$Component.ch}").value)
                                return false;
                            }
                            catch(e)                   
                            {                       
                                alert(e);                       
                                return false;                   
                            }
                         }
        </Script> </apex:pageBlock> </form> </page>

 

public class option_test
{
  public String num{get;set;}
}

 

 

  • May 02, 2010
  • Like
  • 0

hi

 

I want to pass the selected value of the radio as a parameter to OutputLink value. Below is the code

 

I selected 2008 and clicked on the Run Report Link, this is how the URL value is

 

http://abc=/

 

When it should have been http://abc=2008/

 

Does anyone see issue with the code below? Please advise...

 

Thanks

 

<apex:page controller="output_test">
    <apex:form >
    <apex:pageBlock >
        <apex:outputLabel value="Select Year" />
            <apex:selectRadio value="{!year_num}" rendered="true">
            <apex:selectOptions value="{!items}"/>
            </apex:selectRadio>                  
     <apex:outputlink target="_blank" value="http://abc={!year_num}">Run Report</apex:outputlink>
    
     </apex:pageBlock>
     </apex:form>
</apex:page>

 

public class output_test
{
    String year_num = null;
                
    public List<SelectOption> getItems() 
    {
        List<SelectOption> options = new List<SelectOption>(); 
        options.add(new SelectOption('2008','2008')); 
        options.add(new SelectOption('2009','2009')); 
        options.add(new SelectOption('2010','2010')); 
        options.add(new SelectOption('2011','2011')); 
        
        return options; 
    }
                   
    public String getYear_num() 
    {
        return year_num;
    }
                    
    public void setYear_num(String year_num) 
    { 
        this.year_num = year_num; 
    }
}

 

  • April 23, 2010
  • Like
  • 0

Hi

 

How do we write sql BETWEEN in SOQL?

 

We have a table Startdate enddate week 3/12/2010 3/18/2010 12 3/19/2010 3/22/2010 19 If todays date is between startdate and enddate i need week value datetime t = System.now(); date dt = Date.newInstance(t.year(),t.month(),t.day()); some_Object__c temp=[Select week from some_Object__c where startdate__c>=:dt and enddate<=dt];

 

 

 

This is not giving back any results.

 

Any idea???

  • March 18, 2010
  • Like
  • 0

I know this is simple....not sure where i am doing wrong. Any input???

 

Basically i need the accountid that is just created.

 

Account a=new Account(); a.type='New'; a.Phone='1234567890'; insert a; if(a.isSuccess) { System.debug(a.getId); }

 

 

 

  • March 17, 2010
  • Like
  • 0

Hi - Thanks for the providing neat and clear solution on the validation. I am trying this and having some road blocks. Can some one please address where the issue is?

 

This is the one i am trying.

I am receiving error: Static Resource named jquery does not exist. Check spelling

and sometimes

unexpected token: '' unexpected token: '<EOF>'at line 0 column -1.

 

 

here is my id value for vendor_meet  j_id0:j_id1:j_id2:j_id63: Validation Error: Value is required.

Please advise.Thanks

 

<apex:page controller="My_Controller" showHeader="false" standardStylesheets="false"> <apex:includeScript value="{!$Resource.jquery}"/> <apex:includeScript value="http://ajax.microsoft.com/ajax/jquery.validate/1.6/jquery.validate.min.js"/> <script type="text/javascript"> $(document).ready(function() { $(jq(f)).validate(); $(jq(vendor_meet)).rules("add",{ required: true }); jQuery.validator.messages.required = "Please enter a value"; jQuery.validator.messages.equalTo = "You have to enter a value. Please!!!"; }); </script> <apex:form id="commentForm" > <script> var vendor_meet = "{!$Component.vendor_meet}"; </script> <apex:outputlabel for="vendor_meet">Vendor (required)</apex:outputlabel> <apex:inputText id="vendor_meet" value="{!Vendor_Meetings}"/> <apex:commandButton action="{!save}" value="Save"/> </apex:form> <script> function jq(myid) { return '#' + myid.replace(/(:|\.)/g,'\\\\$1'); } var f = "{!$Component.commentForm}"; </script> </apex:page>

 

 

 

Message Edited by mavs on 03-17-2010 08:51 AM
Message Edited by mavs on 03-17-2010 08:52 AM
Message Edited by mavs on 03-17-2010 02:39 PM
Message Edited by mavs on 03-17-2010 06:38 PM
  • March 17, 2010
  • Like
  • 0

Can someone please let me know how to use SOSL from .Net?

 

I am using the below query and geeting MALFORMED_QUERY: unexpected token: FIND

 

string txt="Acme"; string query="FIND :"+txt+" IN NAME FIELDS RETURNING Account(Id, Name, Type,BillingStreet,Billingcity,BillingState,BillingPostalCode,Owner.Name WHERE RECORDTYPEID='xxxxxxx')";

 

Please advise...

  • March 11, 2010
  • Like
  • 0

I used SOSL in my .net code to retrieve the records.

 

But the search is returning all the records which meet the criteria. Is there any way to filter based on the Userid / Sharing like we do in Apex?

 

Please advise...Thanks

  • March 11, 2010
  • Like
  • 0

I am grabbing Accountid (relatedto) from event Object.

 

In my VF page instead of displaying lookup, the actual account name is displayed in reonly format.

 

Cant we display lookup?

 

Why is lookup not being displayed?

 

<apex:inputField value="{!ev.AccountId}" /> Event ev=[Select Accountid,whatid from Event limit 1];

 

Message Edited by mavs on 03-05-2010 10:51 AM
  • March 05, 2010
  • Like
  • 0
Hi there Is there any property to set PageBlockSection Title size?
  • February 24, 2010
  • Like
  • 0