• Lena Christy
  • NEWBIE
  • 55 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 15
    Replies
Hi everyone! I don't know if I'm asking too much, but I really need your help about this please!

I want to create a vf page that I put in the Community, where I want each user who's accesing to it, to see its own detail contact and related opportunities to its Account.
P.S. I enabled the "Partner User" for the contact and give him "Partner Community User" as a Profile.
Here is my code, I really hope you could help me with this.
<apex:page standardController="Contact" extensions="DetailPageCon">
<apex:form >
<apex:pageblock id="CustomList" title="Related Opportunities"  >
   <apex:pageBlockTable value="{!oppz}" var="o" rendered="{!NOT(ISNULL(oppz))}">
        <apex:column value="{!o.Name}"/>
        <apex:column value="{!o.Account.Name}"/>
        <apex:column value="{!o.Type}"/>
       <apex:column value="{!o.Amount}"></apex:column>
       <apex:column value="{!o.CloseDate}"/>
   </apex:pageBlockTable>
   <apex:outputLabel value="No records to display" rendered="{!(ISNULL(oppz))}" styleClass="noRowsHeader"></apex:outputLabel>
 </apex:pageblock>
</apex:form>
</apex:page>
The controller:
public class DetailPageCon {
    private List<Opportunity> oppz;
    private Contact cntact; 
    public DetailPageCon(ApexPages.StandardController controller) {
        this.cntact= (Contact)controller.getRecord();
    }
    public List<Opportunity> getOppz()
    {
        Contact con = [Select id, Account.id FROM Contact where id = :cntact.id];
        if (con.Account == null)
         return null;
        oppz = [Select id, Name, Account.Name, CloseDate, Amount, Type from Opportunity where Account.id = :con.Account.id];
        return oppz;
    }
}

 
Hi everyone !
I want to create a customer community for the contacts for who I already enable for them “the customer user” and I give them “Customer Community” as User Licence and “Customer Community User” as Profile.
What I need is a vf page where each contact can see its own account and opportunities in a vf page in the community.
Something like that: (this one doesn't work!)
<apex:page standardController="Contact" recordSetVar="contacts"  sidebar="false">
    <apex:pageBlock >
          <apex:repeat value="{!contacts}" var="con">
<apex:pageBlockSection title="{!con.Name}"></apex:pageBlockSection>
<apex:relatedList list="Account" subject="{!con.Id}"/>
<apex:relatedList list="Opportunities" subject="{!con.Id}" />
</apex:repeat>      
     </apex:pageBlock>
</apex:page>
I read that we can not display Opportunities when we enable the “Community User” for contacts, what should I change?
If you can help me with this I would be grateful..
Thanks in advance.
 

Hi all,
I have an issue, I think ut is simple but I could not do it, I hope you could help me,
Here is the issue, 
I made a vf page to display the value fields of a list custom setting "csObject__c" and editing its fields.

I want to make only one record which name="param" where i will modify its fields from the vf page, it's like in the beginning I put only the name 'param' in custom settings, then I can modify the other fields, the important it should be one only record which is Name='param'

<apex:page standardController="csObject__c" recordSetVar="CSparam" extensions="Ctrl">

<apex:form >

<apex:pageBlock >

<apex:pageBlockButtons >
 <apex:commandButton value="Save" action="{!save}" "/>
</apex:pageBlockButtons>


<apex:pageBlockSection  >
<apex:pageBlockTable value="{!CSparam}" var="a" > 
  <apex:column headerValue="Field 1 ">
  <apex:inputField value="{!a.Field1__c}" />
  </apex:column>
  </apex:pageBlockTable>
  </apex:pageBlockSection>

//here I have other field of the custom setting

</apex:pageBlock >
</apex:form > 
</apex:page>

And for the save button I  want to override it to redirect to another vf page:

public with sharing class Ctrl {

    public Ctrl (ApexPages.StandardSetController controller) {

    }
    
    public PageReference  save() {
       csObject__c  cs = csObject__c.getValues('param');
       update cs;
       PageReference pageRef = new PageReference('/apex/VF');
       return pageRef;
   }

    
}

But it doesn't work I still have the old values of the cs fields...

If anyone could help me with this, it would be great...

Thanks!

Hi everyone,
I tried to create a class to get executed once a year:
global class CalculOnAccount implements Database.Batchable<sObject>{
    global Database.QueryLocator start(Database.BatchableContext BC) {
       String query = 'SELECT field1__c,field2__c, cal__c FROM Account';
       return Database.getQueryLocator(query);
    }
    
    global void execute(Database.BatchableContext BC, List<Account> scope) {
         for(Account a : scope)
         {
             a.cal__c= ((a.field1__c- a.field2__c)*100 )/(a.field2__c);        
         }
         insert scope;
    }  
     
    global void finish(Database.BatchableContext BC) {
    }
}


My questions are:
How to schedule this to get executed in december each year for example? And what I want also is, depending on the result of cal__c, another field in Account will get updated, where I should put this treatment part? in the finish() ?
Thanks in advance

Hi everyone,

I have a question if you could help me it would be awesome.
I have a number custom field in Account field__c, and with a trigger I want all the opportunities' ammount related to the Account get added to this field and be cumulated each time an opp is added to the account.

How can I do it with a trigger please, any idea?

Thanks in advance.

Hi everyone,

It's the first time that I use custom setting and I would be so greatful if you help me with this issues.

What I did is that I created a list custom setting param__c with two number fields: num1__c and num2__c.

So I want to insert there values from a Visualforce page:

<apex:page controller="CustomController"> 
<apex:form >
<apex:inputField value="{!myValueFromPage}"/>
<apex:inputField value="{!secondValueFromPage}"/>

<apex:commandButton action="{!saveValues}" value="Save Input"/>
 </apex:form>
 </apex:page>
 

Its apex code:

public with sharing class CustomController {

public String myValueFromPage {get; set;}

public String secondValueFromPage {get; set;}
    
public CustomController() {

    }

public void saveValues() {
      param__c settings = param__c.getInstance();
    myValueFromPage= settings.num__c ;
    secondValueFromPage= settings.num2__c;
    upsert settings;
    }
}
 

I still don't know how to insert values of the list custom setting from vf page .....!

The second issue is that in the Account standard object I created two number custom fields: field1__c and field2__c.

the field2__c is calculated by num1__c (of the custom setting) divided by field1__c.

The trigger that I made is:

trigger Conversion on Account (before insert) {

 for (Account acc: Trigger.new){
   acc.field2__c= (param__c.num__c)/ (acc.field1__c);
   }
}

I have this error : Error: Compile Error: Arithmetic expressions must use numeric arguments at line 4 column 29

I really need your help.

Thanks.

Hi everyone! I don't know if I'm asking too much, but I really need your help about this please!

I want to create a vf page that I put in the Community, where I want each user who's accesing to it, to see its own detail contact and related opportunities to its Account.
P.S. I enabled the "Partner User" for the contact and give him "Partner Community User" as a Profile.
Here is my code, I really hope you could help me with this.
<apex:page standardController="Contact" extensions="DetailPageCon">
<apex:form >
<apex:pageblock id="CustomList" title="Related Opportunities"  >
   <apex:pageBlockTable value="{!oppz}" var="o" rendered="{!NOT(ISNULL(oppz))}">
        <apex:column value="{!o.Name}"/>
        <apex:column value="{!o.Account.Name}"/>
        <apex:column value="{!o.Type}"/>
       <apex:column value="{!o.Amount}"></apex:column>
       <apex:column value="{!o.CloseDate}"/>
   </apex:pageBlockTable>
   <apex:outputLabel value="No records to display" rendered="{!(ISNULL(oppz))}" styleClass="noRowsHeader"></apex:outputLabel>
 </apex:pageblock>
</apex:form>
</apex:page>
The controller:
public class DetailPageCon {
    private List<Opportunity> oppz;
    private Contact cntact; 
    public DetailPageCon(ApexPages.StandardController controller) {
        this.cntact= (Contact)controller.getRecord();
    }
    public List<Opportunity> getOppz()
    {
        Contact con = [Select id, Account.id FROM Contact where id = :cntact.id];
        if (con.Account == null)
         return null;
        oppz = [Select id, Name, Account.Name, CloseDate, Amount, Type from Opportunity where Account.id = :con.Account.id];
        return oppz;
    }
}

 
Hi everyone !
I want to create a customer community for the contacts for who I already enable for them “the customer user” and I give them “Customer Community” as User Licence and “Customer Community User” as Profile.
What I need is a vf page where each contact can see its own account and opportunities in a vf page in the community.
Something like that: (this one doesn't work!)
<apex:page standardController="Contact" recordSetVar="contacts"  sidebar="false">
    <apex:pageBlock >
          <apex:repeat value="{!contacts}" var="con">
<apex:pageBlockSection title="{!con.Name}"></apex:pageBlockSection>
<apex:relatedList list="Account" subject="{!con.Id}"/>
<apex:relatedList list="Opportunities" subject="{!con.Id}" />
</apex:repeat>      
     </apex:pageBlock>
</apex:page>
I read that we can not display Opportunities when we enable the “Community User” for contacts, what should I change?
If you can help me with this I would be grateful..
Thanks in advance.
 

Hi all,
I have an issue, I think ut is simple but I could not do it, I hope you could help me,
Here is the issue, 
I made a vf page to display the value fields of a list custom setting "csObject__c" and editing its fields.

I want to make only one record which name="param" where i will modify its fields from the vf page, it's like in the beginning I put only the name 'param' in custom settings, then I can modify the other fields, the important it should be one only record which is Name='param'

<apex:page standardController="csObject__c" recordSetVar="CSparam" extensions="Ctrl">

<apex:form >

<apex:pageBlock >

<apex:pageBlockButtons >
 <apex:commandButton value="Save" action="{!save}" "/>
</apex:pageBlockButtons>


<apex:pageBlockSection  >
<apex:pageBlockTable value="{!CSparam}" var="a" > 
  <apex:column headerValue="Field 1 ">
  <apex:inputField value="{!a.Field1__c}" />
  </apex:column>
  </apex:pageBlockTable>
  </apex:pageBlockSection>

//here I have other field of the custom setting

</apex:pageBlock >
</apex:form > 
</apex:page>

And for the save button I  want to override it to redirect to another vf page:

public with sharing class Ctrl {

    public Ctrl (ApexPages.StandardSetController controller) {

    }
    
    public PageReference  save() {
       csObject__c  cs = csObject__c.getValues('param');
       update cs;
       PageReference pageRef = new PageReference('/apex/VF');
       return pageRef;
   }

    
}

But it doesn't work I still have the old values of the cs fields...

If anyone could help me with this, it would be great...

Thanks!

Hi everyone,
I tried to create a class to get executed once a year:
global class CalculOnAccount implements Database.Batchable<sObject>{
    global Database.QueryLocator start(Database.BatchableContext BC) {
       String query = 'SELECT field1__c,field2__c, cal__c FROM Account';
       return Database.getQueryLocator(query);
    }
    
    global void execute(Database.BatchableContext BC, List<Account> scope) {
         for(Account a : scope)
         {
             a.cal__c= ((a.field1__c- a.field2__c)*100 )/(a.field2__c);        
         }
         insert scope;
    }  
     
    global void finish(Database.BatchableContext BC) {
    }
}


My questions are:
How to schedule this to get executed in december each year for example? And what I want also is, depending on the result of cal__c, another field in Account will get updated, where I should put this treatment part? in the finish() ?
Thanks in advance

Hi everyone,

I have a question if you could help me it would be awesome.
I have a number custom field in Account field__c, and with a trigger I want all the opportunities' ammount related to the Account get added to this field and be cumulated each time an opp is added to the account.

How can I do it with a trigger please, any idea?

Thanks in advance.

Hi everyone,

It's the first time that I use custom setting and I would be so greatful if you help me with this issues.

What I did is that I created a list custom setting param__c with two number fields: num1__c and num2__c.

So I want to insert there values from a Visualforce page:

<apex:page controller="CustomController"> 
<apex:form >
<apex:inputField value="{!myValueFromPage}"/>
<apex:inputField value="{!secondValueFromPage}"/>

<apex:commandButton action="{!saveValues}" value="Save Input"/>
 </apex:form>
 </apex:page>
 

Its apex code:

public with sharing class CustomController {

public String myValueFromPage {get; set;}

public String secondValueFromPage {get; set;}
    
public CustomController() {

    }

public void saveValues() {
      param__c settings = param__c.getInstance();
    myValueFromPage= settings.num__c ;
    secondValueFromPage= settings.num2__c;
    upsert settings;
    }
}
 

I still don't know how to insert values of the list custom setting from vf page .....!

The second issue is that in the Account standard object I created two number custom fields: field1__c and field2__c.

the field2__c is calculated by num1__c (of the custom setting) divided by field1__c.

The trigger that I made is:

trigger Conversion on Account (before insert) {

 for (Account acc: Trigger.new){
   acc.field2__c= (param__c.num__c)/ (acc.field1__c);
   }
}

I have this error : Error: Compile Error: Arithmetic expressions must use numeric arguments at line 4 column 29

I really need your help.

Thanks.