• Vivo
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 16
    Replies

Hi,

 

For my app, I have a requirement to let users basically create a plan "schedule" that runs an apex class once every X hours for Y days. I am looking into schedulers right now and it seems like there is a limit of 100 on scheduled jobs. Most places say to make it so the scheduler class actually reschedules itself i.e. If it's once every 24 hours, then once it is run it reschedules itself again to run in another 24 hours. However, what happens if my users have created over 100 plan schedules? Doesn't this mean that there need to be more than 100 scheduled jobs, since each schedule has a job that reschedules itself?

 

What is the best approach to this? 

 

Thanks for any advice or help!

-Vivo

  • August 12, 2013
  • Like
  • 0

Hi,

 

I am losing the CSS styling when I rerender any buttons or use the render= attribute inside components. Does anyone know why this is? I am reading at places that it is due to a loss of html5 tags on the component, but I am unsure how to fix it.

 

Thanks.

  • July 09, 2013
  • Like
  • 0

Hi, I am currently trying to create an XML template that gets downloaded when the user goes to the page. It works just fine if I don't use the '<?xml version="1.0" encoding="UTF-8"?>" text within the page. But when I do I get this error:

 

Error: XMLTest line 2, column 6: The processing instruction target matching "[xX][mM][lL]" is not allowed  

Error: The processing instruction target matching "[xX][mM][lL]" is not allowed.

 

 

Is there anyway to make this work? It seems like some others had this problem a long time ago, but I couldn't find any solutions that worked.

 

 

 

<apex:page controller="xmlPage" contentType="application/octet-stream#Run.exml"><?xml version="1.0" encoding="UTF-8"?>
<agentdriver>
</agentdriver>
</apex:page>

 

  • June 19, 2013
  • Like
  • 0

Hi guys, I am very new to data integration and could really use some help.

 

One of my visualforce page requires me to query a table from an external database. I'm seeing mixed answers here and there but cannot really figure out what to do.

An example code I am supposed to base my code like uses JDBC drivers to do it such as Connection, registerDriver,getConnection and so on.

 

What is the best way to implement a simple code that queries a table from an external database? The user/pass and all that stuff is given.

 

Thanks.

 

 

Some sample code I have from another site:

DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); 
conn1 = DriverManager.getConnection(dbUrl, userName, pwd); 


stmt = conn1.createStatement();
rs = stmt.executeQuery("select username, entg_utils.getDataSourcePassword(datasource_id), datasource_url from entg_test_data_sources "+
   "where datasource_id = "+dataSource );
rs.next();
userName = rs.getString(1);
pwd = rs.getString(2);
dbUrl = rs.getString(3);
stmt.close();

 

qid = -1;
stmt = conn1.createStatement();
rs = stmt.executeQuery("select query_id from entg_test_data_queries where query_text = '"+query.replaceAll("-PERC-","+").replaceAll("-PLUS-","+").replaceAll("'","''")+"'");
if (rs.next()) 
  qid = rs.getInt(1);
stmt.close();

 conn = DriverManager.getConnection(dbUrl, userName, pwd); 
 stmt = conn.createStatement();
 rs = stmt.executeQuery(query.replaceAll("-PERC-","+").replaceAll("-PLUS-","+"));

} catch (Exception ex) {
  success=false;
  errMsg = ex.getMessage();
}

 

  • June 16, 2013
  • Like
  • 0

Hi,

 

i am attempting to have a page in which the user can query some datasets from other databases using user/pass. The old code that was working on another site uses stuff like 

conn1 = DriverManager.getConnection(dbUrl, userName, pwd);

stmt = conn1.createStatement();
rs = stmt.executeQuery("");

 

And so on. Is there a way to use this same stuff on a visualforce page? If so, how do I import the java.sql and so on onto the apex class?

 

Or does salesforce have it's own way of connecting to stuff like this?

 

I am pretty new to this side of development, so any help is good.

 

Thanks!

  • June 16, 2013
  • Like
  • 0

Hi,

 

I have a dynamic object edit page that takes an object's name and then displays all of the fields that it has dynamically. However, it seems like the order in which these fields are displayed is somewhat random (It is not alphabetically ordered like in the schema, and it is not ordered the same that it is displayed in the object itself).

 

Does anyone know where this ordering is coming from? I want to retain a dyamic edit page without manually having to re-order the fields for each object (Which destroys the utility of a dynamic object edit page anyways). 

 

Thanks,

Vivo

  • June 13, 2013
  • Like
  • 0

Hi,

 

For the lookup dialog window that pops up when inputting a lookup relationship in an object, the window that shows up is themed to be light blue and white (standard theme). Is there a way to make the style on this lookup window?

 

I know I can roll my own lookup window, and I've done it for some of the other fields, but there are a ton that I don't really want any changes done except changing the background color itself. Is there an option to change that through salesforce? Or is creating a dynamic lookup the only way?

 

Thanks,

Vivo

  • June 13, 2013
  • Like
  • 0

Hi,

 

I have a CSV generating page set up right now, that I run from another page when they click the generate button. It is opening up the page and starting the download, but the blank page that it downloads from is being opened and stays open. Is there a way to make the page automatically close itself once the download begins?

 

<apex:page controller="csvController" cache="true" 
contentType="text/csv#filename.csv" language="en-US">



{!headers}



</apex:page>

 

  • June 01, 2013
  • Like
  • 0

Hi, 

I have created a select screen where the user selects a type of object and then can download a CSV that is created on a different page based on parameters of the object. Everything is working fine except for when I try to use window.open() from this page to open up the page that automatically downloads the CSV.

The error I am getting is:

java.lang.IllegalArgumentException: Illegal view ID window.open(/apex/generatespreadsheet?id=a08i0000000SFrtAAG). The ID must begin with /

 

If I copy the URL in the window.open to the browser, it works fine.

 

I'm not quite sure what the problem is about, but I've tried numerous ways to solve it. 

 

Anyone here have any thoughts?

Thanks.

 

<apex:page controller="DownloadCSV" tabstyle="Function__c" showHeader="false" sidebar="false">
<script>
 function closeSearchWindow()
 {
    window.close();
 }
 function x(){
 calldownloader();
 }
</script>
<apex:form >
<apex:actionFunction name="calldownloader" action="{!downloader}" rerender=""/>
 <apex:pageblock title="Data Spreadsheet" mode="edit" id="Everything">
<apex:pageBlockSection columns="1">
        <apex:pagemessages />
        <apex:inputField value="{!sheet.Scenario__c}" required="true"  onChange="x();"/>
      <apex:commandbutton rerender="Everything" value="rerender" />
         <apex:commandbutton action="window.open('{!placetogo}')" value="Create" />
 </apex:pageblocksection>
 
  </apex:pageblock>
  </apex:form>
</apex:page>

 

public class DownloadCSV {
public Data_SpreadSheet__c sheet{get;set;}
public String placetogo{get;set;}
Pagereference pref{get;set;}

public DownloadCSV(){
sheet=new Data_SpreadSheet__c();
}

public void downloader(){

pref = new Pagereference('/apex/generatespreadsheet?id='+sheet.Scenario__c);

placetogo='/apex/generatespreadsheet?id='+sheet.Scenario__c;

}

}

 

 

 

  • May 30, 2013
  • Like
  • 0

Hi,

 

I am using the Jquery dialog box on one of my pages that pulls up a list of custom objects from the database. I am trying to incorporate a search inside of that dialog box with an input text which is working oddly right now. Once I put in the search parameters and hit search, I have the dialog box close, and rerender and then open again so that the list it pulls up will be updated. However, it is not updating the list. If I close the dialog box and rerender the whole page with another button and pull it up again, then the list IS updated. I am unsure what to do to get the correct functionality.

 

Steps:

1) User opens dialog box

2) User types in search parameter and hits 'Search'

3) Javascript closes the dialog box

     Javascript pulls the parameter value and constructs a query. Then it calls actionfunction "searcherd" and passes the query along.

4) Actionfunction searcherd calls apex method searcherf that updates the list (Actionfunction also rerenders everything)

5) Javascript opens the dialog box

 

 

Does anyone know how to make this function correctly?

 

This is my dialog box:

<div id="dialog" title="Add Functions">
<apex:form >
  

  <button id="Add">Add</button>
  <apex:outputText > {!db} </apex:outputText>
    <input type="text" id="SearchName"/>
     <button id="searchfu">search</button>
    
 <table id="addfuncs" class="func">     
 <tr>
<th>Function Name</th>
<th>Function Type</th>
<th>Description</th>
<th>Parameters</th>

</tr>
<tbody>

<apex:repeat id="allfunctionslist" value="{!AllFunctions}" var="f">
    <tr id="{!f.id}">
      
        <td style="text-align:center;" >
      {!f.name}  
      </td>
   
      <td>
      {!f.Function_Type__r.name}  
      </td>
      
       <td > {!f.Description__c}  </td>
       
       <td >
       <apex:repeat value="{!f.TEST_PARAMETERS__r}" var="p">
       {!p.name} ( {!p.Type__c} ) <br/>
       </apex:repeat>
       </td>
      
</tr>

  </apex:repeat>    
</tbody>
  
</table>


</apex:form>
    </div>

 

This is the function that runs when the search button is clicked:

$(function() {
    $( "#searchfu" )
      .button()
      .click(function( event ) {   
               $( "#dialog" ).dialog( "close" );
          var x = 'Select name,id,description__c,Function_Type__r.name,(select name,id,Default_Value__c,Type__c,Description__c from TEST_PARAMETERS__r) FROM Function__c WHERE name LIKE \''+document.getElementById("SearchName").value+'%\' order by name';

            searcherd(x); 
          
              $( "#dialog" ).dialog( "open" );
          
       
      });
  });

 

This is the actionfunction called by the javascript&colon;

 

  <apex:actionFunction name="searcherd" action="{!searcherf}" rerender="dialog,addfuncs">
        <apex:param name="qry" value="" />
        </apex:actionFunction>

 

 

 

 

 

This is the function on the apex-side that gets called to update the list

 public void searcherf(){
  
    n = ApexPages.currentPage().getParameters().get('qry');
   
      
       
    AllFunctions=Database.query(n);
   
    }

 

  • May 30, 2013
  • Like
  • 0

Hi,

 

I have constructed a dynamic edit/new/view page that gets the fields of an object dynamically based on the id of the object passed in the URL. 

 

When I list out the fields on the visualforce page, it seems as if the order of the fields is random? How is this order chosen?

On the schema builder, the fields are shown in alphabetical order.

 

 Schema.DescribeSObjectResult r1 = sObjType.getDescribe();  
         
          
        Map<String , Schema.SObjectField> mapFieldList = r1.fields.getMap();  
        Integer i = 0;  
        fieldnames='';
        for(Schema.SObjectField field : mapFieldList.values())  
            {  
                Schema.DescribeFieldResult fieldResult = field.getDescribe();  
                fieldnames+=field + ' ,';
                if(fieldResult.isNameField()){
                        namefield= fieldResult.getName();  
                        }
                        else{
                if(fieldResult.isAccessible() && fieldResult.isUpdateable() && !fieldResult.isDefaultedOnCreate())  
                    {  
                        
                   
                        listObjectFields.add(fieldResult.getName());  
                        }
                    }  
                
            
          }    

 

  • May 23, 2013
  • Like
  • 0

Hi,

 

Right now I have a query that looks like:

select id,name, Description__c, Enabled__c,(SELECT name,id,function__c,scenario__c from functions__r order by name) from Scenario__c where Scenario__c.name != null order by Name asc limit 20

 

but I would like to add a clause to it that let's me filter out Scenarios that contain certain functions in it's funcrions__r related list.

 

I thought I would do it like:

select id,name, Description__c, Enabled__c,(SELECT name,id,function__c,scenario__c from functions__r order by name) from Scenario__c where Scenario__c.name != null and functions__r.name LIKE 'Name%' order by Name asc limit 20

 

but it does not seem to be working. Has anyone dealt with querying from within a queried list like this? How should it be done?

 

 

Thanks

  • May 02, 2013
  • Like
  • 0

Hi,

 

Right now I have a Car__c custom object which has a many-to-many relationship with Feature__c, (the relationship is under an object named Car_Features__c).

 

In my code, on the visualforce side I have outputted {!Car__c.Features__r} which shows the correct related list under the car. (Shows the ids of the features in the car)

But when I do the same thing on the apex side and try to output it, the list is empty:

 

selectedCar is the Id parameter delivered from the visualforce side via commandlink.

 

CurrentCar = [SELECT Id,Name,Description__c FROM Car__c
WHERE Id = :selectedCar];

 

String msg = ' ';

 

List<Car_Features__c> CurrentFeats = CurrentCar.Features__r;

msg += CurrentFeats;

Return msg;

 

The msg should output the id's of the Car_Features__c in the related list, the same  way that the  {!Car__c.Features__r} call on the visualforce side does. 

However, the output shows msg to be empty, but printing out the Id of CurrentCar prints the correct car Id, so that is not the issue.

 

Any ideas?

 

Thanks.

  • April 17, 2013
  • Like
  • 0

Hi,

 

I have implemented a case in which a user can select a list of Feature object to add to a Car object. Right now ,the apex code generates a dynamic list of feature objects that the user can select and add to a custom list. My problem is that I would like this list to be tied to the Car object permanently after the user makes it (right now if the user refreshes the page, everything is reset and the list is emptied). How do I go about making this apex variable persistant to the custom object? Essentially it would be a List variable that gets saved into the database with the Car Object, kind of how the custom fields are.

 

Thanks!

  • April 16, 2013
  • Like
  • 0

Hi,

 

I am looking for a way to access and manipulate the related list of an object directly from a visualforce page. I want to be able to access each object as if it was in an array or a list, and remove or add them. i.e. Related List[1] = Feature X and so on. 

 

For example, let's say I have an object Car with a many-to-many relationship to object Feature.

 

Car A -> Has features : Leather Seat, Xeon Lights, Premium Package.

 

On Car A's page, I would like to pull up a shuttle box that lets me add/remove features on the fly.

 

Can anyone point me in the right direction?

 

Thanks!

 

 

 

 

  • April 16, 2013
  • Like
  • 0

Hi,

 

I have an object "Workout" that has a master-detail relationship to an object 'Excercise'. I have created a visualforce to give the user a view/edit of Object Workout, but I am trying to let them choose Excercises to add in, but also order the excercises in any way that they want. Is there a way I can save the order they choose and save it to display it that way again? A shuttlebox such as the one you use when you pick which details you see on a related object would be perfect as that has an add/remove and an move up/down button.

 

This does not mean that different users will have different order of exercises in the SAME workout object, it just means that the workout object has a set order for the excercises that appear within it, that can be re-ordered anytime by it's creator. It seems like right now, one would have to delete all the excercises within the workout and then add them in the new order they want. This is very tedious, so I was hoping someone could point me to a solution that's better?

 

Thanks!

  • April 10, 2013
  • Like
  • 0

Hi,

 

I am losing the CSS styling when I rerender any buttons or use the render= attribute inside components. Does anyone know why this is? I am reading at places that it is due to a loss of html5 tags on the component, but I am unsure how to fix it.

 

Thanks.

  • July 09, 2013
  • Like
  • 0

Hi,

 

i am attempting to have a page in which the user can query some datasets from other databases using user/pass. The old code that was working on another site uses stuff like 

conn1 = DriverManager.getConnection(dbUrl, userName, pwd);

stmt = conn1.createStatement();
rs = stmt.executeQuery("");

 

And so on. Is there a way to use this same stuff on a visualforce page? If so, how do I import the java.sql and so on onto the apex class?

 

Or does salesforce have it's own way of connecting to stuff like this?

 

I am pretty new to this side of development, so any help is good.

 

Thanks!

  • June 16, 2013
  • Like
  • 0

Hi,

 

I have a dynamic object edit page that takes an object's name and then displays all of the fields that it has dynamically. However, it seems like the order in which these fields are displayed is somewhat random (It is not alphabetically ordered like in the schema, and it is not ordered the same that it is displayed in the object itself).

 

Does anyone know where this ordering is coming from? I want to retain a dyamic edit page without manually having to re-order the fields for each object (Which destroys the utility of a dynamic object edit page anyways). 

 

Thanks,

Vivo

  • June 13, 2013
  • Like
  • 0

Hi,

 

I have a CSV generating page set up right now, that I run from another page when they click the generate button. It is opening up the page and starting the download, but the blank page that it downloads from is being opened and stays open. Is there a way to make the page automatically close itself once the download begins?

 

<apex:page controller="csvController" cache="true" 
contentType="text/csv#filename.csv" language="en-US">



{!headers}



</apex:page>

 

  • June 01, 2013
  • Like
  • 0

Hi, 

I have created a select screen where the user selects a type of object and then can download a CSV that is created on a different page based on parameters of the object. Everything is working fine except for when I try to use window.open() from this page to open up the page that automatically downloads the CSV.

The error I am getting is:

java.lang.IllegalArgumentException: Illegal view ID window.open(/apex/generatespreadsheet?id=a08i0000000SFrtAAG). The ID must begin with /

 

If I copy the URL in the window.open to the browser, it works fine.

 

I'm not quite sure what the problem is about, but I've tried numerous ways to solve it. 

 

Anyone here have any thoughts?

Thanks.

 

<apex:page controller="DownloadCSV" tabstyle="Function__c" showHeader="false" sidebar="false">
<script>
 function closeSearchWindow()
 {
    window.close();
 }
 function x(){
 calldownloader();
 }
</script>
<apex:form >
<apex:actionFunction name="calldownloader" action="{!downloader}" rerender=""/>
 <apex:pageblock title="Data Spreadsheet" mode="edit" id="Everything">
<apex:pageBlockSection columns="1">
        <apex:pagemessages />
        <apex:inputField value="{!sheet.Scenario__c}" required="true"  onChange="x();"/>
      <apex:commandbutton rerender="Everything" value="rerender" />
         <apex:commandbutton action="window.open('{!placetogo}')" value="Create" />
 </apex:pageblocksection>
 
  </apex:pageblock>
  </apex:form>
</apex:page>

 

public class DownloadCSV {
public Data_SpreadSheet__c sheet{get;set;}
public String placetogo{get;set;}
Pagereference pref{get;set;}

public DownloadCSV(){
sheet=new Data_SpreadSheet__c();
}

public void downloader(){

pref = new Pagereference('/apex/generatespreadsheet?id='+sheet.Scenario__c);

placetogo='/apex/generatespreadsheet?id='+sheet.Scenario__c;

}

}

 

 

 

  • May 30, 2013
  • Like
  • 0

Hi,

 

I am using the Jquery dialog box on one of my pages that pulls up a list of custom objects from the database. I am trying to incorporate a search inside of that dialog box with an input text which is working oddly right now. Once I put in the search parameters and hit search, I have the dialog box close, and rerender and then open again so that the list it pulls up will be updated. However, it is not updating the list. If I close the dialog box and rerender the whole page with another button and pull it up again, then the list IS updated. I am unsure what to do to get the correct functionality.

 

Steps:

1) User opens dialog box

2) User types in search parameter and hits 'Search'

3) Javascript closes the dialog box

     Javascript pulls the parameter value and constructs a query. Then it calls actionfunction "searcherd" and passes the query along.

4) Actionfunction searcherd calls apex method searcherf that updates the list (Actionfunction also rerenders everything)

5) Javascript opens the dialog box

 

 

Does anyone know how to make this function correctly?

 

This is my dialog box:

<div id="dialog" title="Add Functions">
<apex:form >
  

  <button id="Add">Add</button>
  <apex:outputText > {!db} </apex:outputText>
    <input type="text" id="SearchName"/>
     <button id="searchfu">search</button>
    
 <table id="addfuncs" class="func">     
 <tr>
<th>Function Name</th>
<th>Function Type</th>
<th>Description</th>
<th>Parameters</th>

</tr>
<tbody>

<apex:repeat id="allfunctionslist" value="{!AllFunctions}" var="f">
    <tr id="{!f.id}">
      
        <td style="text-align:center;" >
      {!f.name}  
      </td>
   
      <td>
      {!f.Function_Type__r.name}  
      </td>
      
       <td > {!f.Description__c}  </td>
       
       <td >
       <apex:repeat value="{!f.TEST_PARAMETERS__r}" var="p">
       {!p.name} ( {!p.Type__c} ) <br/>
       </apex:repeat>
       </td>
      
</tr>

  </apex:repeat>    
</tbody>
  
</table>


</apex:form>
    </div>

 

This is the function that runs when the search button is clicked:

$(function() {
    $( "#searchfu" )
      .button()
      .click(function( event ) {   
               $( "#dialog" ).dialog( "close" );
          var x = 'Select name,id,description__c,Function_Type__r.name,(select name,id,Default_Value__c,Type__c,Description__c from TEST_PARAMETERS__r) FROM Function__c WHERE name LIKE \''+document.getElementById("SearchName").value+'%\' order by name';

            searcherd(x); 
          
              $( "#dialog" ).dialog( "open" );
          
       
      });
  });

 

This is the actionfunction called by the javascript&colon;

 

  <apex:actionFunction name="searcherd" action="{!searcherf}" rerender="dialog,addfuncs">
        <apex:param name="qry" value="" />
        </apex:actionFunction>

 

 

 

 

 

This is the function on the apex-side that gets called to update the list

 public void searcherf(){
  
    n = ApexPages.currentPage().getParameters().get('qry');
   
      
       
    AllFunctions=Database.query(n);
   
    }

 

  • May 30, 2013
  • Like
  • 0

Hi,

 

Right now I have a query that looks like:

select id,name, Description__c, Enabled__c,(SELECT name,id,function__c,scenario__c from functions__r order by name) from Scenario__c where Scenario__c.name != null order by Name asc limit 20

 

but I would like to add a clause to it that let's me filter out Scenarios that contain certain functions in it's funcrions__r related list.

 

I thought I would do it like:

select id,name, Description__c, Enabled__c,(SELECT name,id,function__c,scenario__c from functions__r order by name) from Scenario__c where Scenario__c.name != null and functions__r.name LIKE 'Name%' order by Name asc limit 20

 

but it does not seem to be working. Has anyone dealt with querying from within a queried list like this? How should it be done?

 

 

Thanks

  • May 02, 2013
  • Like
  • 0

Hi,

 

I have implemented a case in which a user can select a list of Feature object to add to a Car object. Right now ,the apex code generates a dynamic list of feature objects that the user can select and add to a custom list. My problem is that I would like this list to be tied to the Car object permanently after the user makes it (right now if the user refreshes the page, everything is reset and the list is emptied). How do I go about making this apex variable persistant to the custom object? Essentially it would be a List variable that gets saved into the database with the Car Object, kind of how the custom fields are.

 

Thanks!

  • April 16, 2013
  • Like
  • 0

Hi,

 

I am looking for a way to access and manipulate the related list of an object directly from a visualforce page. I want to be able to access each object as if it was in an array or a list, and remove or add them. i.e. Related List[1] = Feature X and so on. 

 

For example, let's say I have an object Car with a many-to-many relationship to object Feature.

 

Car A -> Has features : Leather Seat, Xeon Lights, Premium Package.

 

On Car A's page, I would like to pull up a shuttle box that lets me add/remove features on the fly.

 

Can anyone point me in the right direction?

 

Thanks!

 

 

 

 

  • April 16, 2013
  • Like
  • 0