• Sylvain@RibbonFish
  • NEWBIE
  • 125 Points
  • Member since 2013

  • Chatter
    Feed
  • 5
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 23
    Questions
  • 20
    Replies
Hi everyone,

There is the new Object Order available soon.

First I want to Warn the community if you want to create order by hand and then add OrderItem to it, you wil need to Fix the Pricebook2Id in the Order Object (Parent) before doing it. Might no be obvious but I lost few hours to find it.

THen I wonder how to activate Order by code. Did someone know how to it, according to the little documentation found on the internet here the list of methods available for Order:

create(), delete(), describeLayout(), describeSObjects(), getDeleted(), getUpdated(), query(), retrieve(), search(), undelete(), update(), upsert()

http://www.salesforce.com/us/developer/docs/api/index_Left.htm#CSHID=sforce_api_objects_document.htm|StartTopic=Content%2Fsforce_api_objects_document.htm|SkinName=webhelp
If someone has an idea be free to contribute !
Thanks
Ribbonfish
Hi everyone,
I got an issue with my controller and my visualforce page:
When I click on the first button save it display my second section and hide the first one.
When I try to click on the Show All link the time it is doing nothing and I got this exception by javascript:
Uncaught TypeError: Cannot read property 'document' of null
And then I click again and the commandlink is working.
So if you have any idea.
See an example of the code below :)
Thanks
RB

<apex:page standardController="Object__c"  extensions="ObjectPage" >
<style type="text/css">

.checkBoxColumn
{
  max-width: 20px;
}

.headerStyle
{
  background-color:#FFFECD;
  font-weight:normal;
}
</style>
<apex:sectionHeader title="Object Edit" subtitle="Object"/>
       <apex:form >
       <apex:outputPanel id="thePanel">
                  <apex:pageMessages id="msgs" escape="false" rendered="{!hasError}"/>
         
        </apex:outputPanel>
       <apex:outputPanel id="section1">
       <apex:pageBlock title="Object Edit" mode="Edit" rendered="{!IF(isSave = false,true,false)}" >
    
     
        <apex:pageBlockButtons location="top">
   
                
            <apex:commandLink action="{!verificationBeforeSaving}" immediate="true" value="Save" styleClass="btn" style="color:black;text-decoration:none" reRender="section2,section1"/>
                
        </apex:pageBlockButtons>
      
     
        <apex:pageBlockSection title="Object Information" columns="1" >
         
     
            <apex:pageblocksectionitem >

                    <apex:outputlabel id="hiddenElementId" >Object</apex:outputlabel>
                    <apex:outputpanel layout="block" styleClass="requiredInput">
                        <apex:outputpanel layout="block" styleClass="requiredBlock"></apex:outputpanel>
                       <apex:actionRegion >
                       <apex:selectList  size="1" value="{!selectedObject}"  >
              <apex:selectOptions value="{!ObjectOption}" />
             
              <apex:actionSupport event="onchange" action="{!resetValues}"/>
           
            </apex:selectList>
</apex:actionRegion>
                    </apex:outputpanel>
                </apex:pageblocksectionitem>

              
         
        </apex:pageBlockSection>
       </apex:pageBlock>

       </apex:outputPanel>

       <apex:outputPanel id="section2" >
       <apex:pageBlock title="Apply Object to following Object?" rendered="{!IF(isSave = true,true,false)}"  >
    
        <apex:pageBlockButtons location="top">
                  <apex:commandLink action="{!verificationBeforeSaving}" value="Apply to Selected Object" styleClass="btn" style="color:black;text-decoration:none" >
                <apex:param assignTo="{!applyObject}" value="true" name="applyObject"/>
                  </apex:commandLink>
                
          </apex:pageBlockButtons>
      
        <apex:outputPanel id="tableContainerObject">

 
<div style="max-height:160px;overflow:auto;">

<apex:commandLink id="test" immediate="true" style="font-size:small;text-align:right;" value="  Show all results" action="{!showAll}"  reRender="test,section2,tableObject"/>

  <apex:pageBlockTable value="{!listToDisplay}" var="a" id="tableObject" headerClass="headerStyle">
<apex:facet name="header"><apex:outputText rendered="{!isHeaderVisible}">Results are narrowed down by criteria set by the administrator. </apex:outputText> </apex:facet>
  <apex:column styleClass="checkBoxColumn">
  <!-- This is our selected   Boolean property in our wrapper class -->
  <apex:inputCheckbox value="{!a.isSelected}"></apex:inputCheckbox>
   
</apex:column>


              </apex:pageBlockTable>
            </div>
          </apex:outputPanel>
     
       </apex:pageBlock>
       </apex:outputPanel>
      </apex:form>
     </apex:page>

--------------------------------------------------------------------------------------------------------------------------------------

public with sharing class ObjectPage {

  ApexPages.StandardController GstdController;
    public Boolean hasError {get; set;}
    public Boolean saveAndNew {get; set;}
    Object__c object {get; set;}
    public Id objectId {get; set;}
  
   
    public SelectOption[] objectTypeOption {get; set;}
    public String selectedObjectType {get; set;}

    public Boolean isSave {get; set;}

    public List<Object__c> listToDisplay {get; set;}

    public Boolean applyObject {get; set;}

    public Boolean isHeaderVisible {get; set;}

    // The extension constructor initializes the private member
    // variable mysObject by using the getRecord method from the standard
    // controller.
    public ObjectPage(ApexPages.StandardController stdController) {
      
        GstdController = stdController;
        object = (Object__c)GstdController.getRecord();

        //Get the contact id if we get from the contact page
        if(ApexPages.currentPage().getParameters().get('objectId')!=null)
        {
            objectId =  ApexPages.currentPage().getParameters().get('objectId');

        }

        isSave = false;
        isHeaderVisible = true;
        hasError = true;
        saveAndNew = false;
        applyProduct = false;
        object.Status__c = 'Test';

    }

  

    //This method is call to reset automatically the values when we click a blurb type available in the page
    public void resetValues()
    {
       //Retrive the selected blurb type value
       obj = (Object__c)GstdController.getRecord();

       ObjectType__c currentObjectTypeSelected = informationsByAvailableObjectType.get(selectedObjectType);

    }

    public PageReference verificationBeforeSaving()
    {
        hasError = true;
        object = (Object__c)GstdController.getRecord();
      
        if(selectedObjectType != null )
        {
            object.ObjectType__c = selectedObjectType;
        }

        if(!isSave)
        {
            isSave = true;
            loadObjectUpdateSection();
        }
        else
        {
            return finishRedirectToObject();
        }


        return null;
    }

    //Get the corresponding product to extract the project
    public void loadObjectUpdateSection()
    {
      
        List<Object__c> myList = [Select ID From Object__c Where Status__c = 'Test' Limit 10];
        for(Object obj :myList)
        {
              cObject custObject = new cObject();
              custObject.Test__c = obj;
              listToDisplay.add(custObject);
        }
    }

    public PageReference showAll()
    {
        if(isHeaderVisible)
        {
            isHeaderVisible = false;
            List<Object__c> myList = [Select ID From Object__c  Limit 100];
        for(Object obj :myList)
        {
              cObject custObject = new cObject();
              custObject.Test__c = obj;
              listToDisplay.add(custObject);
        }

        return null;
        }
        else
            isHeaderVisible = true;

        return null;

    }

    public void selectAll()
    {
        for(Object obj : listToDisplay)
        {
            obj.isSelected = true;
        }
    }

    public void deselectAll()
    {
        for(Object obj : listToDisplay)
        {
            obj.isSelected = false;
        }
    }


    public PageReference finishRedirectToObject()
    {
        if(applyObject)
        {
          
            //do something
        }

         
        PageReference pr =  GstdController.save();
      
        if(pr == null)
        {
            hasError = true;
            return pr;
        }
        else{
          
            hasError = false;

          
          
                pr = new PageReference('/' + objectId);
                pr.setRedirect(true);
                return pr;
          
          
        }
    }
}
Hi everyone,
I got an issue with my controller and my visualforce page:
When I click on the first button save it display my second section and hide the first one.
When I try to click on the Show All link the time it is doing nothing and I got this exception by javascript:
Uncaught TypeError: Cannot read property 'document' of null
And then I click again and the commandlink is working.
So if you have any idea.
See an example of the code below :)
Thanks
RB

<apex:page standardController="Object__c"  extensions="ObjectPage" >
<style type="text/css">

.checkBoxColumn
{
  max-width: 20px;
}

.headerStyle
{
  background-color:#FFFECD;
  font-weight:normal;
}
</style>
<apex:sectionHeader title="Object Edit" subtitle="Object"/>
       <apex:form >
       <apex:outputPanel id="thePanel"> 
                  <apex:pageMessages id="msgs" escape="false" rendered="{!hasError}"/>
          
        </apex:outputPanel>
       <apex:outputPanel id="section1">
       <apex:pageBlock title="Object Edit" mode="Edit" rendered="{!IF(isSave = false,true,false)}" >
     
      
        <apex:pageBlockButtons location="top">
    
                 
            <apex:commandLink action="{!verificationBeforeSaving}" immediate="true" value="Save" styleClass="btn" style="color:black;text-decoration:none" reRender="section2,section1"/>
                 
        </apex:pageBlockButtons>
       
      
        <apex:pageBlockSection title="Object Information" columns="1" >
          
      
            <apex:pageblocksectionitem >

                    <apex:outputlabel id="hiddenElementId" >Object</apex:outputlabel>
                    <apex:outputpanel layout="block" styleClass="requiredInput">
                        <apex:outputpanel layout="block" styleClass="requiredBlock"></apex:outputpanel>
                       <apex:actionRegion >
                       <apex:selectList  size="1" value="{!selectedObject}"  >
              <apex:selectOptions value="{!ObjectOption}" />
              
              <apex:actionSupport event="onchange" action="{!resetValues}"/>
            
            </apex:selectList>
</apex:actionRegion>
                    </apex:outputpanel>
                </apex:pageblocksectionitem>

               
          
        </apex:pageBlockSection>
       </apex:pageBlock>

       </apex:outputPanel>

       <apex:outputPanel id="section2" >
       <apex:pageBlock title="Apply Object to following Object?" rendered="{!IF(isSave = true,true,false)}"  >
     
        <apex:pageBlockButtons location="top">
                  <apex:commandLink action="{!verificationBeforeSaving}" value="Apply to Selected Object" styleClass="btn" style="color:black;text-decoration:none" >
                <apex:param assignTo="{!applyObject}" value="true" name="applyObject"/>
                  </apex:commandLink>
                 
          </apex:pageBlockButtons>
       
        <apex:outputPanel id="tableContainerObject">

  
<div style="max-height:160px;overflow:auto;">

<apex:commandLink id="test" immediate="true" style="font-size:small;text-align:right;" value="  Show all results" action="{!showAll}"  reRender="test,section2,tableObject"/>

  <apex:pageBlockTable value="{!listToDisplay}" var="a" id="tableObject" headerClass="headerStyle">
<apex:facet name="header"><apex:outputText rendered="{!isHeaderVisible}">Results are narrowed down by criteria set by the administrator. </apex:outputText> </apex:facet>
  <apex:column styleClass="checkBoxColumn">
  <!-- This is our selected   Boolean property in our wrapper class -->
  <apex:inputCheckbox value="{!a.isSelected}"></apex:inputCheckbox>
    
</apex:column>


              </apex:pageBlockTable>
            </div>
          </apex:outputPanel>
      
       </apex:pageBlock>
       </apex:outputPanel>
      </apex:form>
     </apex:page>

--------------------------------------------------------------------------------------------------------------------------------------

public with sharing class ObjectPage {
 
  ApexPages.StandardController GstdController;
    public Boolean hasError {get; set;}
    public Boolean saveAndNew {get; set;}
    Object__c object {get; set;}
    public Id objectId {get; set;}
   
    
    public SelectOption[] objectTypeOption {get; set;}
    public String selectedObjectType {get; set;}

    public Boolean isSave {get; set;}

    public List<Object__c> listToDisplay {get; set;}

    public Boolean applyObject {get; set;}

    public Boolean isHeaderVisible {get; set;}

    // The extension constructor initializes the private member
    // variable mysObject by using the getRecord method from the standard
    // controller.
    public ObjectPage(ApexPages.StandardController stdController) {
       
        GstdController = stdController;
        object = (Object__c)GstdController.getRecord();

        //Get the contact id if we get from the contact page
        if(ApexPages.currentPage().getParameters().get('objectId')!=null)
        {
            objectId =  ApexPages.currentPage().getParameters().get('objectId');

        }

        isSave = false;
        isHeaderVisible = true;
        hasError = true;
        saveAndNew = false;
        applyProduct = false;
        object.Status__c = 'Test';

    }

   

    //This method is call to reset automatically the values when we click a blurb type available in the page
    public void resetValues()
    {
       //Retrive the selected blurb type value
       obj = (Object__c)GstdController.getRecord();

       ObjectType__c currentObjectTypeSelected = informationsByAvailableObjectType.get(selectedObjectType);

    }

    public PageReference verificationBeforeSaving()
    {
        hasError = true;
        object = (Object__c)GstdController.getRecord();
       
        if(selectedObjectType != null )
        {
            object.ObjectType__c = selectedObjectType;
        }

        if(!isSave)
        {
            isSave = true;
            loadObjectUpdateSection();
        }
        else
        {
            return finishRedirectToObject();
        }


        return null;
    }

    //Get the corresponding product to extract the project
    public void loadObjectUpdateSection()
    {
       
        List<Object__c> myList = [Select ID From Object__c Where Status__c = 'Test' Limit 10];
        for(Object obj :myList)
        {
              cObject custObject = new cObject();
              custObject.Test__c = obj;
              listToDisplay.add(custObject);
        }
    }

    public PageReference showAll()
    {
        if(isHeaderVisible)
        {
            isHeaderVisible = false;
            List<Object__c> myList = [Select ID From Object__c  Limit 100];
        for(Object obj :myList)
        {
              cObject custObject = new cObject();
              custObject.Test__c = obj;
              listToDisplay.add(custObject);
        }

        return null;
        }
        else
            isHeaderVisible = true;

        return null;

    }

    public void selectAll()
    {
        for(Object obj : listToDisplay)
        {
            obj.isSelected = true;
        }
    }

    public void deselectAll()
    {
        for(Object obj : listToDisplay)
        {
            obj.isSelected = false;
        }
    }


    public PageReference finishRedirectToObject()
    {
        if(applyObject)
        {
           
            //do something
        }

          
        PageReference pr =  GstdController.save();
       
        if(pr == null)
        {
            hasError = true;
            return pr;
        }
        else{
           
            hasError = false;

           
           
                pr = new PageReference('/' + objectId);
                pr.setRedirect(true);
                return pr;
           
           
        }
    }
}
Hi,
I would like to know if there is a way to add a video for a record? The video might be different depending of a value of a field.
This video will not be uploaded on Youtube. We would like to upload them to a private server or in Salesforce Platform.
Any suggestion ?
Maybe be developping a custom object with a custom page or component and add it to the page layout of the object?
Thanks
Ribbonfish

Hi,

I would like to know something:

I got a hierarchy in account. I have build a report for sales opportunity to extract data by a custom field in the Account link to the Sale Opportunity. When I add the report in the page layout of Account I'm not able to filter by the custom field which is used to get the data from the report. There is a way to filter the report by a custom field from the layout in the setup ? 

Thanks

RibbonFish

Hi,

This code was working previously since one month I can't run it:

Product2 pdt2 = new Product2(Name='Test',ProductCode = '222');
        Product2 pdt3 = new Product2(Name='Test',ProductCode = '222');

  
        insert pdt2;
        insert pdt3;

        Pricebook2 pBook = [Select Id, Name, IsActive From Pricebook2 where IsStandard = true LIMIT 1];
        PricebookEntry pBookEntry = new PricebookEntry(UnitPrice=35,Pricebook2Id=pBook.Id,Product2Id=pdt2.Id,IsActive=true,UseStandardPrice=false);
        insert pBookEntry;

 The error:

 

Products do not have a standard price.

 

Thanks

Hi,

I would like to add related to certain profile like Standard plateform user or plateform User.

When I create the field with the related list associated, I tick the checkox overwrtie user personnal cust...

The profile was also tick in the Visible property.

So why the related list doesn't show at all in the page ?

It's shows only for SA and some other profiles..

Thanks

 

Hi everyone,

I would like to rename the AccountId field in the Contact page because at the moment it's display:

Name: myContactName

Name: The account link to it

NB: I can't rename it from tabs and label because it will rename it everywhere...

Thanks

 

Hi everyone,

I would like to redirect my user to a custom page with a custom controller. In this case I instantiate the custom controller to set up some parameters and would like to redirect to the controller page with the data set up.

Here the code:

VisualForce:

<apex:page standardController="Product2" extensions="Ext" action="{!returnPage}"/>

 

Apex:

public class Ext {

private final sObject mysObject;

// The extension constructor initializes the private member
// variable mysObject by using the getRecord method from the standard
// controller.
public Ext(ApexPages.StandardController stdController) {
this.mysObject = (sObject)stdController.getRecord();
}

public PageReference returnPage()
{
MycustomController cust = new MycustomController();
cust.productList.add((Product2)mysObject); //productList is a property of the controller public

return .....; //What do I should put in the return to access with the instantiated controller to the corresponding page
}
}

 

Thanks

 

Hi everyone,

I got this code:

List<String> Name = new LisT<String>();

List<AccountContactRole> listTemp = [Select Id,AccountID,Account.Name From AccountContactRole];

for(AccountContactRole acr : listTemp)

{

Name.add(acr.get('Account.Name'));

}

 

I got this error:

Invalid field Account.Name for AccountContactRole

 

Or in a visualpage if I want to access to this field I do:

<apex:column value="{!myVar.Account.Name}"/>

And it's working.

So How I can access to Name via Apex without doing a query again?

Thanks

 

Hi everyone,

I got this query:

Select  PickListField__c, Name  FROM Product2   Group By Name,PickListField__c

if I run this query I got this message:

Field 'PickListField__c' can not be grouped in a query call

If I remove the field from the group by:

Select  PickListField__c, Name  FROM Product2   Group By Name

Error: Field must be grouped or aggregated: PickListField__c

Any ideas how to solve my problem?

THanks

Hi,

I would like to extract the SObject (not the properties by using ar.get(x)) from an aggregateResult object.

There is no way to do that ?

Like:

 

AggregateResult ar;

Product2 p = ar;

 

(give me this error: Invalid conversion from runtime type SOBJECT:AggregateResult to SOBJECT:Product2)

Thanks

Hi,

I got this situation:

Salesforce       >       [  VPNCLIENT   [>Webservice (external application)]       ]

How in apex could we configuren the VPN access to call the web service ?

Thanks

Hi,

I got this situation:

Salesforce       >       [  VPNCLIENT   [>Webservice (external application)]       ]

How in apex could we configuren the VPN access to call the web service ?

Thanks

Hello,

I got this query:

Select Family__r.Name, Family__c, Name From Product2  (Ok Works)

 

 

Select Family__r.Name, Family__c, Name From Product2 Group By Family__r.Name, Family__c, Name (Not Working)

Error Message: MALFORMED_QUERY - duplicate alias: Name.

 

Ok I got it, Name and Name but if I remove it:

Select Family__r.Name, Family__c From Product2 Group By Family__r.Name, Family__c (ok works)

But the problem is I need Name of the product as well.

Did someone have an idea?

Thanks.

Hi,

We got this situation:

Salesforce>VPN>webservice distant.

For now I can connect to a webservice, did salesforce can connect to a webservice behind a VPN ?

Or salesforce can connect to the VPN and consume the web service ?

THanks for help ! 

 

Hello.

I got a long list of questions about the Mobile development with salesforce.com.

I have developed an application (App) for a client. This application got 4 tabs use object from salesforce.com and custom object. This app is setting up with custom settings. 

If my client want to access by web with tab or phone, How about touch screen with the existing code? this is working normally? Did I have to activate something ?

There is a SDK Mobile platform. My client want to use a part of the application with an other development. Can I reuse my apex code to build a Aplpication with the mobile SDK plus the other specifications ?

Or I have to redo it from scratch?

Thanks a lot

 

Hi everyone,

I would like to know if there is a way to implement this situation on salesforce:

CustomObjectA=>productA,ProductB

CustomObjectB=>productB,ProductE

CustomObjectC=>productA,ProductE

 

For now I used lookup relationship but a product can be attached to only one customObject...

How I can attached the same product to different CustomObject?

Thanks

Sylvain

Hi everyone,

I want to add an Order to salesforce.

I have been searching on the internet an object already done and it's not the case.

So I hesitate between derivated SalesOpportunity object to manage inside an "Order" status and add some fields.

Or I can create a new custom object.

What are you thought on it?

Thanks

Sylvain

Hi everyone,

I have modified the Opportunity object and I have created 2 views:

ViewTypeA: return me all the Opportunity of a certain customType__c = "ExampleA"

ViewTypeB: return me all the Opportunity of a certain customType__c = "ExampleB"

Now when I'm on the view I can still access to the button "New Opportunity". When I click on the button I would like to display 2 types of New Opportunity windows depending of the view where the user is from.

Now I have already override the new behavior.

I want to know if it's possible to know which view was selected by using before clicking on new?

Thanks

Sylvain

 

Hi everyone,

There is the new Object Order available soon.

First I want to Warn the community if you want to create order by hand and then add OrderItem to it, you wil need to Fix the Pricebook2Id in the Order Object (Parent) before doing it. Might no be obvious but I lost few hours to find it.

THen I wonder how to activate Order by code. Did someone know how to it, according to the little documentation found on the internet here the list of methods available for Order:

create(), delete(), describeLayout(), describeSObjects(), getDeleted(), getUpdated(), query(), retrieve(), search(), undelete(), update(), upsert()

http://www.salesforce.com/us/developer/docs/api/index_Left.htm#CSHID=sforce_api_objects_document.htm|StartTopic=Content%2Fsforce_api_objects_document.htm|SkinName=webhelp
If someone has an idea be free to contribute !
Thanks
Ribbonfish
Hi everyone,
I got an issue with my controller and my visualforce page:
When I click on the first button save it display my second section and hide the first one.
When I try to click on the Show All link the time it is doing nothing and I got this exception by javascript:
Uncaught TypeError: Cannot read property 'document' of null
And then I click again and the commandlink is working.
So if you have any idea.
See an example of the code below :)
Thanks
RB

<apex:page standardController="Object__c"  extensions="ObjectPage" >
<style type="text/css">

.checkBoxColumn
{
  max-width: 20px;
}

.headerStyle
{
  background-color:#FFFECD;
  font-weight:normal;
}
</style>
<apex:sectionHeader title="Object Edit" subtitle="Object"/>
       <apex:form >
       <apex:outputPanel id="thePanel"> 
                  <apex:pageMessages id="msgs" escape="false" rendered="{!hasError}"/>
          
        </apex:outputPanel>
       <apex:outputPanel id="section1">
       <apex:pageBlock title="Object Edit" mode="Edit" rendered="{!IF(isSave = false,true,false)}" >
     
      
        <apex:pageBlockButtons location="top">
    
                 
            <apex:commandLink action="{!verificationBeforeSaving}" immediate="true" value="Save" styleClass="btn" style="color:black;text-decoration:none" reRender="section2,section1"/>
                 
        </apex:pageBlockButtons>
       
      
        <apex:pageBlockSection title="Object Information" columns="1" >
          
      
            <apex:pageblocksectionitem >

                    <apex:outputlabel id="hiddenElementId" >Object</apex:outputlabel>
                    <apex:outputpanel layout="block" styleClass="requiredInput">
                        <apex:outputpanel layout="block" styleClass="requiredBlock"></apex:outputpanel>
                       <apex:actionRegion >
                       <apex:selectList  size="1" value="{!selectedObject}"  >
              <apex:selectOptions value="{!ObjectOption}" />
              
              <apex:actionSupport event="onchange" action="{!resetValues}"/>
            
            </apex:selectList>
</apex:actionRegion>
                    </apex:outputpanel>
                </apex:pageblocksectionitem>

               
          
        </apex:pageBlockSection>
       </apex:pageBlock>

       </apex:outputPanel>

       <apex:outputPanel id="section2" >
       <apex:pageBlock title="Apply Object to following Object?" rendered="{!IF(isSave = true,true,false)}"  >
     
        <apex:pageBlockButtons location="top">
                  <apex:commandLink action="{!verificationBeforeSaving}" value="Apply to Selected Object" styleClass="btn" style="color:black;text-decoration:none" >
                <apex:param assignTo="{!applyObject}" value="true" name="applyObject"/>
                  </apex:commandLink>
                 
          </apex:pageBlockButtons>
       
        <apex:outputPanel id="tableContainerObject">

  
<div style="max-height:160px;overflow:auto;">

<apex:commandLink id="test" immediate="true" style="font-size:small;text-align:right;" value="  Show all results" action="{!showAll}"  reRender="test,section2,tableObject"/>

  <apex:pageBlockTable value="{!listToDisplay}" var="a" id="tableObject" headerClass="headerStyle">
<apex:facet name="header"><apex:outputText rendered="{!isHeaderVisible}">Results are narrowed down by criteria set by the administrator. </apex:outputText> </apex:facet>
  <apex:column styleClass="checkBoxColumn">
  <!-- This is our selected   Boolean property in our wrapper class -->
  <apex:inputCheckbox value="{!a.isSelected}"></apex:inputCheckbox>
    
</apex:column>


              </apex:pageBlockTable>
            </div>
          </apex:outputPanel>
      
       </apex:pageBlock>
       </apex:outputPanel>
      </apex:form>
     </apex:page>

--------------------------------------------------------------------------------------------------------------------------------------

public with sharing class ObjectPage {
 
  ApexPages.StandardController GstdController;
    public Boolean hasError {get; set;}
    public Boolean saveAndNew {get; set;}
    Object__c object {get; set;}
    public Id objectId {get; set;}
   
    
    public SelectOption[] objectTypeOption {get; set;}
    public String selectedObjectType {get; set;}

    public Boolean isSave {get; set;}

    public List<Object__c> listToDisplay {get; set;}

    public Boolean applyObject {get; set;}

    public Boolean isHeaderVisible {get; set;}

    // The extension constructor initializes the private member
    // variable mysObject by using the getRecord method from the standard
    // controller.
    public ObjectPage(ApexPages.StandardController stdController) {
       
        GstdController = stdController;
        object = (Object__c)GstdController.getRecord();

        //Get the contact id if we get from the contact page
        if(ApexPages.currentPage().getParameters().get('objectId')!=null)
        {
            objectId =  ApexPages.currentPage().getParameters().get('objectId');

        }

        isSave = false;
        isHeaderVisible = true;
        hasError = true;
        saveAndNew = false;
        applyProduct = false;
        object.Status__c = 'Test';

    }

   

    //This method is call to reset automatically the values when we click a blurb type available in the page
    public void resetValues()
    {
       //Retrive the selected blurb type value
       obj = (Object__c)GstdController.getRecord();

       ObjectType__c currentObjectTypeSelected = informationsByAvailableObjectType.get(selectedObjectType);

    }

    public PageReference verificationBeforeSaving()
    {
        hasError = true;
        object = (Object__c)GstdController.getRecord();
       
        if(selectedObjectType != null )
        {
            object.ObjectType__c = selectedObjectType;
        }

        if(!isSave)
        {
            isSave = true;
            loadObjectUpdateSection();
        }
        else
        {
            return finishRedirectToObject();
        }


        return null;
    }

    //Get the corresponding product to extract the project
    public void loadObjectUpdateSection()
    {
       
        List<Object__c> myList = [Select ID From Object__c Where Status__c = 'Test' Limit 10];
        for(Object obj :myList)
        {
              cObject custObject = new cObject();
              custObject.Test__c = obj;
              listToDisplay.add(custObject);
        }
    }

    public PageReference showAll()
    {
        if(isHeaderVisible)
        {
            isHeaderVisible = false;
            List<Object__c> myList = [Select ID From Object__c  Limit 100];
        for(Object obj :myList)
        {
              cObject custObject = new cObject();
              custObject.Test__c = obj;
              listToDisplay.add(custObject);
        }

        return null;
        }
        else
            isHeaderVisible = true;

        return null;

    }

    public void selectAll()
    {
        for(Object obj : listToDisplay)
        {
            obj.isSelected = true;
        }
    }

    public void deselectAll()
    {
        for(Object obj : listToDisplay)
        {
            obj.isSelected = false;
        }
    }


    public PageReference finishRedirectToObject()
    {
        if(applyObject)
        {
           
            //do something
        }

          
        PageReference pr =  GstdController.save();
       
        if(pr == null)
        {
            hasError = true;
            return pr;
        }
        else{
           
            hasError = false;

           
           
                pr = new PageReference('/' + objectId);
                pr.setRedirect(true);
                return pr;
           
           
        }
    }
}
Hi everyone,
I got an issue with my controller and my visualforce page:
When I click on the first button save it display my second section and hide the first one.
When I try to click on the Show All link the time it is doing nothing and I got this exception by javascript:
Uncaught TypeError: Cannot read property 'document' of null
And then I click again and the commandlink is working.
So if you have any idea.
See an example of the code below :)
Thanks
RB

<apex:page standardController="Object__c"  extensions="ObjectPage" >
<style type="text/css">

.checkBoxColumn
{
  max-width: 20px;
}

.headerStyle
{
  background-color:#FFFECD;
  font-weight:normal;
}
</style>
<apex:sectionHeader title="Object Edit" subtitle="Object"/>
       <apex:form >
       <apex:outputPanel id="thePanel">
                  <apex:pageMessages id="msgs" escape="false" rendered="{!hasError}"/>
         
        </apex:outputPanel>
       <apex:outputPanel id="section1">
       <apex:pageBlock title="Object Edit" mode="Edit" rendered="{!IF(isSave = false,true,false)}" >
    
     
        <apex:pageBlockButtons location="top">
   
                
            <apex:commandLink action="{!verificationBeforeSaving}" immediate="true" value="Save" styleClass="btn" style="color:black;text-decoration:none" reRender="section2,section1"/>
                
        </apex:pageBlockButtons>
      
     
        <apex:pageBlockSection title="Object Information" columns="1" >
         
     
            <apex:pageblocksectionitem >

                    <apex:outputlabel id="hiddenElementId" >Object</apex:outputlabel>
                    <apex:outputpanel layout="block" styleClass="requiredInput">
                        <apex:outputpanel layout="block" styleClass="requiredBlock"></apex:outputpanel>
                       <apex:actionRegion >
                       <apex:selectList  size="1" value="{!selectedObject}"  >
              <apex:selectOptions value="{!ObjectOption}" />
             
              <apex:actionSupport event="onchange" action="{!resetValues}"/>
           
            </apex:selectList>
</apex:actionRegion>
                    </apex:outputpanel>
                </apex:pageblocksectionitem>

              
         
        </apex:pageBlockSection>
       </apex:pageBlock>

       </apex:outputPanel>

       <apex:outputPanel id="section2" >
       <apex:pageBlock title="Apply Object to following Object?" rendered="{!IF(isSave = true,true,false)}"  >
    
        <apex:pageBlockButtons location="top">
                  <apex:commandLink action="{!verificationBeforeSaving}" value="Apply to Selected Object" styleClass="btn" style="color:black;text-decoration:none" >
                <apex:param assignTo="{!applyObject}" value="true" name="applyObject"/>
                  </apex:commandLink>
                
          </apex:pageBlockButtons>
      
        <apex:outputPanel id="tableContainerObject">

 
<div style="max-height:160px;overflow:auto;">

<apex:commandLink id="test" immediate="true" style="font-size:small;text-align:right;" value="  Show all results" action="{!showAll}"  reRender="test,section2,tableObject"/>

  <apex:pageBlockTable value="{!listToDisplay}" var="a" id="tableObject" headerClass="headerStyle">
<apex:facet name="header"><apex:outputText rendered="{!isHeaderVisible}">Results are narrowed down by criteria set by the administrator. </apex:outputText> </apex:facet>
  <apex:column styleClass="checkBoxColumn">
  <!-- This is our selected   Boolean property in our wrapper class -->
  <apex:inputCheckbox value="{!a.isSelected}"></apex:inputCheckbox>
   
</apex:column>


              </apex:pageBlockTable>
            </div>
          </apex:outputPanel>
     
       </apex:pageBlock>
       </apex:outputPanel>
      </apex:form>
     </apex:page>

--------------------------------------------------------------------------------------------------------------------------------------

public with sharing class ObjectPage {

  ApexPages.StandardController GstdController;
    public Boolean hasError {get; set;}
    public Boolean saveAndNew {get; set;}
    Object__c object {get; set;}
    public Id objectId {get; set;}
  
   
    public SelectOption[] objectTypeOption {get; set;}
    public String selectedObjectType {get; set;}

    public Boolean isSave {get; set;}

    public List<Object__c> listToDisplay {get; set;}

    public Boolean applyObject {get; set;}

    public Boolean isHeaderVisible {get; set;}

    // The extension constructor initializes the private member
    // variable mysObject by using the getRecord method from the standard
    // controller.
    public ObjectPage(ApexPages.StandardController stdController) {
      
        GstdController = stdController;
        object = (Object__c)GstdController.getRecord();

        //Get the contact id if we get from the contact page
        if(ApexPages.currentPage().getParameters().get('objectId')!=null)
        {
            objectId =  ApexPages.currentPage().getParameters().get('objectId');

        }

        isSave = false;
        isHeaderVisible = true;
        hasError = true;
        saveAndNew = false;
        applyProduct = false;
        object.Status__c = 'Test';

    }

  

    //This method is call to reset automatically the values when we click a blurb type available in the page
    public void resetValues()
    {
       //Retrive the selected blurb type value
       obj = (Object__c)GstdController.getRecord();

       ObjectType__c currentObjectTypeSelected = informationsByAvailableObjectType.get(selectedObjectType);

    }

    public PageReference verificationBeforeSaving()
    {
        hasError = true;
        object = (Object__c)GstdController.getRecord();
      
        if(selectedObjectType != null )
        {
            object.ObjectType__c = selectedObjectType;
        }

        if(!isSave)
        {
            isSave = true;
            loadObjectUpdateSection();
        }
        else
        {
            return finishRedirectToObject();
        }


        return null;
    }

    //Get the corresponding product to extract the project
    public void loadObjectUpdateSection()
    {
      
        List<Object__c> myList = [Select ID From Object__c Where Status__c = 'Test' Limit 10];
        for(Object obj :myList)
        {
              cObject custObject = new cObject();
              custObject.Test__c = obj;
              listToDisplay.add(custObject);
        }
    }

    public PageReference showAll()
    {
        if(isHeaderVisible)
        {
            isHeaderVisible = false;
            List<Object__c> myList = [Select ID From Object__c  Limit 100];
        for(Object obj :myList)
        {
              cObject custObject = new cObject();
              custObject.Test__c = obj;
              listToDisplay.add(custObject);
        }

        return null;
        }
        else
            isHeaderVisible = true;

        return null;

    }

    public void selectAll()
    {
        for(Object obj : listToDisplay)
        {
            obj.isSelected = true;
        }
    }

    public void deselectAll()
    {
        for(Object obj : listToDisplay)
        {
            obj.isSelected = false;
        }
    }


    public PageReference finishRedirectToObject()
    {
        if(applyObject)
        {
          
            //do something
        }

         
        PageReference pr =  GstdController.save();
      
        if(pr == null)
        {
            hasError = true;
            return pr;
        }
        else{
          
            hasError = false;

          
          
                pr = new PageReference('/' + objectId);
                pr.setRedirect(true);
                return pr;
          
          
        }
    }
}

Hi,

I would like to know something:

I got a hierarchy in account. I have build a report for sales opportunity to extract data by a custom field in the Account link to the Sale Opportunity. When I add the report in the page layout of Account I'm not able to filter by the custom field which is used to get the data from the report. There is a way to filter the report by a custom field from the layout in the setup ? 

Thanks

RibbonFish

Hi,

This code was working previously since one month I can't run it:

Product2 pdt2 = new Product2(Name='Test',ProductCode = '222');
        Product2 pdt3 = new Product2(Name='Test',ProductCode = '222');

  
        insert pdt2;
        insert pdt3;

        Pricebook2 pBook = [Select Id, Name, IsActive From Pricebook2 where IsStandard = true LIMIT 1];
        PricebookEntry pBookEntry = new PricebookEntry(UnitPrice=35,Pricebook2Id=pBook.Id,Product2Id=pdt2.Id,IsActive=true,UseStandardPrice=false);
        insert pBookEntry;

 The error:

 

Products do not have a standard price.

 

Thanks

Hi,

I would like to add related to certain profile like Standard plateform user or plateform User.

When I create the field with the related list associated, I tick the checkox overwrtie user personnal cust...

The profile was also tick in the Visible property.

So why the related list doesn't show at all in the page ?

It's shows only for SA and some other profiles..

Thanks

 

Hi,

I would like to extract the SObject (not the properties by using ar.get(x)) from an aggregateResult object.

There is no way to do that ?

Like:

 

AggregateResult ar;

Product2 p = ar;

 

(give me this error: Invalid conversion from runtime type SOBJECT:AggregateResult to SOBJECT:Product2)

Thanks

Hi,

We got this situation:

Salesforce>VPN>webservice distant.

For now I can connect to a webservice, did salesforce can connect to a webservice behind a VPN ?

Or salesforce can connect to the VPN and consume the web service ?

THanks for help ! 

 

Hello.

I got a long list of questions about the Mobile development with salesforce.com.

I have developed an application (App) for a client. This application got 4 tabs use object from salesforce.com and custom object. This app is setting up with custom settings. 

If my client want to access by web with tab or phone, How about touch screen with the existing code? this is working normally? Did I have to activate something ?

There is a SDK Mobile platform. My client want to use a part of the application with an other development. Can I reuse my apex code to build a Aplpication with the mobile SDK plus the other specifications ?

Or I have to redo it from scratch?

Thanks a lot

 

Hi everyone,

I would like to know if there is a way to implement this situation on salesforce:

CustomObjectA=>productA,ProductB

CustomObjectB=>productB,ProductE

CustomObjectC=>productA,ProductE

 

For now I used lookup relationship but a product can be attached to only one customObject...

How I can attached the same product to different CustomObject?

Thanks

Sylvain

Hi everyone,

There is an approach to do something like that (picture):

http://i41.tinypic.com/w6tqab.jpg

 

So I got the list of Account link by AccountContactRole to the contact object.

I got the list of contact for each Account from the ContactID of the AccountContactRole.

The input search is already done.

I got a wrapper for each object with the selected property inside.

How todo the pageblocktable with a pageblocktable inside and expand it when we tick the account?

(I want to display only if the account is tick and if we tick another account the first will be still tick and collapse automatically). 

Or there is another way ?

Thanks for help.

 

 

 

 

 

Hi,

See the following example:

global class TestController {

	global cAccountCollection cAccountColl {get; set;}
	
	public BulkSampleController(){
		cAccountColl = new cAccountCollection('Account');
		
	}
	
	
	global PageReference ccSearch()
	{
	        cAccountColl.cSearch('Select Type, Name From Account');
		return null;
		
	}

	global PageReference WebSearch(String query)
		{
			
			
			cAccountColl.cSearch(query);
			
			return null;
			
		}

	
	 webService static cAccountCollection webSccSearch(String query)
	 {
	 	
	 	BulkSampleController test2 = new BulkSampleController();
	 	test2.WebSearch(query);
	 	
	 	
	 	return test2.cAccountColl;
	 }
	
	
	webService static BaseModelCollection webSccSearch2(String query)
	 {
	 	
	 	BulkSampleController test2 = new BulkSampleController();
	 	test2.WebSearch(query);
	 	
	 	return test2.cAccountColl;
	 }
	
	
}

 I access this by using a web reference in c# (visual studio).

When I receive the object by using the web service, visual studio recognize the object type as cAccountCollection but I can't access property of this object.

Someone know why this happen?

Thanks

Sylvain