• John Upton 8
  • NEWBIE
  • 70 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 15
    Replies
I'm banging my head against a wall trying to migrate child data from one org to another using dataloader.io (have also failed using the data import wizard). The steps I'm using are as follows:
  1. I have a Parent table, which I have exported, including the ID field, from Org 1.
  2. I have successfully imported this into Org 2, where I have an extra column called Source Parent ID. Into this I imported the ID from Parent on Org 1.
  3. I then export from Child on Org 1, taking care to take the ID of the Parent.
  4. I try to import this into Org 2. I chose 'Upsert', select my table, then press 'Next'.
  5. I select my import file
  6. Most of the data mapping is done for me. The only think I do is map Source Header of 'Source Parent ID'  to the Salesforce Field 'Source Parent' and ensure the 'Use as External ID' checkbox is ticked.
  7. I save and run, and for my efforts get errors for each of my import lines, stating
  8. " SOURCE: 'Source_Parent_ID__c' DESTINATION: 'Source_Parent__c' ERROR:Duplicate external id specified: a0o8e0000007rzwua2".
Can anyone help? And/or point me at some documentation which explains step by step what to do? I have read a whole load of forum posts, but haven't got any closer to a solution...
 
I'm trying to use Visualforce charts to show information about from the Contact record associated with the user's User record for the purpose of displaying on our Community.
<apex:page controller="Graph2" >
    <apex:pageblock title="Grr!" >    
        <apex:chart height="250" width="450" animate="true" data="{!pieData}">
        <apex:axis type="Gauge" position="gauge" title="Transaction Load"
            minimum="10" maximum="400" steps="10"/>
        <apex:gaugeSeries dataField="data" donut="50" colorSet="#78c953,#ddd,#0F0" />
        </apex:chart>
    </apex:pageblock>            
</apex:page>
and this Controller:
public with sharing class Graph2
{  
    public List<PieWedgeData> getPieData() 
    {  
        List<PieWedgeData> data = new List<PieWedgeData>();
        List<Contact> memb = new List<Contact>();  

//        String sql = 'SELECT Name, Gauge_Value__c FROM Contact WHERE Id IN (SELECT contactid FROM  user where id = :userinfo.getUserId())';        
        String sql = 'SELECT Name, Gauge_Value__c FROM Contact WHERE Gauge_Value__c != null';
        memb = Database.Query(sql);
        for(Contact temp:memb)
        {           
            data.add(new PieWedgeData(temp.Name,temp.Gauge_Value__c));
        }
        return data;  
    }  
    
    // Wrapper class  
class PieWedgeData 
    {  
        public String name { get; set; }  
        public Decimal data { get; set; } 
        
        public PieWedgeData(String name, Decimal data) 
        {  
            this.name = name;  
            this.data = data;  
 
        }  
    }  
}
displays the chart just fine in the community (the user in question is the only one with a value in Gauge_Value__c), but as soon as I substitute in the commented out line which will return the results for the actual user, I get the following Visualforce Error:

System.QueryException: unexpected token: '(' 
Class.Graph2.getPieData: line 10, column 1

Can anyone suggest what I am doing wrong and/or a different way of doing it?
I have created a visualforce chart along the line of this one: http://www.infallibletechie.com/2013/02/pie-chart-and-bar-chart-using-apex-in.html. However I also wish to be able to set the values for Minimun and Maximum based on other fields in the Member__c object. I tried simply setting
minimum="data"

but get the error "Visualforce Error. Unable to convert value 'data' to type 'Integer' for attribute 'minimum' "
Can anyone suggest a different approach?
I'm trying to create a dashboard where not only the data, but also the formatting is set dynamically. 

In my specific example, I have been asked to create a gauge (what I call a 'speedometer') type dashboard element which displays user data, but the data not only defines where the pointer will point to, but also values associated with Breakpoint 1, Breakpoint 2 and Maximum (where the colours start and stop). 

I've read some about Dynamic Dashboards and Wave Analytics, but haven't found anything which tells me how I can influence these values dynamically. Does anyone know if this possible and if so, can you point me in the direction of some documentation / forum post, so I can find out how? Thanks.
I'm trying to display an image that is stored as a Document. Starting with the most basic example, I am using the following:
 
<apex:page standardcontroller="Document">

  <apex:outputField value="{!Document.name}"/>
  <apex:image id="theImage" value="!Document.Logo.jpg" width="100" height="100"/>

</apex:page>

passing the ID of the document in through the URL. It's Name displays OK, but the image does not, just showing as a 'dummy' 100x100 blank square. What syntax do I need to use? Or do I need a different approach some how?
Note, I do not want to use a Static Resource.
Thanks
I've created a VF page with a custom controller, which displays content from (which I'll call Content) on publicly accessible pages on my community (i.e. anyone can access them, and will do so using the Guest User profile.
In the controller I have the code:
public void incCount() {  
    MyContent.Access_Count__c++;
    update MyContent;
    }
This all works fine, until I try to do add a code to count the number of times the page is viewed, which I do by adding the followign to my VF page after the controller declaration:
action="{!incCount}"
As soon as I include action="{!incCount}", My Guest Users are re-directed to the login page instead, i.e. they no longer have access. 
This is surely caused by me trying to Update my Conent table, but this being the case, setting the 'Custom Object Permissions' for the Guest User profile to have access to be able to Edit (and the rest, except Create) should suffice? It would seem not.

Can anyone offer any other reason why this is not working and/or how I can get it to work?

Thanks
I have created a table to house basic information for putting into an email (subject, intro etc). I will call this EMAIL. I have created a child table to house the content for emails, so each EMAIL object can have one or more CONTENT objects.
I have created a many-many relationship between CONTACT and EMAIL via another table called LINK.
I have two email templates. One is 'Custom' and as follows. This works fine, when I trigger it (by adding a LINK object),  I get an email send to my Contact with both the expected merge fields filled in.
Dear {!CONTACT.FirstName}, Intro: {!EMAIL__c.Introduction__c}
However, I have a second template created using Visualforce (below). If I switch my email alert to use it instead, then perform the same action to get the email to be sent to a Contact, neither the Contact's Name or the EMAIL Introduction is merged in! Also note that, if I use this template and 'Send Test and Verify Merge Fields', entering my Contact and EMAIL ID causes the merge from both objects to work perfectly! Can anyone offer any advice?
Thanks
<messaging:emailTemplate recipientType="Contact"
    relatedToType="Queued_Email__c"
    subject="ed test 3">
    <messaging:htmlEmailBody >
        <html>
            <body>
            <p>Dear {!recipient.name},</p>
            <p>{!relatedTo.Introduction__c}</p>
            </body>
        </html>
    </messaging:htmlEmailBody>
</messaging:emailTemplate>
 
I'm trying to mimic a simple hardcoded survey in a VF page (Survey Force cannot accommodate the size of the questions and/or answers I need).  I wish to ask a question and use the answer to update a field on the Contact record associated with the user in question.
I'm struggling with the update - in the code below, my 'Connect__c' field on Contact is only ever set to the default value of 'xxx', not the '+5', '+4', or '+3' that I am hoping for. Can anyone suggest what I need to do differently?
Thanks

Controller:
public class TestCon1 {

    String Answer = 'xxx';
    public List<SelectOption> getItems() {
    List<SelectOption> options = new List<SelectOption>(); 
    options.add(new SelectOption('+5','+5 choice')); 
    options.add(new SelectOption('+4','+4 choice')); 
    options.add(new SelectOption('+3','+3 choice'));
    return options; 
    }
    
    public TestCon1() {
        Id Myid = ApexPages.currentPage().getParameters().get('id');
        contact = new Contact(id=Myid, connect__c=this.Answer);
    }
 
    public String getAnswer() { return Answer; }

    public void setAnswer(String Answer) { this.Answer = Answer; }
    
    public Contact contact { get; private set; }

    public PageReference save() {
        try {
            update(contact);
        } catch(System.DMLException e) {
            ApexPages.addMessages(e);
        }
        
        PageReference NextPage = Page.SurveyQuestion2;
         NextPage.getParameters().put('contactId', contact.Id);
          NextPage.setRedirect(true);
          return NextPage;  
    }
}

VF page:
<apex:page controller="MyCon1" tabStyle="Account">
<apex:form >
            <apex:selectRadio value="{!Answer}" layout="pageDirection">
            <apex:selectOptions value="{!items}"/>
            </apex:selectRadio>
<apex:commandButton action="{!save}" value="save"/>
</apex:form>
</apex:page>
I am creating a VF page with a custom controller which upserts a Contact record, then allows navigation to a new VF page (called SurveyQuestion1). This works fine; however, I would also like to pass the ID of the Contact into it through the URL, but no matter what syntax I use (using this page: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_system_pagereference.htm) I run into problems.
The following works without passing the Contact ID; can someone suggest how I can amend it to pass the ID?

public class EnterDetailsController {

    public Contact contact { get; private set; }

    public EnterDetailsController() {
        Id id = ApexPages.currentPage().getParameters().get('id');
        contact = (id == null) ? new Contact() : 
            [SELECT FirstName, LastName, Email FROM Contact WHERE Id = :id];
    }
 
    public PageReference save() {
        try {
            upsert(contact);
        } catch(System.DMLException e) {
            ApexPages.addMessages(e);
   
        }
        //  After successful Save, navigate to SurveyQuestion1 page
            PageReference NextPage = Page.SurveyQuestion1;
                NextPage.setRedirect(true);
            return NextPage;
        
    }
}
Hi. I'm trying to get a image to display on a Visualforce page. I have added a Static Resource, and can get it to display if I cite its name directly, but if I try to reference it using a variable, I either get an error in compilation, or a small 'dummy' image like it can't find the one I've specified.

The code that works find is as follows:

<apex:page standardController="Account">
  <apex:variable var="imageVar" value="MMC_Logo"/>
  <p>Resource name {!imageVar}</p>
<apex:image url="{!$Resource.MMC_Logo}"/>
</apex:page>

However, if I add a penultimate line of 

<apex:image url="{!$Resource.(imageVar)"/>

I get the small 'dummy' image displayed.
Surely this is just a minor syntaxical error, but nothing I have tried will work! Can someone point me in the right direction? 
Thanks..
I wish to create tabs on my Visual Force page, each tab being based on a record in a child object. 
I have used the example in the URL below to create a simple controller extension, so that I can execute a loop in VF; however, if I try to use the following markup, all I get is 3 "hello"s. However, if I take out the 'apex:repeat', I get the single "hello" and the tab as expected.
Can anyone suggest what I am doing wrong / a different approach?
Thanks

<apex:page standardController="Account" extensions="DynamicAccountFieldsLister">
    <apex:tabPanel switchType="client" selectedTab="name2" id="theTabPanel">
        <apex:repeat value="{!editableFields}" var="f">
            hello
            <apex:tab label="tab" >
            </apex:tab>
        </apex:repeat>
    </apex:tabPanel> 
</apex:page>


https://developer.salesforce.com/docs/atlas.en-us.200.0.pages.meta/pages/pages_dynamic_vf_sample_standard.htm?search_text=loop 
I'm trying to display an image that is stored as a Document. Starting with the most basic example, I am using the following:
 
<apex:page standardcontroller="Document">

  <apex:outputField value="{!Document.name}"/>
  <apex:image id="theImage" value="!Document.Logo.jpg" width="100" height="100"/>

</apex:page>

passing the ID of the document in through the URL. It's Name displays OK, but the image does not, just showing as a 'dummy' 100x100 blank square. What syntax do I need to use? Or do I need a different approach some how?
Note, I do not want to use a Static Resource.
Thanks
I'm trying to use Visualforce charts to show information about from the Contact record associated with the user's User record for the purpose of displaying on our Community.
<apex:page controller="Graph2" >
    <apex:pageblock title="Grr!" >    
        <apex:chart height="250" width="450" animate="true" data="{!pieData}">
        <apex:axis type="Gauge" position="gauge" title="Transaction Load"
            minimum="10" maximum="400" steps="10"/>
        <apex:gaugeSeries dataField="data" donut="50" colorSet="#78c953,#ddd,#0F0" />
        </apex:chart>
    </apex:pageblock>            
</apex:page>
and this Controller:
public with sharing class Graph2
{  
    public List<PieWedgeData> getPieData() 
    {  
        List<PieWedgeData> data = new List<PieWedgeData>();
        List<Contact> memb = new List<Contact>();  

//        String sql = 'SELECT Name, Gauge_Value__c FROM Contact WHERE Id IN (SELECT contactid FROM  user where id = :userinfo.getUserId())';        
        String sql = 'SELECT Name, Gauge_Value__c FROM Contact WHERE Gauge_Value__c != null';
        memb = Database.Query(sql);
        for(Contact temp:memb)
        {           
            data.add(new PieWedgeData(temp.Name,temp.Gauge_Value__c));
        }
        return data;  
    }  
    
    // Wrapper class  
class PieWedgeData 
    {  
        public String name { get; set; }  
        public Decimal data { get; set; } 
        
        public PieWedgeData(String name, Decimal data) 
        {  
            this.name = name;  
            this.data = data;  
 
        }  
    }  
}
displays the chart just fine in the community (the user in question is the only one with a value in Gauge_Value__c), but as soon as I substitute in the commented out line which will return the results for the actual user, I get the following Visualforce Error:

System.QueryException: unexpected token: '(' 
Class.Graph2.getPieData: line 10, column 1

Can anyone suggest what I am doing wrong and/or a different way of doing it?
I have created a visualforce chart along the line of this one: http://www.infallibletechie.com/2013/02/pie-chart-and-bar-chart-using-apex-in.html. However I also wish to be able to set the values for Minimun and Maximum based on other fields in the Member__c object. I tried simply setting
minimum="data"

but get the error "Visualforce Error. Unable to convert value 'data' to type 'Integer' for attribute 'minimum' "
Can anyone suggest a different approach?
I'm trying to create a dashboard where not only the data, but also the formatting is set dynamically. 

In my specific example, I have been asked to create a gauge (what I call a 'speedometer') type dashboard element which displays user data, but the data not only defines where the pointer will point to, but also values associated with Breakpoint 1, Breakpoint 2 and Maximum (where the colours start and stop). 

I've read some about Dynamic Dashboards and Wave Analytics, but haven't found anything which tells me how I can influence these values dynamically. Does anyone know if this possible and if so, can you point me in the direction of some documentation / forum post, so I can find out how? Thanks.
I'm trying to display an image that is stored as a Document. Starting with the most basic example, I am using the following:
 
<apex:page standardcontroller="Document">

  <apex:outputField value="{!Document.name}"/>
  <apex:image id="theImage" value="!Document.Logo.jpg" width="100" height="100"/>

</apex:page>

passing the ID of the document in through the URL. It's Name displays OK, but the image does not, just showing as a 'dummy' 100x100 blank square. What syntax do I need to use? Or do I need a different approach some how?
Note, I do not want to use a Static Resource.
Thanks
I've created a VF page with a custom controller, which displays content from (which I'll call Content) on publicly accessible pages on my community (i.e. anyone can access them, and will do so using the Guest User profile.
In the controller I have the code:
public void incCount() {  
    MyContent.Access_Count__c++;
    update MyContent;
    }
This all works fine, until I try to do add a code to count the number of times the page is viewed, which I do by adding the followign to my VF page after the controller declaration:
action="{!incCount}"
As soon as I include action="{!incCount}", My Guest Users are re-directed to the login page instead, i.e. they no longer have access. 
This is surely caused by me trying to Update my Conent table, but this being the case, setting the 'Custom Object Permissions' for the Guest User profile to have access to be able to Edit (and the rest, except Create) should suffice? It would seem not.

Can anyone offer any other reason why this is not working and/or how I can get it to work?

Thanks
I am trying to make a basic donor portal for a not-for-profit company. The basic idea is that donors fill out some details, and their details are used to create a new record of the Donors object. I want to implement this by embedding a flow into a Force.com site. I tried making a basic prototype, however when I access the site, authorization is required. Is there any way to set the permissions such that the public can use flows? Thank you. 
I'm trying to mimic a simple hardcoded survey in a VF page (Survey Force cannot accommodate the size of the questions and/or answers I need).  I wish to ask a question and use the answer to update a field on the Contact record associated with the user in question.
I'm struggling with the update - in the code below, my 'Connect__c' field on Contact is only ever set to the default value of 'xxx', not the '+5', '+4', or '+3' that I am hoping for. Can anyone suggest what I need to do differently?
Thanks

Controller:
public class TestCon1 {

    String Answer = 'xxx';
    public List<SelectOption> getItems() {
    List<SelectOption> options = new List<SelectOption>(); 
    options.add(new SelectOption('+5','+5 choice')); 
    options.add(new SelectOption('+4','+4 choice')); 
    options.add(new SelectOption('+3','+3 choice'));
    return options; 
    }
    
    public TestCon1() {
        Id Myid = ApexPages.currentPage().getParameters().get('id');
        contact = new Contact(id=Myid, connect__c=this.Answer);
    }
 
    public String getAnswer() { return Answer; }

    public void setAnswer(String Answer) { this.Answer = Answer; }
    
    public Contact contact { get; private set; }

    public PageReference save() {
        try {
            update(contact);
        } catch(System.DMLException e) {
            ApexPages.addMessages(e);
        }
        
        PageReference NextPage = Page.SurveyQuestion2;
         NextPage.getParameters().put('contactId', contact.Id);
          NextPage.setRedirect(true);
          return NextPage;  
    }
}

VF page:
<apex:page controller="MyCon1" tabStyle="Account">
<apex:form >
            <apex:selectRadio value="{!Answer}" layout="pageDirection">
            <apex:selectOptions value="{!items}"/>
            </apex:selectRadio>
<apex:commandButton action="{!save}" value="save"/>
</apex:form>
</apex:page>
I am creating a VF page with a custom controller which upserts a Contact record, then allows navigation to a new VF page (called SurveyQuestion1). This works fine; however, I would also like to pass the ID of the Contact into it through the URL, but no matter what syntax I use (using this page: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_system_pagereference.htm) I run into problems.
The following works without passing the Contact ID; can someone suggest how I can amend it to pass the ID?

public class EnterDetailsController {

    public Contact contact { get; private set; }

    public EnterDetailsController() {
        Id id = ApexPages.currentPage().getParameters().get('id');
        contact = (id == null) ? new Contact() : 
            [SELECT FirstName, LastName, Email FROM Contact WHERE Id = :id];
    }
 
    public PageReference save() {
        try {
            upsert(contact);
        } catch(System.DMLException e) {
            ApexPages.addMessages(e);
   
        }
        //  After successful Save, navigate to SurveyQuestion1 page
            PageReference NextPage = Page.SurveyQuestion1;
                NextPage.setRedirect(true);
            return NextPage;
        
    }
}
Hi. I'm trying to get a image to display on a Visualforce page. I have added a Static Resource, and can get it to display if I cite its name directly, but if I try to reference it using a variable, I either get an error in compilation, or a small 'dummy' image like it can't find the one I've specified.

The code that works find is as follows:

<apex:page standardController="Account">
  <apex:variable var="imageVar" value="MMC_Logo"/>
  <p>Resource name {!imageVar}</p>
<apex:image url="{!$Resource.MMC_Logo}"/>
</apex:page>

However, if I add a penultimate line of 

<apex:image url="{!$Resource.(imageVar)"/>

I get the small 'dummy' image displayed.
Surely this is just a minor syntaxical error, but nothing I have tried will work! Can someone point me in the right direction? 
Thanks..