• anjs2976
  • NEWBIE
  • 0 Points
  • Member since 2009

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

Hello ,

 

I have an approval process on Quote that locks the Quote record. While the record is locked/not approved, we want to restrict user to perform actions on Quote like Create PDF via Create PDF button on quote detail page.

 

On looking at Create PDF page, looks like it is making a function call and the URL of the page is not accessible to us which we could have used in custom vfp page and redirected to standard page reference if the record is approved else

show a popup.

 

Is it possible? I have researched quite a bit but did not find any clue. Its a critical requirement for us hence in case anybody has any idea please let me know

 

Thanks

 

Hello,

 

My requirement is to delete all the completed scheduled jobs (becoz of 10 limit in org) and then kick off a process every n minutes.

 

Somehow I am not getting any job in completed state although some of the jobs have run in past. All the jobs show in Waiting state.


Here is the sample code (where i am deleting all jobs which is not right ) :

 

List<CronTrigger> completedJobs =[Select c.State, c.EndTime, c.OwnerId, c.Id,c.TimesTriggered, c.NextFireTime,
    c.CronExpression From CronTrigger c ];

 

 //where c.State = 'Completed'
    //where c.EndTime < :currentTime
    
    try{
        System.debug('Scheduled Job Size is ::'+completedJobs.size());
        for(CronTrigger cronJob:completedJobs){
            System.debug(':: Job to Abort::'+String.valueOf(cronJob) + ' c.TimesTriggered ' + cronJob.TimesTriggered
            + ' c.NextFireTime ' +cronJob.NextFireTime);


           // to exclude current job to be deleted

           if(cronJob.Id !=triggerId ) {
                System.abortJob(cronJob.id);
                System.debug(':: Job aborted ::'+String.valueOf(cronJob) );
            }
            else
            {
                System.debug(':: Cannot abort this Job ::'+String.valueOf(cronJob) );
            }
        } 

 

I am stuck so as to how to identify completed jobs and then delete them.

 

Is it some sfdc bug that the schedule job is never shown in completed state? Can anybody let me know if I am missing something?

 

thanks

Anjali

Hello,

 

We have a requirement wherein we want to retrieve all the  ListViews that have been created for a custom object , say MyObject__c and then display these ListViews on my visualforce page.

 

Metadata API provides ListView object to retrieve metadata information related to a ListView.

 

[Please have a look at Metadata api developer guide - and look for ListView in it. ]

 

But the question is how to access and get all the listviews of a custom object and display them on my visual force page ? 

This question seems to be a hot issue and I can find lot of posts related to this but with no responses.

 

Can somebody please provide any inputs, links or sample example on this.  

 

 

Hello ,

 

I have an approval process on Quote that locks the Quote record. While the record is locked/not approved, we want to restrict user to perform actions on Quote like Create PDF via Create PDF button on quote detail page.

 

On looking at Create PDF page, looks like it is making a function call and the URL of the page is not accessible to us which we could have used in custom vfp page and redirected to standard page reference if the record is approved else

show a popup.

 

Is it possible? I have researched quite a bit but did not find any clue. Its a critical requirement for us hence in case anybody has any idea please let me know

 

Thanks

 

Hello,

 

My requirement is to delete all the completed scheduled jobs (becoz of 10 limit in org) and then kick off a process every n minutes.

 

Somehow I am not getting any job in completed state although some of the jobs have run in past. All the jobs show in Waiting state.


Here is the sample code (where i am deleting all jobs which is not right ) :

 

List<CronTrigger> completedJobs =[Select c.State, c.EndTime, c.OwnerId, c.Id,c.TimesTriggered, c.NextFireTime,
    c.CronExpression From CronTrigger c ];

 

 //where c.State = 'Completed'
    //where c.EndTime < :currentTime
    
    try{
        System.debug('Scheduled Job Size is ::'+completedJobs.size());
        for(CronTrigger cronJob:completedJobs){
            System.debug(':: Job to Abort::'+String.valueOf(cronJob) + ' c.TimesTriggered ' + cronJob.TimesTriggered
            + ' c.NextFireTime ' +cronJob.NextFireTime);


           // to exclude current job to be deleted

           if(cronJob.Id !=triggerId ) {
                System.abortJob(cronJob.id);
                System.debug(':: Job aborted ::'+String.valueOf(cronJob) );
            }
            else
            {
                System.debug(':: Cannot abort this Job ::'+String.valueOf(cronJob) );
            }
        } 

 

I am stuck so as to how to identify completed jobs and then delete them.

 

Is it some sfdc bug that the schedule job is never shown in completed state? Can anybody let me know if I am missing something?

 

thanks

Anjali

Is there any way to change or delete a Scheduled Job ?  I am able to create one easily enough, but once it is made I can only look at the values in the CronTrigger object, but not update them.  Also, it seems I cannot delete them.  I also looked at the System.AbortJob method, but that seems to only stop a job that is already running - I get an error if I try it on a Queued job.

 

The reason I am doing this is to try to create a 'sliding' job.  So, when a trigger is fired the job will run in 5 minutes.  But if the trigger is fired again before that 5 minutes is up, it will find the old job and either delete it and make a new one for 5 minutes out, or update the old one so the next scheduled time is in 5 minutes.

 

Any ideas are welcome!

 

Jason

 

 

Hello,

 

We have a requirement wherein we want to retrieve all the  ListViews that have been created for a custom object , say MyObject__c and then display these ListViews on my visualforce page.

 

Metadata API provides ListView object to retrieve metadata information related to a ListView.

 

[Please have a look at Metadata api developer guide - and look for ListView in it. ]

 

But the question is how to access and get all the listviews of a custom object and display them on my visual force page ? 

This question seems to be a hot issue and I can find lot of posts related to this but with no responses.

 

Can somebody please provide any inputs, links or sample example on this.  

 

 

Hello everyone, just wanted to share with the community this custom component I made and give something back for the help I've received. :smileyhappy:

The purpose of the component is to enable autocomplete in lookup fields. I used the autocomplete js created by Jim Roos:
(http://www.jimroos.com/2007/05/ajax-autocomplete.html) but made some modifications to it so that it could interact with an Apex controller among some other things...

So my idea was that if you were making a VF page that had an inputfield that was related to a lookupfield you would just insert this autocomplete component to that inputfield. Something like this:

Code:
           <apex:inputField value="{!Contact.accountid}" id="accname" styleClass="cField">
<c:autocomplete ObjectName="Accounts" InputId="{!$Component.accname}" AutoCompleteId="accACid" ClassName="autocomplete300"/>
</apex:inputField>

The component has 4 parameters:

The name of the object or custom object that the inputfield relates to (new objects must be added inside the apex classes since i had some problems constructing a dynamic query).
The InputId which is used to relate the component to the input field
The id for the Component
A classname parameter that basically just defines the width of the suggestions menu.

Here's a screenshot of how it looks like in action:




Here's a link to the file containing the required files:

AutoCompleteComponent



Jonathan.


Message Edited by jonathan rico on 08-16-2008 01:55 PM

Message Edited by jonathan rico on 08-17-2008 09:04 AM
Message Edited by jonathan rico on 01-02-2010 05:01 PM