• hal9001
  • NEWBIE
  • 55 Points
  • Member since 2012

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

I'm confused by all the jargon around portals: customer portal, sites, vendor portal, siteforce, etc.

  • I want to have an authenticated portal.  Each user will have their own license.
  • Portal users will also be Contacts - I know how to create user accounts from contacts.
  • Also, I want portal users to be able to work with custom objects (and their layouts) I've created, but only have access to the records that are descendents (children or grand-children) of the User's Account. 

1) What kind of portal should I use?  

 

2) Are there any applicable examples of sharing rules or sharing reasons to accomplish my requirement?

 

3) Any other advice?

 

Thanks so much!

 

I installed the Force.com IDE on my Windows 7 machine.  I also installed the updates. I also re-booted after.

 

When I start the Force.com IDE, the title bar reads Force Provisioning.

Under the Window menu, there is no Open Perspective Option, only Window Preferences.

In Preferences under Force.com I have checked Display when Eclipse starts and Display when Force.com Perspective is opened.

 

Any one have any idea what the problem is?  How do I open the Force.com perspective?

I can run this query in the Force.com explorer: SELECT Name,Website__r.Name FROM Subscription__c But the results for the second column are all "Website__r". I can click on the Website__r and then an overlay appears with the actual Website name. Is there any way I can get the actual value from the parent to be returned in the query instead of the relationship name? I know I can write Apex and get to it an a few steps, but don't want to do that yet. I want to get the results in one step.

I have a custom object and I want to embed a vf page into the layout of the custom object's standard page.  Sort of like a related list.  I've looked for examples, but can't find any.

 

From what I've read, the vf page has to use the standard controller of the custom object, with a custom controller extension.  I'm not sure where to go from there.

Is it possible to use a visualforce page (with PageBlockTable) as a related list on a standard custom object page? If so, how? Are there any examples? Any other suggestions?

 

Why?

I'm using a vf page and custom controller to summarize data that is related (detail) to a custom object (parent).  The summarized data comes from a hierarchy of other custom objects.  The summary can have multiple rows and the key for each of the rows is dynamic, so I don't think using a custom formula field would satisfy the requirement.

 

Thanks!

I have a page that uses a controller extension for the User object.  The existing field values don't populate, nor are they saved when the button is clicked.  There are no error messages.

 

Controller extension:

public class UserControllerExtension {
    private final User usr;

    Id u = UserInfo.getUserId();

    public UserControllerExtension(ApexPages.StandardController stdController) {
        this.usr = [SELECT id,Name,From_Date__c,Through_Date__c FROM User WHERE Id =:u  ];
    }
}

 Page:

<apex:page standardController="User" extensions="UserControllerExtension">
<apex:form >
<apex:pageBlock title="Hello {!$User.FirstName}!">
Change report dates: <p/>
<apex:inputField value="{!user.From_Date__c}"/> <p/>
<apex:inputField value="{!user.Through_Date__c}"/> <p/>
<apex:commandButton action="{!save}" value="Save New report dates"/>
</apex:pageBlock>
</apex:form>
</apex:page>

 

 

 

 

 

 

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 two custom tables:

Location__c (Master)

Trans__c (Detail)

 

When I run this query:

select

Qty__c,

Location__c,

Location__r.Location_Type__c

from Trans__c

 

I get the field name "Location__c" for the third field instead of the value from that field in the parent table.  What am I doing wrong?

 

Thanks!

I'm having fun trying bulkifying my triggers.  Maybe too much fun!

 

Anyway, in the code below, about 8 lines form the bottom, there is this line:

        b.Balance__c = b.Balance__c + trans.Qty__c;

This line works fine when adding data through the web interface, but fails with a NullPointerException when I use the data loader.  

 

If I change the line to:

b.Balance__c =  trans.Qty__c;

Then the data loader does not err out.  So I know the problem is when I try to add in the current balance.  Could it be that my table is named Balance__c and it also also has a column named Balance__c?  But it works through the web interface, just not through the data loader.

 

 

Any idea why?  I believe it is thoroughly bulikified.

trigger afterInsertUpdateTrans on Trans__c (after insert, after update) {
    // create a map of existing balance records
    // since locations and equipment are dynamic,
    // balance records are not created until a transaction containing the location and equipment is added
    // there is a single unique balance record for very combination of location and equipment that has a transaction
    // Balance_Key__c is a calculated variable that concatenates the Location Id and Equipment Id
    // Balance_Key__c is defined on both the Trans__c and Balance__c tables
    Map<string,Id> balanceMap = new  Map<string,id>();
    for (Balance__c myBals : [select Balance_Key__c,Id from Balance__c]) {
        balanceMap.put(myBals.Balance_Key__c,myBals.Id);
    }

    string bk;       // to hold the results of the lookup of the key into balanceMap

    // add any missing balance records
    
    List<Balance__c> balanceToInsert = new List<Balance__c>{}; 
    for (Trans__c trans : Trigger.new) 
     {
     bk = balanceMap.get(trans.Balance_Key__c);
     If (bk==null){  // add a row to balanceToInsert
         Balance__c b = new Balance__c();
         b.Location__c = trans.Location__c;
         b.Equipment__c = trans.Equipment__c;
         balanceToInsert.add(b);
     }
    
     }    
    insert balanceToInsert;
    // finished adding any missing balance records



    // make a map of balance records
    map<string, Balance__c> balanceMap2 = new map<string, Balance__c>([select Balance_Key__c, id,Balance__c from Balance__c]);            
    Id balanceObjectId; // to hold the results of the lookup of the key into Balances 

    Map<string,Id> balanceLookup = new  Map<string,id>();
    for (Balance__c myBals : [select Balance_Key__c,Id from Balance__c]) {
        balanceLookup.put(myBals.Balance_Key__c,myBals.Id);
    }

   List<Balance__c> balanceToUpdate = new List<Balance__c>{};

    for (Trans__c trans : Trigger.new) 
 {

     balanceObjectId = balanceLookup.get(trans.Balance_Key__c); 

     Balance__c b = balanceMap2.get(balanceObjectId);
     
     If (trigger.IsInsert){
         // the next line works in the web interface
         // but fails in apex data loader with a System.NullPointerException
         b.Balance__c = b.Balance__c + trans.Qty__c;
         } Else {
         b.Balance__c = b.Balance__c + trans.Qty__c - System.Trigger.oldMap.get(trans.Id).Qty__c;
        }
    balanceToUpdate.add(b);
}
update balanceToUpdate;

}

 

When I try to open the Profiles page, it never loads.  See picture below.  It stays that way forever.  There are no other items in the drop-down.  Any ideas?

 

 
All Profiles 
 
 
Loading...

I have the following trigger.  When inserting a record, the try fails. When updating, it works. It is as if Trigger.new is empty for inserts. Why is that?

 

trigger validateTransaction on Transaction__c (before insert, before update) {
  
  try{   
    for (Transaction__c trans : Trigger.new) 
 {
        Transaction__c d = [SELECT Quantity__c FROM Transaction__c WHERE Id =:trans.Id];
        trans.Transaction_Type__c = 'OK';
          }
  }
  catch(Exception e){
    for (Transaction__c trans : Trigger.new) 
        trans.Transaction_Type__c = 'error';
  }
  
}

I'm working on an Application with the schema shown in the picture below.  I'm getting stuck on the part where I use a trigger to populate the Transaction Type.  I considered using Master-Detail relationships for Transaction__c.Debit_Account__c to Account__c and for Transaction__c.Credit_Account to Account__c, but since there is a limit of two Master-Detail relationships per object, I would lose the relationship between the Batch header and Transaction.

 

Do I need to change the schema, and if so, to what? How do I code the trigger to populate the Transaction Type from Transaction Definitions?

 



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 installed the Force.com IDE on my Windows 7 machine.  I also installed the updates. I also re-booted after.

 

When I start the Force.com IDE, the title bar reads Force Provisioning.

Under the Window menu, there is no Open Perspective Option, only Window Preferences.

In Preferences under Force.com I have checked Display when Eclipse starts and Display when Force.com Perspective is opened.

 

Any one have any idea what the problem is?  How do I open the Force.com perspective?

I have a custom object and I want to embed a vf page into the layout of the custom object's standard page.  Sort of like a related list.  I've looked for examples, but can't find any.

 

From what I've read, the vf page has to use the standard controller of the custom object, with a custom controller extension.  I'm not sure where to go from there.

Is it possible to use a visualforce page (with PageBlockTable) as a related list on a standard custom object page? If so, how? Are there any examples? Any other suggestions?

 

Why?

I'm using a vf page and custom controller to summarize data that is related (detail) to a custom object (parent).  The summarized data comes from a hierarchy of other custom objects.  The summary can have multiple rows and the key for each of the rows is dynamic, so I don't think using a custom formula field would satisfy the requirement.

 

Thanks!

I have a page that uses a controller extension for the User object.  The existing field values don't populate, nor are they saved when the button is clicked.  There are no error messages.

 

Controller extension:

public class UserControllerExtension {
    private final User usr;

    Id u = UserInfo.getUserId();

    public UserControllerExtension(ApexPages.StandardController stdController) {
        this.usr = [SELECT id,Name,From_Date__c,Through_Date__c FROM User WHERE Id =:u  ];
    }
}

 Page:

<apex:page standardController="User" extensions="UserControllerExtension">
<apex:form >
<apex:pageBlock title="Hello {!$User.FirstName}!">
Change report dates: <p/>
<apex:inputField value="{!user.From_Date__c}"/> <p/>
<apex:inputField value="{!user.Through_Date__c}"/> <p/>
<apex:commandButton action="{!save}" value="Save New report dates"/>
</apex:pageBlock>
</apex:form>
</apex:page>

 

 

 

 

 

 

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 two custom tables:

Location__c (Master)

Trans__c (Detail)

 

When I run this query:

select

Qty__c,

Location__c,

Location__r.Location_Type__c

from Trans__c

 

I get the field name "Location__c" for the third field instead of the value from that field in the parent table.  What am I doing wrong?

 

Thanks!

I'm having fun trying bulkifying my triggers.  Maybe too much fun!

 

Anyway, in the code below, about 8 lines form the bottom, there is this line:

        b.Balance__c = b.Balance__c + trans.Qty__c;

This line works fine when adding data through the web interface, but fails with a NullPointerException when I use the data loader.  

 

If I change the line to:

b.Balance__c =  trans.Qty__c;

Then the data loader does not err out.  So I know the problem is when I try to add in the current balance.  Could it be that my table is named Balance__c and it also also has a column named Balance__c?  But it works through the web interface, just not through the data loader.

 

 

Any idea why?  I believe it is thoroughly bulikified.

trigger afterInsertUpdateTrans on Trans__c (after insert, after update) {
    // create a map of existing balance records
    // since locations and equipment are dynamic,
    // balance records are not created until a transaction containing the location and equipment is added
    // there is a single unique balance record for very combination of location and equipment that has a transaction
    // Balance_Key__c is a calculated variable that concatenates the Location Id and Equipment Id
    // Balance_Key__c is defined on both the Trans__c and Balance__c tables
    Map<string,Id> balanceMap = new  Map<string,id>();
    for (Balance__c myBals : [select Balance_Key__c,Id from Balance__c]) {
        balanceMap.put(myBals.Balance_Key__c,myBals.Id);
    }

    string bk;       // to hold the results of the lookup of the key into balanceMap

    // add any missing balance records
    
    List<Balance__c> balanceToInsert = new List<Balance__c>{}; 
    for (Trans__c trans : Trigger.new) 
     {
     bk = balanceMap.get(trans.Balance_Key__c);
     If (bk==null){  // add a row to balanceToInsert
         Balance__c b = new Balance__c();
         b.Location__c = trans.Location__c;
         b.Equipment__c = trans.Equipment__c;
         balanceToInsert.add(b);
     }
    
     }    
    insert balanceToInsert;
    // finished adding any missing balance records



    // make a map of balance records
    map<string, Balance__c> balanceMap2 = new map<string, Balance__c>([select Balance_Key__c, id,Balance__c from Balance__c]);            
    Id balanceObjectId; // to hold the results of the lookup of the key into Balances 

    Map<string,Id> balanceLookup = new  Map<string,id>();
    for (Balance__c myBals : [select Balance_Key__c,Id from Balance__c]) {
        balanceLookup.put(myBals.Balance_Key__c,myBals.Id);
    }

   List<Balance__c> balanceToUpdate = new List<Balance__c>{};

    for (Trans__c trans : Trigger.new) 
 {

     balanceObjectId = balanceLookup.get(trans.Balance_Key__c); 

     Balance__c b = balanceMap2.get(balanceObjectId);
     
     If (trigger.IsInsert){
         // the next line works in the web interface
         // but fails in apex data loader with a System.NullPointerException
         b.Balance__c = b.Balance__c + trans.Qty__c;
         } Else {
         b.Balance__c = b.Balance__c + trans.Qty__c - System.Trigger.oldMap.get(trans.Id).Qty__c;
        }
    balanceToUpdate.add(b);
}
update balanceToUpdate;

}

 

When I try to open the Profiles page, it never loads.  See picture below.  It stays that way forever.  There are no other items in the drop-down.  Any ideas?

 

 
All Profiles 
 
 
Loading...

I have the following trigger.  When inserting a record, the try fails. When updating, it works. It is as if Trigger.new is empty for inserts. Why is that?

 

trigger validateTransaction on Transaction__c (before insert, before update) {
  
  try{   
    for (Transaction__c trans : Trigger.new) 
 {
        Transaction__c d = [SELECT Quantity__c FROM Transaction__c WHERE Id =:trans.Id];
        trans.Transaction_Type__c = 'OK';
          }
  }
  catch(Exception e){
    for (Transaction__c trans : Trigger.new) 
        trans.Transaction_Type__c = 'error';
  }
  
}

I'm working on an Application with the schema shown in the picture below.  I'm getting stuck on the part where I use a trigger to populate the Transaction Type.  I considered using Master-Detail relationships for Transaction__c.Debit_Account__c to Account__c and for Transaction__c.Credit_Account to Account__c, but since there is a limit of two Master-Detail relationships per object, I would lose the relationship between the Batch header and Transaction.

 

Do I need to change the schema, and if so, to what? How do I code the trigger to populate the Transaction Type from Transaction Definitions?