• geeljire
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 8
    Replies
We use sharing sets to share records between users with an Authenticated Website license. We had a lookup field to Account in all our custom objects to facilitate the sharing. Spring '14 brought with it more options in the record-account/user-account mapping.

We've been running into a strange issue for a few days now (probably since the Spring '14 update). Although they can read/edit records in the customer portal, Authenticated Website users cannot update records they own via Visualforce. On the other hand, they can update records they do not own if these records reference their account (records shared with them) just fine.

When they try to update records they own, they encounter one of two errors:
  • If the controller is attempting the update, no exceptions are thrown in Apex, but the VF page displays Error: Data Not Available.
  • If the update is attempted by a trigger, Apex throws FATAL_ERROR|Internal Salesforce.com Error followed by System.DmlException: Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, invalid cross reference id: []
The users have proper object CRUD. Create, Read, and Delete work as expected. Update only works with records that have been shared with the users, not records owned.

I'm trying to update fields of a custom object along with fields of a related object. The fields of the primary object are updated without a problem, but none of the related object fields are updated. Notice that the saveRecord() method calls update on both objects. How can I accomplish this?

 

Visualforce:

 

<apex:page showHeader="false" standardController="PrimaryObject__c" extensions="controlEntity" sidebar="false" standardstylesheets="false">

<apex:form> <div> <apex:inputField value="{!PrimaryObject__c.Name}" />
<apex:commandButton action="{!saveRecord}" value="Save"/>

<apex:inputField value="{!PrimaryObject__c.LookupField__r.Name}" /> <apex:inputField value="{!PrimaryObject__c.LookupField__r.Address__c}" /> <apex:inputField value="{!PrimaryObject__c.LookupField__r.City__c}" /> <apex:inputField value="{!PrimaryObject__c.LookupField__r.State_Province__c}" /> <apex:inputField value="{!PrimaryObject__c.LookupField__r.Zip_Postal_Code__c} " /> <apex:inputField value="{!PrimaryObject__c.Email_1__c}" /> <apex:inputField value="{!PrimaryObject__c.Email_2__c}" /> <apex:inputField value="{!PrimaryObject__c.Phone_1__c}" /> <apex:inputField value="{!PrimaryObject__c.Phone_2__c}" /> <apex:inputField value="{!PrimaryObject__c.Inactive__c}" /> </div> </apex:form> </apex:page>

 

 

Extension class:

 

public with sharing class controlEntity {
    public PrimaryObject__c entity;
    public RelatedObject__c contact;
    
    public controlEntity(ApexPages.StandardController controller) {
        this.entity = (PrimaryObject__c)controller.getRecord();
        this.contact = [SELECT Name, Address__c, City__c, State_Province__c, Zip_Postal_Code__c FROM RelatedObject__c WHERE Customer_Vendor__c = :ApexPages.currentPage().getParameters().get('id')];
    }
    
    public PageReference saveRecord() {
        update entity;
        update contact;
        return null;
    }
 }

 Thank you.

Objective: Allow each record in a custom listview table to be edited and saved independently in place (in the table).

 

Tried so far: I set up each row to contain both an apex:inputText and apex:outputText tags in order to allow input/output toggle via the rendered attribute. So far, I can only render the entire table conditionally. I don't know how to make the toggle affect each row/record independently.

 

Two questions:

 

  1. How can I independently edit each record?
  2. How can I independently save each record?

 

Markup:

 

<apex:form><table>
...
<tbody>
    <apex:repeat value="{!items}" var="r">
      <tr>
        <td><apex:inputText rendered="{!inputMode}" value="{!r.sample1}"></apex:inputText><apex:outputText rendered="{!outputMode}" value="{!r.sample1}"></apex:outputText></td>
        <td><apex:inputText rendered="{!inputMode}" value="{!r.sample2}"></apex:inputText><apex:outputText rendered="{!outputMode}" value="{!r.sample2}"></apex:outputText></td>
        <td><apex:inputText rendered="{!inputMode}" value="{!r.sample3}"></apex:inputText><apex:outputText rendered="{!outputMode}" value="{!r.sample3}"></apex:outputText></td>
        <td><apex:inputText rendered="{!inputMode}" value="{!r.sample4}"></apex:inputText><apex:outputText rendered="{!outputMode}" value="{!r.sample4}"></apex:outputText></td>
        <td>{!r.CreatedBy.Name}</td>
        <td><apex:commandLink rendered="{!outputMode}" value="edit" action="{!enterInputMode}"/><apex:commandLink rendered="{!inputMode}" action="{!exitInputMode}" value="save"/></td>
      </tr>
    </apex:repeat>
</tbody>
...
</table></apex:form>

 

Apex class:

 

public with sharing class editModeControl {
    public Boolean inputMode{get;set;}
    public Boolean outputMode{get;set;}
    
    public editModeControl(ApexPages.StandardSetController controller) {
        inputMode = false;
        outputMode = true;
    }

    public PageReference enterInputMode() {
        inputMode = true;
        outputMode = false;
        return null;
    }

    public PageReference exitInputMode() {
        inputMode = false;
        outputMode = true;
        return null;
    }
}

 

 Please note that I have no save method implemented.

I'm trying to access a contact object field through a related object's lookup field. Billing_contact__c below (2nd <td>) is an entity object lookup field that has a related contact record. When I reference the Address__c field in the contact object, I get the following error:

 

Error: Unknown property 'String.Address__c'

 

Any idea why? And how can I accomplish my goal of displaying this contact object field?

 

                <apex:repeat value="{!entities}" var="r">
                    <tr>
                      <td>{!r.Name}</td>
                      <td>{!r.Billing_Contact__c.Address__c}</td>
                      <td>{!r.Email_1__c}</td>
                      <td>{!r.Phone_1__c}</td>
                      <td><apex:outputfield value="{!r.Inactive__c}"></apex:outputfield></td>
                      <td>{!r.CreatedBy.Name}</td>
                  </tr>
                 </apex:repeat>

 

I'm new to VisualForce and the Salesforce platform. I have a few questions related to an app I'm working on:

 

1) I'm divided between tweaking the standard salesforce pages or designing pages from scratch. While designing from scratch gives me total (?) control over the design, I wouldn't want to manually build the forms, tables, and views etc. On the other hand, although the standard SF pages will save me a lot of time in application development, I've found them terribly hard to tweak. The app I'm working on will use custom salesforce objects. Any general suggestions or guidelines?

 

2) Thus far, I've had little success in gaining control over header styling. Even when I turn off the standard stylesheets, the custom styles I defined don't always work. Any idea why?

 

3) Is there a way to customize which header elements to display and which to not? So far, I've only determined how to enable or disable the header altogether.

 

4) Is it possible to disable SF's costumer portal stylesheets or directly edit the HTML for the header?

 

I value and welcome your replies, guidance, and advice. Thank you.

 

- Geeljire

We use sharing sets to share records between users with an Authenticated Website license. We had a lookup field to Account in all our custom objects to facilitate the sharing. Spring '14 brought with it more options in the record-account/user-account mapping.

We've been running into a strange issue for a few days now (probably since the Spring '14 update). Although they can read/edit records in the customer portal, Authenticated Website users cannot update records they own via Visualforce. On the other hand, they can update records they do not own if these records reference their account (records shared with them) just fine.

When they try to update records they own, they encounter one of two errors:
  • If the controller is attempting the update, no exceptions are thrown in Apex, but the VF page displays Error: Data Not Available.
  • If the update is attempted by a trigger, Apex throws FATAL_ERROR|Internal Salesforce.com Error followed by System.DmlException: Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, invalid cross reference id: []
The users have proper object CRUD. Create, Read, and Delete work as expected. Update only works with records that have been shared with the users, not records owned.

I'm trying to update fields of a custom object along with fields of a related object. The fields of the primary object are updated without a problem, but none of the related object fields are updated. Notice that the saveRecord() method calls update on both objects. How can I accomplish this?

 

Visualforce:

 

<apex:page showHeader="false" standardController="PrimaryObject__c" extensions="controlEntity" sidebar="false" standardstylesheets="false">

<apex:form> <div> <apex:inputField value="{!PrimaryObject__c.Name}" />
<apex:commandButton action="{!saveRecord}" value="Save"/>

<apex:inputField value="{!PrimaryObject__c.LookupField__r.Name}" /> <apex:inputField value="{!PrimaryObject__c.LookupField__r.Address__c}" /> <apex:inputField value="{!PrimaryObject__c.LookupField__r.City__c}" /> <apex:inputField value="{!PrimaryObject__c.LookupField__r.State_Province__c}" /> <apex:inputField value="{!PrimaryObject__c.LookupField__r.Zip_Postal_Code__c} " /> <apex:inputField value="{!PrimaryObject__c.Email_1__c}" /> <apex:inputField value="{!PrimaryObject__c.Email_2__c}" /> <apex:inputField value="{!PrimaryObject__c.Phone_1__c}" /> <apex:inputField value="{!PrimaryObject__c.Phone_2__c}" /> <apex:inputField value="{!PrimaryObject__c.Inactive__c}" /> </div> </apex:form> </apex:page>

 

 

Extension class:

 

public with sharing class controlEntity {
    public PrimaryObject__c entity;
    public RelatedObject__c contact;
    
    public controlEntity(ApexPages.StandardController controller) {
        this.entity = (PrimaryObject__c)controller.getRecord();
        this.contact = [SELECT Name, Address__c, City__c, State_Province__c, Zip_Postal_Code__c FROM RelatedObject__c WHERE Customer_Vendor__c = :ApexPages.currentPage().getParameters().get('id')];
    }
    
    public PageReference saveRecord() {
        update entity;
        update contact;
        return null;
    }
 }

 Thank you.

Objective: Allow each record in a custom listview table to be edited and saved independently in place (in the table).

 

Tried so far: I set up each row to contain both an apex:inputText and apex:outputText tags in order to allow input/output toggle via the rendered attribute. So far, I can only render the entire table conditionally. I don't know how to make the toggle affect each row/record independently.

 

Two questions:

 

  1. How can I independently edit each record?
  2. How can I independently save each record?

 

Markup:

 

<apex:form><table>
...
<tbody>
    <apex:repeat value="{!items}" var="r">
      <tr>
        <td><apex:inputText rendered="{!inputMode}" value="{!r.sample1}"></apex:inputText><apex:outputText rendered="{!outputMode}" value="{!r.sample1}"></apex:outputText></td>
        <td><apex:inputText rendered="{!inputMode}" value="{!r.sample2}"></apex:inputText><apex:outputText rendered="{!outputMode}" value="{!r.sample2}"></apex:outputText></td>
        <td><apex:inputText rendered="{!inputMode}" value="{!r.sample3}"></apex:inputText><apex:outputText rendered="{!outputMode}" value="{!r.sample3}"></apex:outputText></td>
        <td><apex:inputText rendered="{!inputMode}" value="{!r.sample4}"></apex:inputText><apex:outputText rendered="{!outputMode}" value="{!r.sample4}"></apex:outputText></td>
        <td>{!r.CreatedBy.Name}</td>
        <td><apex:commandLink rendered="{!outputMode}" value="edit" action="{!enterInputMode}"/><apex:commandLink rendered="{!inputMode}" action="{!exitInputMode}" value="save"/></td>
      </tr>
    </apex:repeat>
</tbody>
...
</table></apex:form>

 

Apex class:

 

public with sharing class editModeControl {
    public Boolean inputMode{get;set;}
    public Boolean outputMode{get;set;}
    
    public editModeControl(ApexPages.StandardSetController controller) {
        inputMode = false;
        outputMode = true;
    }

    public PageReference enterInputMode() {
        inputMode = true;
        outputMode = false;
        return null;
    }

    public PageReference exitInputMode() {
        inputMode = false;
        outputMode = true;
        return null;
    }
}

 

 Please note that I have no save method implemented.

I'm trying to access a contact object field through a related object's lookup field. Billing_contact__c below (2nd <td>) is an entity object lookup field that has a related contact record. When I reference the Address__c field in the contact object, I get the following error:

 

Error: Unknown property 'String.Address__c'

 

Any idea why? And how can I accomplish my goal of displaying this contact object field?

 

                <apex:repeat value="{!entities}" var="r">
                    <tr>
                      <td>{!r.Name}</td>
                      <td>{!r.Billing_Contact__c.Address__c}</td>
                      <td>{!r.Email_1__c}</td>
                      <td>{!r.Phone_1__c}</td>
                      <td><apex:outputfield value="{!r.Inactive__c}"></apex:outputfield></td>
                      <td>{!r.CreatedBy.Name}</td>
                  </tr>
                 </apex:repeat>

 

I'm new to VisualForce and the Salesforce platform. I have a few questions related to an app I'm working on:

 

1) I'm divided between tweaking the standard salesforce pages or designing pages from scratch. While designing from scratch gives me total (?) control over the design, I wouldn't want to manually build the forms, tables, and views etc. On the other hand, although the standard SF pages will save me a lot of time in application development, I've found them terribly hard to tweak. The app I'm working on will use custom salesforce objects. Any general suggestions or guidelines?

 

2) Thus far, I've had little success in gaining control over header styling. Even when I turn off the standard stylesheets, the custom styles I defined don't always work. Any idea why?

 

3) Is there a way to customize which header elements to display and which to not? So far, I've only determined how to enable or disable the header altogether.

 

4) Is it possible to disable SF's costumer portal stylesheets or directly edit the HTML for the header?

 

I value and welcome your replies, guidance, and advice. Thank you.

 

- Geeljire

Hi 

  I want to draw a bar an pie chart in visualforce page . I know It  can be by using GooglechartApi , But I want to draw by using 

  

  <apex:chart> .  I have treid alot . 

   here is my code . 

 

  

<apex:page controller="OppsController">
<apex:chart data="{!BarWedgeData}" width="600" height="400">
<apex:axis type="Category" position="left" fields="name" title="Opportunities"/>
<apex:axis type="Numeric" position="bottom" fields="amount" title="Amount"/>
<apex:barSeries orientation="horizontal" axis="bottom" xField="name" yField="amount"/>
<!--<apex:pieSeries dataField="amount" labelField="name"/>-->

</apex:chart>
<apex:dataTable value="{!BarWedgeData}" var="opp">
<apex:column headerValue="Opportunity" value="{!opp.name}"/>
<!--<apex:column headerValue="Amount" value="{!opp.amount}"/>-->
</apex:dataTable>
</apex:page>

 

 

My class code is 

 

 

public class OppsController {

// Get a set of Opportunities
public List<Opportunity> opptList{get;set;}

/* public ApexPages.StandardSetController setCon {
get {
if(setCon == null) {
setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
[SELECT name, type, amount, closedate FROM Opportunity]));
setCon.setPageSize(5);
}
return setCon;
}
set;
}*/

List<BarWedgeData > data {get;set;}

public OppsController() {
opptList = [SELECT name, type, amount, closedate FROM Opportunity limit 10];
data = new List<BarWedgeData>();


}
public List<BarWedgeData > getBarWedgeData () {
for(Opportunity opt : opptList)
{
//data = new List<BarWedgeData>();
data.add(new BarWedgeData (opt.name));
}
//data.add(new BarWedgeData (opt.closedate));
return data;

}


public class BarWedgeData {

public String name { get; set; }
public Double data { get; set; }

public BarWedgeData (String name) {
this.name = name;
this.data = data;
}
}

}

 

here I have written code to dislaay all Opportunity name in a list and a graph.

  List is displayed but graph is not displayed. please help me as soon as possible

 

Thanks

asish

 

Hi,

I have a strange situation here.

 

I have written a web service class which searches for MemberID (which is unique) in Accounts, if its found then it updates that record OR else it inserts new record. The values for each fields in Accounts are supplied as a XML string parameter from Java. So the Java program calls this web service methods by passing XML strings.

 

All works well when tested with some static inputs, however when this method called in bulk, I get he error - 

Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: Member_ID__c duplicates value on record with id: 0019000000CZC83: []

 

I have no clue why and how could this happen? As I am searching for Member_ID__c in my query then inserting if its not found. As an additional step, I replaced 'insert' by 'upsert', still I am getting this exception.