• sslater
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 10
    Replies

I don't know if this can be done, but let's see if anyone knows how. I need to have at least 2 lists of items on a page. The user can select a bunch (1000s) of records from list1, and select a handful from list2. I will then have a button that says "GO" that does some custom apex magic with the data in these two lists.

 

I know I can manually do this with datatables, soql, etc... But can I leverage the nice apex:listViews object so that I have two of them on a custom page. (this I can do). But then I need my commandButton to "do the magic" with the items selected. I can't see how my apex code can access the items in the lists.

 

In JSF, this would be a binding="" type of deal where I bind the jsf element to a List object in the backing bean.

 

Is there any way for my apex controller to discover which items were selected?

 

Thanks!

Does anyone know how to modify the page layout for reports? I'm trying to put any scontrol, javascript, apex, anything on the page you get when you click to view the results of a report.

 

I saw you can force a sidebar component on each page, but it does not show on the actual results page itself.

 

Anyone have any clue on how to modify that report page itself?

Hi,

 

In the help docs I see the the below at https://na7.salesforce.com/help/doc/user_ed.jsp?section=help&target=security_sharing_considerations.htm&loc=help&hash=d533368e169

 

You cannot change the organization-wide default settings for an object if an Apex script examines the sharing entries associated with that object. For example, if a script retrieves the users and groups who have sharing access on an account (represented as the AccountShare

object in the code), then you cannot edit the organization-wide sharing default for accounts. For more information, see Force.com Apex Code Overview.

 

I have an apex class that does the below, and it then linked to a VF page to display the results. From the paragraph above, it looks like having this code in my DE should prevent me from changing the default sharing for Accounts. But it does not. I can change the default and I see the entries in AccountShare get wipe out when I go to public, then I can add rules when I go back to private, etc... 

 

Does anyone know what the above paragraph in the help docs really means? If I package my class in a managed package, any ideas on how it would impact the installing org? I am building an app to check accountshare, contactshare, leadshare, etc...

 

Thanks!

 

 

public class TestSharing {
    public List<AccountShare> alist {get;set;}
    public TestSharing() {
        alist = [Select a.AccountAccessLevel, a.AccountId, a.Account.AccountNumber, a.Account.AnnualRevenue, a.Account.BillingCity, a.Account.BillingCountry, a.Account.BillingPostalCode, a.Account.BillingState, a.Account.BillingStreet, a.Account.ConnectionReceivedId, a.Account.ConnectionSentId, a.Account.CreatedById, a.Account.CreatedDate, a.Account.Description, a.Account.Fax, a.Account.Id, a.Account.Industry, a.Account.IsDeleted, a.Account.LastActivityDate, a.Account.LastModifiedById, a.Account.LastModifiedDate, a.Account.MasterRecordId, a.Account.Name, a.Account.NumberOfEmployees, a.Account.OwnerId, a.Account.Ownership, a.Account.ParentId, a.Account.Phone, a.Account.Rating, a.Account.shc__Active__c, a.Account.shc__CustomerPriority__c, a.Account.shc__NumberofLocations__c, a.Account.shc__SLA__c, a.Account.shc__SLAExpirationDate__c, a.Account.shc__SLASerialNumber__c, a.Account.shc__UpsellOpportunity__c, a.Account.ShippingCity, a.Account.ShippingCountry, a.Account.ShippingPostalCode, a.Account.ShippingState, a.Account.ShippingStreet, a.Account.Sic, a.Account.Site, a.Account.SystemModstamp, a.Account.TickerSymbol, a.Account.Type, a.Account.Website, a.CaseAccessLevel, a.ContactAccessLevel, a.Id, a.IsDeleted, a.LastModifiedById, a.LastModifiedBy.Alias, a.LastModifiedBy.CallCenterId, a.LastModifiedBy.City, a.LastModifiedBy.CommunityNickname, a.LastModifiedBy.CompanyName, a.LastModifiedBy.ContactId, a.LastModifiedBy.Country, a.LastModifiedBy.CreatedById, a.LastModifiedBy.CreatedDate, a.LastModifiedBy.DelegatedApproverId, a.LastModifiedBy.Department, a.LastModifiedBy.Division, a.LastModifiedBy.Email, a.LastModifiedBy.EmailEncodingKey, a.LastModifiedBy.EmployeeNumber, a.LastModifiedBy.Extension, a.LastModifiedBy.Fax, a.LastModifiedBy.FirstName, a.LastModifiedBy.ForecastEnabled, a.LastModifiedBy.Id, a.LastModifiedBy.IsActive, a.LastModifiedBy.LanguageLocaleKey, a.LastModifiedBy.LastLoginDate, a.LastModifiedBy.LastModifiedById, a.LastModifiedBy.LastModifiedDate, a.LastModifiedBy.LastName, a.LastModifiedBy.LocaleSidKey, a.LastModifiedBy.ManagerId, a.LastModifiedBy.MobilePhone, a.LastModifiedBy.Name, a.LastModifiedBy.OfflinePdaTrialExpirationDate, a.LastModifiedBy.OfflineTrialExpirationDate, a.LastModifiedBy.Phone, a.LastModifiedBy.PostalCode, a.LastModifiedBy.ProfileId, a.LastModifiedBy.ReceivesAdminInfoEmails, a.LastModifiedBy.ReceivesInfoEmails, a.LastModifiedBy.State, a.LastModifiedBy.Street, a.LastModifiedBy.SystemModstamp, a.LastModifiedBy.TimeZoneSidKey, a.LastModifiedBy.Title, a.LastModifiedBy.Username, a.LastModifiedBy.UserPermissionsCallCenterAutoLogin, a.LastModifiedBy.UserPermissionsMarketingUser, a.LastModifiedBy.UserPermissionsMobileUser, a.LastModifiedBy.UserPermissionsOfflineUser, a.LastModifiedBy.UserPreferencesActivityRemindersPopup, a.LastModifiedBy.UserPreferencesApexPagesDeveloperMode, a.LastModifiedBy.UserPreferencesEventRemindersCheckboxDefault, a.LastModifiedBy.UserPreferencesReminderSoundOff, a.LastModifiedBy.UserPreferencesTaskRemindersCheckboxDefault, a.LastModifiedBy.UserRoleId, a.LastModifiedBy.UserType, a.LastModifiedDate, a.OpportunityAccessLevel, a.RowCause, a.UserOrGroupId from AccountShare a ];
       
    }
}

 

 

 

Sometime in the past week I had an scontrol stop working with the infamous invalid session id. So I made a test and hoping someone here knows what it's about:

 

test.page:

 

<apex:page >
<h1>Congratulations</h1>
This is your new Page
<apex:scontrol controlName="test" width="1" height="1" rendered="true" />
</apex:page>

 


 

test.scf:

 

<script src="/soap/ajax/15.0/connection.js" type="text/javascript"></script>
<script>
try {
var tt = new sforce.SObject("Lead");
tt.Lastname = "test";
tt.Company = "test";

var result = sforce.connection.create([tt]);
}catch(error){
alert("Got error: " + error);
}
</script>

 


When I load this page, I get:

 

 

INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session

 

Any idea how to make this work?

 

Thanks!

Does anyone know a way to query some of the setup data through Apex or even the metadata API? I couldn't find any of this in the docs. I'm trying to write an app that can read details like the setup data, security controls, password policy, lockout timers, session max lifetime, default sharing model etc...

 

Any thoughts or links on what is available via apex or api?

Thanks,

Steve

Is the code assist in Spring 09 IDE supposed to work for Lists?

 

In this code:

 

public class test {
    String s;
    List<String> ll = new List<String>();
   
    public test() {
        ll.       
    }
}

 

if I hit ctrl-space after the ll., I get a null pointer exception in eclipse. Should it work on lists?

 

It also looks like it handles content-assist on std objects, but not custom objects? (objects, not classes)

 

Thanks!

 

 

Nice to finally have code completion!! It's not quite right though, but still cool. Using FF3, it only shows 1 page of completion options. To repro, try this:

 

<apex:column <--now hit ctrl-space. You'll see completion options, but not all. You can't do header* for example.

 

Likewise on datatable:

 

<apex:datatable <--- now hit ctrl-space. You can't select value for example.

 

 

I was trying to make a soql call like:

 

Select u.Email, u.Id, u.Name, u.ProfileId, u.Profile.Name, u.Profile.PermissionsViewAllData from User u where u.Profile.PermissionsViewAllData = true

 

and it gave me an error saying that I cannot use the Permissions* in a where clause.

 

Does anyone know why and/or if you can work-around this? Seems kinda silly. I know I can just query for everything and then handle it in apex, but that's not as clean.

 

Thanks!

Hi,


Does anyone have an idea of how to work around the string limits in this case.

 

I have an apex code that reads a document object. I can get that fine, and it's a CSV fine. I then want to run through the document and parse it line by line. I can get the body into a blob with document.body, then get the body as a string with the body.toString() method.

 

But the problem here is the limits on a string are 100,000 characters. If my blob is larger than 100,00 characters, then what can I do? I don't have to have it all at once. A loop is find but I don't see a way to do blob.tostring(start byte, end byte).

 

Any ideas?

 

Thanks!

Hi,

I have an VF page with a datatable component. Inside the table, I am using a commandlink to toggle and inputtext field on and off. Something like:

Entry1   link    [input]
Entry2   link    [input]

etc...

So the commandlink for each row chagnes a boolean in the list object. That boolean is used by the input field to set the rendered component.

The idea is when I click the link, it changes the render boolean and should then render the box. The problem is that when I do this, the entire page reloads. It works correctly, but refreshes the entire page.

In JSF, I can use the "visible" tag and some frameworks do not refresh the entire page on a render change like this.

Is there a smoother way to do this without having the full page refresh? I think I could use a script to set the CSS visible property instead and just hide it until I click the link, but that is somewhat ugly. Anyone have a way to show and hide elements without forcing a full page refresh?

Thanks!
Does anyone know a way to read a file via apex/vf? I'm looking for a way to prompt the user for a file, then turn that into a stream reader, just like you would get back from an HTTP or XML request. Then my own parser can parse the file and do fun things with it.

The dataloader doesn't help because I'm not inserting records. I don't mind creating a document, reading it, then deleting it, but didn't see where you can read from a document with apex.

Does anyone have a good way to do this?

Thanks!

I'm working on an apex/vf page that is intended to stay up and running for a "long time". You might open it in a new window and periodically refresh, but the main page will stay.

The concern is that I might hit the 10k execution line limit. Are limits enforced on the controller or are they purely on the other classes? If my controller stays alive forever, eventually I would hit a limit just from clicking a refresh button thousands of times, or maybe it's an auto-refresh on a timer.

If the custom controller is subject to the limit, any ways to work-around it or design things differently?

Thanks!

Is the code assist in Spring 09 IDE supposed to work for Lists?

 

In this code:

 

public class test {
    String s;
    List<String> ll = new List<String>();
   
    public test() {
        ll.       
    }
}

 

if I hit ctrl-space after the ll., I get a null pointer exception in eclipse. Should it work on lists?

 

It also looks like it handles content-assist on std objects, but not custom objects? (objects, not classes)

 

Thanks!

 

 

Hi,


Does anyone have an idea of how to work around the string limits in this case.

 

I have an apex code that reads a document object. I can get that fine, and it's a CSV fine. I then want to run through the document and parse it line by line. I can get the body into a blob with document.body, then get the body as a string with the body.toString() method.

 

But the problem here is the limits on a string are 100,000 characters. If my blob is larger than 100,00 characters, then what can I do? I don't have to have it all at once. A loop is find but I don't see a way to do blob.tostring(start byte, end byte).

 

Any ideas?

 

Thanks!

Hi,

I just noticed that bind variables are not allowed in Dynamic SOQL. I'd like to be able to pass in a set of Ids, i.e. getLeadIds() and then dynamically vary the subsequent part of the Where clause, i.e. City = 'Boston'.

Code:
Database.query('SELECT Name FROM Lead WHERE Id IN :getLeadIds() AND City = \'Boston\'');

Is there any good way to pass a set of Ids to a Dynamic SOQL statement?

Do I just have to resort to looping through the set of Ids and adding them to the query string in the required format, i.e. ('id1', 'id2')?

Seems a bit cumbersome, so just wondering if anyone had some better ideas on how to handle this.

Thanks a lot,
Mike

Hi,

I have an VF page with a datatable component. Inside the table, I am using a commandlink to toggle and inputtext field on and off. Something like:

Entry1   link    [input]
Entry2   link    [input]

etc...

So the commandlink for each row chagnes a boolean in the list object. That boolean is used by the input field to set the rendered component.

The idea is when I click the link, it changes the render boolean and should then render the box. The problem is that when I do this, the entire page reloads. It works correctly, but refreshes the entire page.

In JSF, I can use the "visible" tag and some frameworks do not refresh the entire page on a render change like this.

Is there a smoother way to do this without having the full page refresh? I think I could use a script to set the CSS visible property instead and just hide it until I click the link, but that is somewhat ugly. Anyone have a way to show and hide elements without forcing a full page refresh?

Thanks!
Here's my use case for a sites app:

1. Send an email out to Contacts via sf.com
2. Include a "manage my subscriptions" link in the email that has the contact id in it
3. End user clicks on that URL and lands on a sites page
4. End user is asked to enter the email address for which they want to modify subscriptions.
5. If the email they enter matches the email on the contact record, the can
6. change some settings on their contact record and hit save to commit them

I had this working in the authenticated view, but can't get sites to allow me to modify contact records as a public user. I can see why sf.com might not want to allow that. But I also don't want to make a person authenticate for this task.

So I changed things to allow the user to create a custom object that manages the subscription, and then I have a trigger on that object to update the contact record with the changes. So in effect, they are modifying the contact, but with a custom object and a trigger in between.

However, Sites won't let me do this unauthenticated. The checkboxes on my custom object don't show on the vf page. I don't get "authorization required" but the fields just aren't there.

Is Sites seeing my trigger and disallowing my public user because it knows I am going to update a Contact? Or am I screwing things up in a different way?

Here is the page:
Code:
<apex:page Controller="ext_contact_subscriptions" showHeader="False" title="Manage Your Subscriptions" >
<!-- Begin Default Content REMOVE THIS -->
<div style="margin:10px">
<h1>Manage your Subscriptions</h1>
<p>Check what you want to receive from us!</p>
<apex:form >
 <apex:outputPanel id="emailLogin" layout="block" style="margin-left:10px;"> 
  <apex:outputPanel rendered="{!AND(NOT(emailVerified),NOT(success))}" >
   <apex:outputText value="Your email:"/>
   <apex:inputText value="{!enteredEmail}" />
   <apex:commandButton value="submit" action="{!validateEmail}" rerender="emailLogin,subscriptions"/>
  </apex:outputPanel>
  <apex:outputPanel rendered="{!validationError}" layout="block">
  <br/>
   <apex:outputText style="color:#ff0000;" value="That email did not match this subscription. Try another email address."/>
  </apex:outputPanel>
 </apex:outputPanel>
 <apex:outputPanel id="subscriptions" layout="block" style="margin-left:10px;">
  <apex:outputPanel rendered="{!AND(emailVerified,NOT(success))}">
   <h2>Change your Email if you Wish</h2>
   <br/><br/>
   <apex:outputText value="Your Email: " style="margin-left:10px;"/> <apex:inputField value="{!subscription.Email__c}" /><br/><br/>
   <h2>Your Subscriptions</h2>
   <br/><br/>
   <apex:inputField value="{!subscription.Monthly_eNewsletter__c}" /> <apex:outputText value="eNewsletter"/>
   <br/><br/>
   
   <apex:outputText style="color:#666666;margin-left:10px;" value="Receive our monthly newsletter."/><br/><br/>
   <apex:inputField value="{!subscription.Action_Alerts__c}" /> <apex:outputText value="Action Alerts"/>
   <br/><br/>
   <apex:outputText style="color:#666666;margin-left:10px;" value="Receive our periodic notifications about actions."/><br/><br/>
   <apex:commandButton action="{!save}" value="Save" rerender="emailLogin,subscriptions,success"/>
  </apex:outputPanel>
 </apex:outputPanel>
 <apex:outputPanel id="success" layout="block" style="margin-left:10px;">
  <apex:outputPanel rendered="{!success}">
   <apex:outputText style="color:#666666;margin-left:10px;" value="Thanks for submitting your changes! They will go into effect immediately."/>
  </apex:outputPanel>
 </apex:outputPanel>
 <!--figure out redirect-->

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


Here is the controller:

Code:
public class ext_contact_subscriptions {
 
 public Contact contact = new Contact();
 
 public Boolean emailVerified   { get; set; }
 public String enteredEmail    { get; set; }
 public Boolean success     { get; set; }
 public Boolean validationError   { get; set; }
 public string msg       { get; set; }
 
 public Subscription__c subscription { get {return subscription;} set {subscription = value;} }
  
 public ext_contact_subscriptions() {
        contact = [select id, email,Monthly_eNewsletter__c, Action_Alerts__c from contact where id = :ApexPages.currentPage().getParameters().get('id')];
        emailVerified = false;
        validationError = false;
        success = false;
        subscription = new Subscription__c();
        subscription.Contact__c = contact.Id;
        subscription.Email__c = contact.Email;
        subscription.Monthly_eNewsletter__c = contact.Monthly_eNewsletter__c;
        subscription.Action_Alerts__c = contact.Action_Alerts__c;
    }
    
    public PageReference validateEmail() {
     //contact.email = 'steve@test.com';
     if (enteredEmail == contact.email) {
      emailVerified = true;
      validationError = false;
     } else {
      validationError = true; 
     }
     return null; 
    }
    
    
    public PageReference save() {
     
     try {
        // update contact;
       // subscription.contact__c = contact.Id;
     //   subscription.email__c = contact.email;
      //  subscription.Monthly_eNewsletter__c = contact.Monthly_eNewsletter__c;
      //  subscription.Action_Alerts__c = contact.Action_Alerts__c;
        insert subscription;
        
         success = true;
        } catch (exception e) { 
         msg = e.getMessage(); 
        }
     
     return null; 
    }
}

 and here is the trigger:

Code:
trigger subscription_to_contact on subscription__c (after insert) {
 Map<Id,subscription__c> subsToKill = new Map<Id,subscription__c>();
 List<Contact> contactsToProcess = new List<Contact>();
 for (subscription__c sub : Trigger.new) {
  Contact contact = new Contact (    
   id=sub.contact__c,
   Email = sub.email__c,
   Action_Alerts__c = sub.Action_Alerts__c,
   Monthly_eNewsletter__c = sub.Monthly_eNewsletter__c
  );
  contactsToProcess.add(contact);
  subsToKill.put(sub.id,sub);
 }
 if(contactsToProcess.size()>0){
  try {
   update contactsToProcess;  
   //delete subsToKill.values();
        } catch (exception e) { 
         system.debug(e.getMessage()); 
        }  
 } 
}

 Thanks much!

Steve