• Jonathan Vance 5
  • NEWBIE
  • 15 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 16
    Likes Given
  • 4
    Questions
  • 13
    Replies
When I launch my home page from the Developer Console Preview, I can see all the fields on my custom object on all 3 of my site's linked pages; however, when I navigate to the url to see the public Site, only 2 of my 3 pages display field data from my custom object.

I went to Setup->Build->Develop->Sites and clicked on the Site Label for the site in question. From there I clicked the Public Access Settings button, scrolled down to the Field Level Security -> Custom Field Level Security area and clicked View for my custom object. From there, I see that all my fields are checked as visible.

Does anyone have an idea what I'm doing wrong or how to fix this?
I want to write some code to add and remove fields on custom objects via Apex, SOQL, the API, or somehow programmatically rather than altering objects using the Salesforce UI. Is there any Force equivlent to a SQL ALTER TABLE statement? Is it possible to alter (add/remove fields on) custom objects using only code?
I'm using the Developer Edition, and for testing purposes, I want to visit my site without logging in. Is it possible to do this? If so, how?
I have been working through the Force.com Workbook, which explains everything clearly and completely until the REST API section beginning on page 91. At that point, the Workbook stops explaining steps in detail. Does it mean to run curl -s -H from the command line? Do we need to supply our access token as a parameter? Can I easily find my access token? Where do I find it?

http://www.salesforce.com/us/developer/docs/workbook/forcecom_workbook.pdf
When I launch my home page from the Developer Console Preview, I can see all the fields on my custom object on all 3 of my site's linked pages; however, when I navigate to the url to see the public Site, only 2 of my 3 pages display field data from my custom object.

I went to Setup->Build->Develop->Sites and clicked on the Site Label for the site in question. From there I clicked the Public Access Settings button, scrolled down to the Field Level Security -> Custom Field Level Security area and clicked View for my custom object. From there, I see that all my fields are checked as visible.

Does anyone have an idea what I'm doing wrong or how to fix this?
I'm using the Developer Edition, and for testing purposes, I want to visit my site without logging in. Is it possible to do this? If so, how?
I am having trouble displaying fields on my visualforce page when I add it to the site. I have checked all the public access settings and the field level security, they are both set as they should be. It is like I do not have access to the object itself. When I do <apex:inputField value="ObjectName.Field__c" /> it shows up in the visualforce page but not the site. We are using record types for this object but everything seems to be fine there as well. Does anyone have any expirence with this?

Thanks!

As I am going thru the Force.com Workbook, I reach the REST API example. I am using cURL with the following cmd:

 

curl -s -H 'Authorization: OAuth token ...'

https://na15.salesforce.com/services/data/v29.0/analytics/reports/00Oi0000004tH4I

 

But I am getting "INVALID_SESSION_ID"

 

The tutorial doesnt cover authenticating. Any ideas?

Please help me. Becuase im very new to sales force. how i can solve this problem

global with sharing class SaveExpenditureWebService {

webservice static Expenditure__c createExpenditure(Decimal amount,String expName, String paidByName )
{

Expenditure__c c = new Expenditure__c();
Person__c p = [Select p.Name From Person__c p Where Name = :paidByName limit 1];
c.Amount__c = amount;
c.Name__c = expName;
c.Exp_Date__c = Date.today();
c.Paid_By__c = p.Id;
insert c;
return c;
}

}

I have a site that has solutions on it.  If you log into the system and pull up the visualforce page you can see all of the fields for the solutions on the page.  But if you pull up the site that is linked to that visualforce page all Custom Fields on Solutions do not show up.  I have gone through all the permissions and everything is correct as far as I can tell.  Anyone have any idea why this might be happening?

I have created a class implementing Schedulable and have created a batch job to run at 9 pm every day. The job is available at Setup-> Monitoring -> Scheduled Jobs. I have added System.Debug statements in my class for traceability purpose in case of any issues. But I am unable to figure a way to get/mail the debug logs for the same. Can you please let me know what Setting should be set in order to get the debug logs for the Scheduled Jobs?

  • February 08, 2012
  • Like
  • 2

Hey,

 

When I use System.Schedule() to schedule an Apex job, I am experiencing some strange behavior:

 

* The job does show up on the 'Scheduled Jobs' page on the org, but its 'Manage' link is missing (the only link beside the job entry is 'Del').

 

* According to the 'Scheduled Jobs' page, the job does run at the scheduled time, but there is no evidence anywhere else in the org that the job actually run.  No debug logs appear and none of the side-effects of the job appear on the org.  I even stubbed out the class' execute() method with a System.assert ( False ) statement, to make it throw out an error email, but that doesn't happen either.  It definitely seems like nothing at all is being executed.

 

When I schedule the job via the UI (Develop -> Apex Classes -> Schedule Apex), it runs fine as expected.

 

Why is this?

 

(and why oh why is the page behind the 'Manage' link read-only??)

 

Thanks

  • October 27, 2011
  • Like
  • 2
this is my Vf page
 
<apex:page controller="RevenueDate" sidebar="False" docType="html-5.0" readOnly="true">           
    <apex:form id="dateren">    
   <apex:commandlink value="Export Excel" action="{!movedatatoexcel}" />
<!--<a href="/apex/RevenueByMonthInExcel2"> Export to Excel</a>-->
    <br></br>    <br></br>    <br></br>

And the Apex class
public without sharing class RevenueDate {

   public PageReference movedatatoexcel() {
       PageReference newPage = page.RevenuewithDatecriteriainExcel;
      newPage.getParameters().put('MyVariable1', string.valueof(fDate));
       newPage.getParameters().put('MyVariable2', string.valueof(tDate) );
        return newPage ;
    }

and the secod Apex class
public  PageReference search() {
                     Fjan =Tjan=jancol =FALSE;                     
                     Ffeb=Tfeb=febcol =FALSE;
                     Fmar=Tmar=marcol =FALSE; 
                     Faprl =Taprl=aprilcol =FALSE;
                     Fmay =Tmay=maycol =FALSE;
                      Fjun =Tjun=junecol =FALSE;
                     Fjul =Tjul=julycol =FALSE; 
                     Faug =Taug=augcol =FALSE;
                     Fsep=Tsep=sepcol =FALSE;
                     Foct =Toct=octcol =FALSE;
                     Fnov =Tnov=novcol =FALSE; 
                     Fdec =Tdec=deccol =FALSE;
      
         if((Apexpages.currentPage().getParameters().get('MyVariable1'))!=NULL)
            fDate = (Date.valueOf(Apexpages.currentPage().getParameters().get('MyVariable1')));
   
         else   
            fDate=date.valueof('2014-08-01');
 
         if((Apexpages.currentPage().getParameters().get('MyVariable2'))!=NULL) 
            tDate = (Date.valueOf(Apexpages.currentPage().getParameters().get('MyVariable2')));  
          
        else
            tDate=date.valueof('2015-3-31');  
  
            // fDate = (Date.valueOf(Apexpages.currentPage().getParameters().get('MyVariable1'))!=NULL?(Date.valueOf(Apexpages.currentPage().getParameters().get('MyVariable1'))):(date.valueof('2014-01-01')));
            //  tDate = Date.valueOf(Apexpages.currentPage().getParameters().get('MyVariable2'));

And this is my test classs
RevenuewithDatecriteriainExcel revenueexcel = new RevenuewithDatecriteriainExcel();
   
        revenueexcel.fDate  = null;
        revenueexcel.tDate = null;
         revenueexcel.mainlogic();
         revenueexcel.search();
         revenueexcel.getfetchRevenueByMonth();
         revenueexcel.appendEmptyOpportunities();
         revenueexcel.createRevenueByMonth();
         
        
       
        revenueexcel.fDate  = date.valueof('2014-01-01');
        revenueexcel.tDate = date.valueof('2014-12-31');
         revenueexcel.mainlogic();
         revenueexcel.search();
         revenueexcel.getfetchRevenueByMonth();
         revenueexcel.appendEmptyOpportunities();
         revenueexcel.createRevenueByMonth();

Now i nedd to pass the parmeters of Myvariable1, Myvariable2 in the test class to cover my test class
please help me

 
I am having trouble displaying fields on my visualforce page when I add it to the site. I have checked all the public access settings and the field level security, they are both set as they should be. It is like I do not have access to the object itself. When I do <apex:inputField value="ObjectName.Field__c" /> it shows up in the visualforce page but not the site. We are using record types for this object but everything seems to be fine there as well. Does anyone have any expirence with this?

Thanks!
Hi,
Is it possible to stop the execution of the flow in apex classes / triggers so that I could put a breakpoint in the apex class and when I hit the breakpoint in the class it would stop the execution and I could step thru the code in the Eclipse IDE and inspect the variables ?
This is a very good way of learning how the code works and which code is executed in different scenarios.
This is possible in non-cloud normal app development with Java
I know that it is possible to set debug log statements in the code and then run thru the code and it would print the result but this is not nearly as easy as stepping thru the code.
Thanks, Jani
  • January 14, 2014
  • Like
  • 4

As I am going thru the Force.com Workbook, I reach the REST API example. I am using cURL with the following cmd:

 

curl -s -H 'Authorization: OAuth token ...'

https://na15.salesforce.com/services/data/v29.0/analytics/reports/00Oi0000004tH4I

 

But I am getting "INVALID_SESSION_ID"

 

The tutorial doesnt cover authenticating. Any ideas?

Please help me. Becuase im very new to sales force. how i can solve this problem

global with sharing class SaveExpenditureWebService {

webservice static Expenditure__c createExpenditure(Decimal amount,String expName, String paidByName )
{

Expenditure__c c = new Expenditure__c();
Person__c p = [Select p.Name From Person__c p Where Name = :paidByName limit 1];
c.Amount__c = amount;
c.Name__c = expName;
c.Exp_Date__c = Date.today();
c.Paid_By__c = p.Id;
insert c;
return c;
}

}

I have a site that has solutions on it.  If you log into the system and pull up the visualforce page you can see all of the fields for the solutions on the page.  But if you pull up the site that is linked to that visualforce page all Custom Fields on Solutions do not show up.  I have gone through all the permissions and everything is correct as far as I can tell.  Anyone have any idea why this might be happening?

Hey everyone, I've got this Apex class that I swear should work:

 

Global class Page1TaskReadyTriggerDate implements Schedulable {
  global void execute (Schedulablecontext SC){
    
    Page1Task__c[] tasksToUpdate = new Page1Task__c[]{};
    
  date myDate = system.today();
  
  Page1Task__c[] readyTasks = ([SELECT ID, Status__c FROM Page1Task__c 
                WHERE Ready_Trigger_Date__c != NULL
                AND Ready_Trigger_Date__c <= :myDate
                AND Status__c = '1) Not Started']);
          
  for (Page1Task__c rt : readyTasks){
    if (rt.Status__c != null){
    rt.Status__c = '2) Ready';
    tasksToUpdate.add(rt);      
    }
  }
  
  
  update tasksToUpdate;
  
  }
}

 

When I use the baked-in apex scheduler in Salesforce, it will run on the day I set it - but fails on subsequent days. For instance, I set it to run each day at 6am. It will run that day at 6am and set all of my fields accordingly. It fails on subsequent days. Is there something I'm missing or should this be rewritten?

 

Edit: It actually only runs the day the class was generated. It's not getting the system date on subsequent days, Creating a second scheduled apex job results in nothing, but rebuilding the class and scheduling works fine.

  • August 06, 2012
  • Like
  • 1

How can make ajax request using jQuery in VisulForce to Apex ?

 

Example

 $.ajax({

type :"POST",
url :'Apex-url',
dataType :"json",
success:function(data){
alert( data );
},
error :function(){
alert("Sorry, The requested property could not be found.");
}
});

I'm trying to save the following custom list controller, but I' getting the error:  aggregate results cannot be used in a batch query

 

public class summaryListCon {
// ApexPages.StandardSetController must be instantiated
// for standard list controllers
public ApexPages.StandardSetController setCon {
get {
if(setCon == null) {
setCon = new ApexPages.StandardSetController(Database.getQueryLocator(

[SELECT 
Trans__c.Transaction__r.Equipment__r.Name Equipment
,Trans__c.Location__r.Location_Type__r.Name LocType
,Trans__c.Location__r.Account__r.Name  Account
,Trans__c.Location__r.Name Location
,SUM(Qty__c) Qty,Sum(Product_Days__c) Product_Days
from Trans__c
GROUP BY
Trans__c.Transaction__r.Equipment__r.Name
,Trans__c.Location__r.Location_Type__r.Name 
,Trans__c.Location__r.Account__r.Name 
,Trans__c.Location__r.Name
]

));
}
return setCon;
}
set;
}
// Initialize setCon and return a list of records
public List<SObject> getSummary() {
return (List<SObject>) setCon.getRecords();
}
}

 How can I use aggregate results on a VisualForce page?

Thanks!

I have created a class implementing Schedulable and have created a batch job to run at 9 pm every day. The job is available at Setup-> Monitoring -> Scheduled Jobs. I have added System.Debug statements in my class for traceability purpose in case of any issues. But I am unable to figure a way to get/mail the debug logs for the same. Can you please let me know what Setting should be set in order to get the debug logs for the Scheduled Jobs?

  • February 08, 2012
  • Like
  • 2

Hey,

 

When I use System.Schedule() to schedule an Apex job, I am experiencing some strange behavior:

 

* The job does show up on the 'Scheduled Jobs' page on the org, but its 'Manage' link is missing (the only link beside the job entry is 'Del').

 

* According to the 'Scheduled Jobs' page, the job does run at the scheduled time, but there is no evidence anywhere else in the org that the job actually run.  No debug logs appear and none of the side-effects of the job appear on the org.  I even stubbed out the class' execute() method with a System.assert ( False ) statement, to make it throw out an error email, but that doesn't happen either.  It definitely seems like nothing at all is being executed.

 

When I schedule the job via the UI (Develop -> Apex Classes -> Schedule Apex), it runs fine as expected.

 

Why is this?

 

(and why oh why is the page behind the 'Manage' link read-only??)

 

Thanks

  • October 27, 2011
  • Like
  • 2

Hi,

 

I am trying to retrive opps created between 01-01-2011 and 06-30-2011.

 

Select o.CreatedDate, o.Id, o.LastModifiedDate,  from Opportunity o where   o.CreatedDate > '1/1/2011' and o.CreatedDate <  '12/31/2011'order by  o.LastModifiedDate

 since createdate is a datetime i get a error saying createdDate is datetime and should not be enclosed in quotes.

Can someone help on how to get this query working

 

Thanks

Prady

  • July 12, 2011
  • Like
  • 1

Hello All-

 

I scheduled the following schedulable class and I am getting a strange error...

 

|EXCEPTION_THROWN|[18]|System.StringException: Support for specifying both a day-of-week AND a day-of-month parameter is not implemented.

 

Code:

 

global class ICG_FixDuplicateLeadsProcessorExtends implements Schedulable{
    
    // global method - execute
    // Call Batch method
    global void execute(SchedulableContext sc) {
        //  Instantiate class
         ICG_FixDuplicateLeadsProcessor FixDuplicateLeadsProcessor = new  ICG_FixDuplicateLeadsProcessor();
        String seconds = '0'; //Execute at Zero Seconds
        String minutes = '30'; //Execute at every 30th minute of hour
        String hours = '*'; // Execute Every Hour
        String dayOfMonth = String.valueOf(Datetime.now().day()); // Execute on current Day of the current Month
        String month = String.valueOf(Datetime.now().month()); //Execute current Month
        String dayOfWeek = '';
        if(Datetime.now().day()>7)
            dayOfWeek = String.valueOf((Datetime.now().day()/7));
        else
            dayOfWeek = String.valueOf(Datetime.now().day());
        String year = String.valueOf(Datetime.now().year()); //Execute only for year 2011

    //Seconds Minutes Hours Day_of_month Month Day_of_week optional_year
        String sch = seconds + ' ' + minutes + ' ' + hours + ' ' + dayOfMonth + ' ' + month + ' ' +dayOfWeek+ ' ' + year;
    //String sch = '0 30 * 5 5 ? 2011';
system.debug('Scheduled time string---->>>>>'+sch);
system.schedule('Fix Duplicate Leads', sch, FixDuplicateLeadsProcessor);
        //database.executebatch(FixDuplicateLeadsProcessor,200);
    }
    
}

 

If I remove the "dayofWeek" from the string sch i get the following error...

EXCEPTION_THROWN|[18]|System.StringException: Day-of-Week values must be between 1 and 7

 

Any thoughts?

 

Thanks

 

Dear All,

 

I have the problem on SOQL to select past Event from below command but it does not compare the time , i tried system.now() but it did not work.

 

Could you please advise .

 

Select ActivityDateTime  From Event where whatid=:tsk.whatid and  
            what.type = 'Account' and ActivityDateTime <> null and    ActivityDateTime >=LAST_N_DAYS:0  

 

Thank you very much in advance for your help.

 

Best Regards

Anong         

  • January 04, 2011
  • Like
  • 1

Dear Product Manager in charge for the "Apex Scheduler",

 

I was wondering why my code did not worked when scheduled. After requesting the debug logs, I could see the following:

 

 

EXCEPTION_THROWN|[45,19]|System.CalloutException: Callout from scheduled Apex not supported.

 

Here are my questions:

 

1. Is this going to be officially changed?

2. Is there a workaround?

3. Did I missed something in the documentation or is it simply not written down there?

 

Quite disappointed,

 

Hannes

 

  • March 12, 2010
  • Like
  • 1

Hi I have a vpage as follows..


<apex:outputLabel style="font-weight:bold;" value="Search By Branch Code" ></apex:outputLabel>
        <apex:inputText value="{!textData}"/>

 

Iam trying to pass this input textfield value(what ever i enter) to the controller by using getters and setters but iam not able to pass the value its passing  just anull value

 

Getters and setters as below

 

private String textdata = null;

    public String getTextData() { return textdata; }
    public void setTextData(String data) { textdata = data; }
 

 So Some one plz help me in passing myy in put field value to controller so that i want to use that value in my soql query

 

Eg:

CAF_Bank__c [] currentbanknames=[SELECT  Bank_Name__c FROM CAF_Bank__c  where Branch_Code__c=:textdata];

            So plz tell me with an example.............

 

       

 

                                                                                                    Thanks& Regards

                                                                                                          Anu...

Hi, 

 

I have been through the visualforce documentation and although it has helped me a great detail in being able to provide a custom list of all my events, I would still like to build an if/then statement. Depending on a certain event name I would like the text to be bold for example. Does anyone know what code I can use? Below is my code

 

<apex:page controller="EventController" showHeader="false"> 

 

 

  <apex:repeat value="{!Events}" var="event" id="event_id">

 

      <p><a href="/apex/event_details?id={!event.id}">{!event.name}, {!event.Event_Date__c}</a>

      <br/>Description:&nbsp;{!event.Description__c }

 

    if {!event.name} = "marathon" then ....

 

</p><hr/>

 

  </apex:repeat>

                          

 

</apex:page> 

  • June 05, 2009
  • Like
  • 1