• Chanagan Sakulteera
  • NEWBIE
  • 50 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 20
    Questions
  • 14
    Replies

Hi everyone ,

I am new to salesforce. I have got the requirement from customer saying that salesforce need to call outside system through REST API.
I need to send data from salesforce to outside system. I don't have any idea regarding this. Would you please guide and suggest me on how to do this. 

Outside system is using Azure Microsoft.

I will be much appriciated.

Thank you.

Hi all , 

I am new to salesforce and I have requirement that I need to send data from salesforce to the outside system ( Azure AD system). I would need to connect to the outside system using REST API.

I have doubt on how to perform this and how can I send data to the outside system. I have done only the opposite way i.e, other system connect to salesforce. I need to preform apex batch too.

If you could please guide me on this.

 

Thank you so much.

Hi all,
I use radio button in my visualforce page but it's not save.
I try apex:inputCheckbox or apex:inputField and actionsupport it's not working.

this is my visualforce page : 
<apex:page standardController="Quotation_Request__c" extensions="Select_MOQ_Extension" sidebar="false">
    
    <p><apex:sectionHeader title="Select MOQ" subtitle="{!theQuote.Name}"/></p>
    
    <apex:form >
    
        <apex:pageBlock title="Quotation Request Line Item">
        
            <apex:repeat value="{!lstQuoteLine}" var="items">
                
                <p>
                
                <apex:pageBlock title="{!items.Name}">
                    
                    <p>
                    <apex:pageBlockSection title="Quotation Request Line Item Information" collapsible="false">
                        
                        <apex:outputField value="{!items.S_J_Code__c}"/>
                        <apex:outputField value="{!items.Trade_Name__c}"/>
                        
                        <apex:outputField value="{!items.Raw_Material_Group_Function__c}"/>
                        <apex:outputText ></apex:outputText>
                        
                        <apex:outputField value="{!items.Unit_Price__c}"/>
                        <apex:outputField value="{!items.Quantity__c}"/>
                        
                    </apex:pageBlockSection>
                    </p>
                    
                    <apex:pageBlockSection title="Quotation MOQ Information" collapsible="false" columns="1"/>
                    
                        <table id="QuoteMOQ" border="1" cellspacing="1" cellpadding="2" bordercolor="#eeeeee" width="30%" style="margin-left:20px">
                            
                            <tr>
                                <td style="background-color: #87CEEB;" align="center"></td>
                                <td style="background-color: #87CEEB;" align="center" ><b>Quantity</b></td>
                                <td style="background-color: #87CEEB;" align="center"><b>Price</b></td>
                                
                            </tr>
                        
                            <apex:repeat value="{!lstQuoteMOQ}" var="item">
                            
                                <apex:outputPanel rendered="{!if (items.Id == item.Quotation_Request_Line_Item__c, true, false)}">
                                    
                                    <tr>
                                    
                                        <td align="center">
                                            
                                            <input type="radio" name="{!item.Quotation_Request_Line_Item__c}" value="{!item.Selected__c}"/>
                                            
                                            <!--
                                            <apex:inputCheckbox value="{!item.Selected__c}">
                                                <apex:actionSupport action="{!onCheck}" event="onchange">
                                                    <apex:param assignTo="{!checkMOQ}" value="{!item.Id}" name="checkMOQ"/>
                                                    <apex:param assignTo="{!checkQuoteLine}" value="{!item.Quotation_Request_Line_Item__c}" name="checkQuoteLine"/>
                                                </apex:actionSupport>
                                            </apex:inputCheckbox>
                                            -->
                                            
                                        </td>
                                        <td align="center">{!item.Quantity__c}</td>
                                        <td align="center">{!item.Price__c}</td>
                                        
                                    </tr>
                                    
                                </apex:outputPanel>
                                
                            </apex:repeat>
                        
                        </table>
                                        
                </apex:pageBlock>
                
                </p>
                
            </apex:repeat>
            
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!onSave}"/>
                <apex:commandButton value="Cancel" action="{!Cancel}"/>
            </apex:pageBlockButtons>
            
        </apex:pageBlock>
        
    </apex:form>
    
</apex:page>

and this is my controller : 
public with sharing class Select_MOQ_Extension {
    
    private String quoteId {get; set;}
    public Quotation_Request__c theQuote {get; set;}
    
    public List<Quotation_Request_Line_Item__c> lstQuoteLine {get; set;}
    public List<Quotation_MOQ__c> lstQuoteMOQ {get; set;}
    
    public String checkMOQ {get; set;}
    public String checkQuoteLine {get; set;}
    
    public Select_MOQ_Extension(ApexPages.StandardController controller) {
        
        quoteId = ApexPages.currentPage().getParameters().get('id');
        
        theQuote = [select Id, Name from Quotation_Request__c where Id =: quoteId];
        
        lstQuoteLine = [select Id, Quantity__c, Quotation_Request__c, Unit_Price__c, Raw_Material_Group_Function__c, S_J_Code__c, Trade_Name__c, Name from Quotation_Request_Line_Item__c where Quotation_Request__c =: theQuote.Id order by Name asc];
        
        lstQuoteMOQ = new List<Quotation_MOQ__c>();
        
        for (Quotation_Request_Line_Item__c quoteLine : lstQuoteLine) {
            
            for (Quotation_MOQ__c quoteMOQ : [select Id, Quantity__c, Quotation_Request_Line_Item__c, Price__c, Quotation_Request__c, Name, Selected__c from Quotation_MOQ__c where Quotation_Request_Line_Item__c =: quoteLine.Id]) {
            
                lstQuoteMOQ.add(quoteMOQ);
            
            }
        
        }
        
    }
    
    public void onCheck() {
        
        system.debug('checkMOQ : ' + checkMOQ);
        
        for (Quotation_MOQ__c quoteMOQ : lstQuoteMOQ) {
        
            if ((String)quoteMOQ.Id == checkMOQ) {
            
                quoteMOQ.Selected__c = true;
                //system.debug('quoteMOQ.Selected__c : ' + quoteMOQ.Selected__c);
            
            } else {
            
                quoteMOQ.Selected__c = false;
            
            }
                    
        }
            
    }
    
    public PageReference onSave() {
    
        for (Quotation_MOQ__c quoteMOQ : lstQuoteMOQ) {
            system.debug('quoteMOQ.Selected__c : ' + quoteMOQ.Selected__c);
            if (quoteMOQ.Selected__c == true) {
            
                Quotation_Request_Line_Item__c quoteLine = [select Id, Unit_Price__c, Quantity__c from Quotation_Request_Line_Item__c where Id =: quoteMOQ.Quotation_Request_Line_Item__c];
                quoteLine.Quantity__c = quoteMOQ.Quantity__c;
                quoteLine.Unit_Price__c = quoteMOQ.Price__c;
                
                upsert(quoteLine);
                
            }
        
        }
        
        upsert(lstQuoteMOQ);
        
        String url = '/'+theQuote.Id;

        PageReference pref = new PageReference(url);
        
        return null;
    
    }
    
}

method onCheck() it not use, if i use <input type="radio" />

Thank you in advance.

 

Hi everyone ,

I would like to know that can I perform any other encrypting method other than existing one in salesforce as

I have to encrypt and use with other system. The other system is using another method of decypting so I have to make

change accordingly. Can I do that in component meaning I need to perform encrypting before sending email .

I have not use visual force page because I have to use component that attached to email template. 

I cannot find any other way and full blank.

 

Do you have any suggestion regarding this ?

 

Thank you so much ..

Hi all, I have a problem regarding Visualforce Email Template with component and controller when I use it with workflow and email alert.

No email was send to me but if I use the button "Send Test and Verify Merge Fields" It works just fine.

The problem is that I am trying to send parameter from VF Email template to component and then pass on to controller.

This is my code in VF email template :

<messaging:emailTemplate subject="Your insurance quote" recipientType="User" relatedToType="Account" >
    <messaging:htmlEmailBody > 
        <c:SSST_Quotation_Number ShowAcctID="{!relatedTo.Id}" rendered="true"></c:SSST_Quotation_Number>
    </messaging:htmlEmailBody>
</messaging:emailTemplate>
 

This is my code for component :

<apex:component controller="SSST_Email" access="global" >
    <apex:attribute access="global" name="ShowAcctID" assignTo="{!contactID}"  type="ID" description="Account ID"/> 
    <apex:outputLabel value="{!QuoNumber}" >  </apex:outputLabel>   
</apex:component>


This is my code for controller :

global with sharing class SSST_Email
{
    public ID contactID;
    public ID getcontactID() { 
        return contactID;   
    }

    public void setcontactID(ID s) { 
        contactID = s;
        mycontactID();
    }
        
    public void mycontactID()
    {
        if(contactId != null){
            acct = [select id , Name , Contact_Email_Address__c , Preferred_Language__c from account where id =: contactId ]; 
            AccountId = acct.Id;
            getQuotationNumber();
        }
    }
    
    
    public void getQuotationNumber()
    {
        List<Quotation__c> Quo = [select name , quotation_number__c , quote_expire_date__c from quotation__c where contact_number__c =: AccountId order by name desc limit 1];
        QuoNumber = Quo[0].Quotation_number__c;
        QuoExpDate = Quo[0].Quote_Expire_Date__c;
        QuotationId = Quo[0].Id;
   }


If I use component in VF Email template without passing parameter it works. 

<c:SSST_Quotation_Number  ></c:SSST_Quotation_Number>
It won't work when I use 
<c:SSST_Quotation_Number ShowAcctID="{!relatedTo.Id}" ></c:SSST_Quotation_Number>

Thank you
 

Hi all, I'm new to salesforce

I have question regarding visualforce page. When I try to add a new row in visualforce page , I want to copy the data form previous row to new row as well how would I do that ? Any suggustion, I would really appreciate.

Thank you

 User-added image

I have an apex extension and VF page, as an override to the New link on a custom object, that does something I would think is pretty standard. For a new record, it checks the RecordType coming in from the URL and returns a different view depending on the record type. Conceptually, like

if (ApexPages.CurrentPage().getParameters().get('RecordType') = '012....')
   return new PageReference('SomePage');
else return new PageReference('SomeOtherPage');


Which is fine until I put the page into Salesforce1. Because in Salesforce1, ApexPages.CurrentPage().getParameters() returns a different set of values.

In normal browser UI, the map contains

{RecordType=012i0000001AXw6, ent=01Ii0000001oJDs, retURL=/a0N/o, save_new=1, sfdc.override=1}

because it's just come off the record type selection page, so it has RecordType and ent.

When the same code runs In Salesforce1, I get the record type selection page, then I'm redirected to my VF, where the map looks a bit different:

{isdtp=p1, nonce=52409e8a3dd9f5289e71c077c88c92422940a5c34ea2585243ef3ea6119d5236, save_new=1, sfdc.override=1, sfdcIFrameOrigin=https://cs15.salesforce.com}

How can I read the URL parameters like RecordType? where are they?

Thank you in advance.
I am having trouble with one of my visualforce page that I want to be able to run in the Salesforce1 App. Right now it is working perfectly if I use a custom link to open up the VF page. But when I try to open the page up from the publisher action instead, it will not work. Please find my controller and VF page below:

Apex Class
 
global with sharing class LeadController{

    public Id leadId{
        get{
            return Id.valueOf(ApexPages.CurrentPage().getparameters().get('id'));
        }
    }
    
    private Lead lead{get; set;}
    
    public String lat{
        get{
            if(lead == null || lead.Location__Latitude__s == null)
                return 'null';
            
          return lead.Location__Latitude__s + '';
        }
    }
    
    public String lng{
        get{
            if(lead == null || lead.Location__Longitude__s == null)
                return 'null';
            
          return lead.Location__Longitude__s + '';
        }
    }
    
    global leadController(ApexPages.StandardController controller) {
    lead = [select Id, Location__Latitude__s, Location__Longitude__s from Lead where Id = :leadId];
    }
    
    public PageReference test(){
      return null;
    }

    @RemoteAction
    global static String Checkin(Id planId, Double latitude, Double longitude){
        Lead checkin = new Lead(
            Id = planId
            , Location__Latitude__s = latitude
            , Location__Longitude__s = longitude
        );
        
        update checkin;
        
        system.debug('Lead: ' + checkin);
        
        return checkin.Id;
    }
}
 
Visualforce Page
 
<apex:page standardController="Lead" extensions="LeadController" sidebar="false" showHeader="false">
<script>
(function () {
    var leadId = '{!leadId}';
    if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(function(position){
           
            console.log(position.coords);
       
            Visualforce.remoting.Manager.invokeAction(
                '{!$RemoteAction.LeadController.Checkin}'
                , leadId
                , position.coords.latitude
                , position.coords.longitude
                , function(result, event){
                    //window.location = "../../../" + leadId;
                    window.history.back();
                },
                {escape: true}
            );
        });
    } else {
        alert('This device does not support Geolocation operation.');
        //window.location = "../../../" + leadId;
        window.history.back();
    }
})();
</script> 
<div style="text-align:center;height: 100%;padding-top: 10%;">
    <img src="../../../../resource/0/loading"/>
</div>
</apex:page>

Thank you inadvance.
Hi all, I have some experience with apex class but I don't understand how to coding with test class.
If you have any assisting or link that I would better, I really appreciate it.

Last of all, I put some of my trigger in the below to be example to get clearer picture about test class coding.
trigger trgLead on Lead (before insert,before update) {

    Map<String, Lead> leadMap = new Map<String, Lead>();
    for(Lead lead : System.Trigger.new){
    
        // Make sure we don't treat an email address that
        // isn't changing during an update as a duplicate. 
        if((lead.Email != null)&&(System.Trigger.isInsert || (lead.Email != System.Trigger.oldMap.get(lead.Id).Email))){
            
            //Make sure another new lead isn't also a duplicate
            
            if(leadMap.containsKey(lead.Email)){
                lead.Email.addError('Another new lead has the ' + ' same email address.');
            }else{
                leadMap.put(lead.Email, lead);
            }
        }
    }
    
    // Using a single database query, find all the leads in 
    // the database that have the same email address as any 
    // of the leads being inserted or updated.         
    
    for(Lead lead : [Select Email from Lead where Email in : leadMap.KeySet()]){
        Lead newLead = leadMap.get(lead.Email);
        newLead.Email.addError('A lead with this email ' + ' address already exist.');
    }
}
This trigger have check dupdicate in lead.
Hi all,
i want to make uploading attachment file in picture type to be on browse button. can i use the " use if function ". How can I do it? 

this code.
<apex:pageBlock title="Day" id="selected">
             
            <!-- we need two additinal variables, because "item" variable at pageblockSection
                 start at 0... -->
            <apex:variable var="count" value="{!1}"/>
             
            <apex:repeat id="tripDays" value="{!TripDays}" var="item">                       
                <apex:pageblockSection title="{!'Day '}{!count}" columns="1">
                    
                    <apex:variable var="count" value="{!count + 1}"/>
                
                    <apex:inputText id="dayName" value="{!tourInDay}" html-placeholder="Tour In Day" style="width:500px;"/>
                     
                    <apex:commandLink value="Remove Day" action="{!removeTripDay}" reRender="selected">
                        <apex:param name="removeTripDay" value="{!item + 1}"/>
                    </apex:commandLink>
                    
                    <apex:pageblockTable id="listProduct" value="{!ProductService2[item].ProductServices}" var="p"  >
                    
                            <apex:column >
                                <apex:commandButton value="Remove" action="{!removeTripService}" reRender="selected">
                                    <apex:param name="removeService" value="{!p.TempID__c}" /> 
                                </apex:commandButton>
                            </apex:column>
                                                                                    
                            <apex:column headerValue="Service Name">
                                <apex:inputField value="{!p.ServiceName__c}"/>
                            </apex:column>
                                
                            <apex:column headerValue="Description">
                                <apex:inputField value="{!p.Description__c}" />
                            </apex:column>
                            
                            <apex:column headerValue="Service Price" value="{!p.Sales_Price__c}" />
                                                        
                            <apex:column headerValue="Time">
                                <apex:inputField value="{!p.Time__c}"/>
                            </apex:column>
                                                        
                    </apex:pageblockTable>        
           
                </apex:pageblockSection>                
            </apex:repeat>
                  
        </apex:pageBlock>

Thank you in advance.
My page did not redirect url.

and i use this code in vf page.
<apex:commandButton value="Next" action="{!checkCurrencyAllProductService}"/>

and this in controller.

public void checkCurrencyAllProductService(){
        if(mCountCurrency!=0){
            for(integer i = 0 ; i < addCurrency.size() ; i++){
                //-- Check Currency in Land Hotel --\\
                if(addCurrency[i].CurrencyIsoCode == landHotel.CurrencyIsoCode){
                    landHotel.Rate__c = addCurrency[i].Rate__c;
                }
                //-- Check Currency in Land Hotel --\\
                
                //-- Check Currency in List Land Hotel --\\
                if(addCurrency[i].CurrencyIsoCode == lstLandHotel[i].CurrencyIsoCode){
                    lstLandHotel[i].Rate__c = addCurrency[i].Rate__c;
                }
                //-- Check Currency in List Hotel --\\
                
                //-- Check Currency in Land Restaurant --\\
                if(addCurrency[i].CurrencyIsoCode == landRestaurant.CurrencyIsoCode){
                    landRestaurant.Rate__c = addCurrency[i].Rate__c;
                }
                //-- Check Currency in Land Restaurant --\\
                
                //-- Check Currency in List Land Restaurant --\\
                if(addCurrency[i].CurrencyIsoCode == lstRestaurant[i].CurrencyIsoCode){
                    lstRestaurant[i].Rate__c = addCurrency[i].Rate__c;
                }
                //-- Check Currency in List Restaurant --\\
                
                //-- Check Currency in Land Attraction --\\
                if(addCurrency[i].CurrencyIsoCode == landAttraction.CurrencyIsoCode){
                    landAttraction.Rate__c = addCurrency[i].Rate__c;
                }
                //-- Check Currency in Land Attraction --\\
                
                //-- Check Currency in List Land Attraction --\\
                if(addCurrency[i].CurrencyIsoCode == lstAttraction[i].CurrencyIsoCode){
                    lstAttraction[i].Rate__c = addCurrency[i].Rate__c;
                }
                //-- Check Currency in List Attraction --\\
                
                //-- Check Currency in Land Activities --\\
                if(addCurrency[i].CurrencyIsoCode == landActivities.CurrencyIsoCode){
                    landActivities.Rate__c = addCurrency[i].Rate__c;
                }
                //-- Check Currency in Land Activities --\\
                
                //-- Check Currency in List Land Activies --\\
                if(addCurrency[i].CurrencyIsoCode == lstAttraction[i].CurrencyIsoCode){
                    lstAttraction[i].Rate__c = addCurrency[i].Rate__c;
                }
                //-- Check Currency in List Land Activies --\\
                
                //-- Check Currency in List Coach --\\
                if(mCountCoach >= 0){
                    if(addCurrency[i].CurrencyIsoCode == addCoach[i].CurrencyIsoCode){
                        addCoach[i].Rate__c = addCurrency[i].Rate__c;
                    }
                }
                //-- Check Currency in List Coach --\\
                
                //-- Check Currency in List Option --\\
                if(mCountOption >= 0){
                    if(addCurrency[i].CurrencyIsoCode == addOption[i].CurrencyIsoCode){
                        addOption[i].Rate__c = addCurrency[i].Rate__c;
                    }
                }
                //-- Check Currency in List Option --\\
                
                //-- Check Currency in List Tour Leader --\\
                if(mCountTourLeader >= 0){
                    if(addCurrency[i].CurrencyIsoCode == addTourLeader[i].CurrencyIsoCode){
                        addTourLeader[i].Rate__c = addCurrency[i].Rate__c;
                    }
                }
                //-- Check Currency in List Tour Leader --\\
                
                //-- Check Currency in List Local Guide --\\
                if(mCountLocalGuide >= 0){
                    if(addCurrency[i].CurrencyIsoCode == addLocalGuide[i].CurrencyIsoCode){
                        addLocalGuide[i].Rate__c = addCurrency[i].Rate__c;
                    }
                }
                //-- Check Currency in List Local Guide --\\
                
                //-- Check Currency in List Other --\\
                if(mCountOther >= 0){
                    if(addCurrency[i].CurrencyIsoCode == addOther[i].CurrencyIsoCode){
                        addOther[i].Rate__c = addCurrency[i].Rate__c;
                    }
                }
                //-- Check Currency in List Other --\\
                
                //-- Check Currency in List Commission --\\
                if(mCountCommission >= 0){
                    if(addCurrency[i].CurrencyIsoCode == addCommission[i].CurrencyIsoCode){
                        addCommission[i].Rate__c = addCurrency[i].Rate__c;
                    }
                }
                //-- Check Currency in List Commission --\\
            }
        }
        onSave();
    }

//-- Save --\\
    public PageReference onSave(){
        system.debug('On Save');
        upsert(landHotel);
        upsert(lstLandHotel);
        upsert(landRestaurant);
        upsert(lstRestaurant);
        upsert(landAttraction);
        upsert(lstAttraction);
        upsert(landActivities);
        upsert(lstActivities);
        upsert(handlingFee);
        if(mCountCoach >= 0){
            insert addCoach;
        }
        if(mCountOption >= 0){
            insert addOption;
        }
        if(mCountTourLeader >= 0){
            insert addTourLeader;
        }
        if(mCountLocalGuide >= 0){
            insert addLocalGuide;
        }
        if(mCountOther >= 0){
            insert addOther;
        }
        if(mCountCommission >= 0){
            insert addCommission;
        }
        //return new PageReference('/' + ApexPages.currentPage().getParameters().get('CF00NO0000001EtuG_lkid'));
        String url = '/apex/Cost_Calculator_2?&CF00NO0000001EtuG_lkid='+theProduct.Id+'&CF00NO0000001EtuG='+theProduct.Name;
        system.debug('URL : ' + url);
        PageReference pref=new PageReference(url);
        return pref;
    }
    //-- Save --\\

thank you in advance
 
Hi all, Why <apex:commandButton> in visualforce page not calling method in controller.

This is code in visualforce page.
<apex:pageBlockTable value="{!addCoach}" var="addC" id="table" style="width:500px">
                <apex:column headerValue="Other Name">
                    <apex:inputField value="{!addC.ServiceName__c}" html-placeholder="Other Name"/>
                </apex:column>
                
                <apex:column headerValue="Currency" style="width:50px">
                        <apex:outputPanel layout="block" styleClass="requiredInput">
                            <apex:outputpanel layout="block" styleClass="requiredBlock"/> 
                            <apex:selectList value="{!addC.CurrencyIsoCode}" size="1" multiselect="false" required="true">
                                <apex:selectOption itemValue="" itemlabel="==Not Specify=="></apex:selectOption>
                                <apex:selectOptions value="{!MyCurrencyIso}"/>
                            </apex:selectList>
                        </apex:outputPanel>
                </apex:column>
                
                <apex:column headerValue="Total Cost">
                    <apex:inputText value="{!addC.Total_Cost__c}" html-placeholder="Total Coast"/>
                </apex:column>
                
                <apex:column >
                    <apex:commandButton value="Add Row" action="{!addRow}"/>
                </apex:column>

                
            </apex:pageBlockTable>

And this code in controller.
public with sharing class CostCalculationExtention{

public List<Product_Service__c> addCoach {get; set;}
//-- Constructor --\\
    public CostCalculationExtention(ApexPages.StandardController controller) {
        //-- Add Coach --\\
        addCoach = [select ServiceName__c, Total_Cost__c, CurrencyIsoCode from Product_Service__c where Id =: productId];
        addCoach.add(new Product_Service__c(Product__c = productId, Service__c = service.Id, ServiceName__c = '', CurrencyIsoCode = '',        
        Total_Cost__c = 0));
        //-- Add Coach --\\
    }
//-- Add Coach --\\
    public void addRow(){
        system.debug('Start Add Coach');
        addCoach.add(new Product_Service__c());
        system.debug('End Add Coach');
    }
//-- Add Coach --\\

}

Thank you in advance
Hi all,
I want to know how to fix this error  "Illegal assignment from LIST<AggregateResult> to SOBJECT:Product_Service__c"
thsi is a code 
interFlight = [select sum(Total_Cost__c) from Product_Service__c where Product_Service_Type__c = 'Air Ticket - International' and id =: productId];

Many thank in advance :)))
Hi all,
I'm new for salesforce. I want to save data into database.
How to add record, answer me please.
this is code one in visualforce page.
<apex:pageBlock title="Other">
            <apex:commandButton value="addRow" action="{!addRow}"/>
            <br/><br/>
            <table class="table table-bordered" cellspacing="0" cellpadding="0" style="width:300px;">
                <tr>
                    <td style="background-color: #87CEEB;" align="center"><b>Other Name</b></td>
                    <td style="background-color: #87CEEB;" align="center"><b>Other Number</b></td>
                </tr>
                <apex:repeat value="{!row}" var="item" >
                    <tr>
                        <td align="center"><apex:inputText value="{!otherName}" id="otherName" html-placeholder="Other Name"/></td>
                        <td align="center"><apex:inputText value="{!otherNum}" id="otherNumber" html-placeholder="Other Number"/></td>
                    </tr>
                </apex:repeat>
            </table>
        </apex:pageBlock>

This is code one in controller.
//-- Add Row --\\
    public void addRow(){
        integer num = 1;
        String s = '';
        if(row == null){
            row = new List<String>();
            for(integer i = 0 ; i < num ; i++){
                s += num+'';
                row.add(s);
            }
            num++;
        }else{
            for(integer i = 0 ; i < num ; i++){
                s += num+'';
                row.add(s);
            }
            num++;
        }
    }
    //-- Add Row --\\

This is code two in visualforce page.
<apex:pageBlock title="Other">
            <apex:commandButton value="addRow" action="{!addRow}"/>
            <br/><br/>
            <table class="table table-bordered" cellspacing="0" cellpadding="0" style="width:300px;">
                <tr>
                    <td style="background-color: #87CEEB;" align="center"><b>Other Name</b></td>
                    <td style="background-color: #87CEEB;" align="center"><b>Other Number</b></td>
                </tr>
                <apex:repeat value="{!addOtherProduct}" var="item" >
                    <tr>
                        <td align="center"><apex:inputText value="{!item.Other_Name__c}" id="otherName" html-placeholder="Other Name"/></td>
                        <td align="center"><apex:inputText value="{!item.Other_Number__c}" id="otherNumber" html-placeholder="Other Number"/></td>
                    </tr>
                </apex:repeat>
            </table>
        </apex:pageBlock>

//-- Add Row --\\
    public void addRow(){
        addOtherProduct.add(new Product_Service__c(Other_Name__c = otherName, Other_Number__c = otherNum));
    }
//-- Add Row --\\

how to insert to database answer for me please.
Hi all,
I'm new for salesforce, I want to know if sum multi field in database. What should I do?

answer to me please.
Hi all, I'm new for the salesforce.
I want to know when i click the button will add a row but when i click nothing happen, row didn't add .

This is a code in visualforce page.
<apex:page standardController="Product_Service__c"  extensions="CostCalculation2Extention">
<apex:sectionHeader Title="Cost Calculation" subtitle="{!theProduct.Name}"/>
<apex:form >
    
    <apex:pageBlock title="Cost Calculator">
        <table border="1" cellspacing="0" style="border-color: #eeeeee;">
            <tr>
                <td style="background-color: #e0e3e5;" align="center"><b>No. of Pax</b></td>
                <td style="background-color: #e0e3e5;" align="center"><b>Total</b></td>
                <td style="background-color: #e0e3e5;" align="center" colspan="2"><b>A</b></td>
                <td style="background-color: #e0e3e5;" align="center"><b>B</b></td>
                <td style="background-color: #e0e3e5;" align="center" colspan="4"><b>C1</b></td>
                <td style="background-color: #e0e3e5;" align="center" colspan="4"><b>C2</b></td>
                <td style="background-color: #e0e3e5;" align="center" colspan="4"><b>C3</b></td>
                <td style="background-color: #e0e3e5;" align="center" colspan="4"><b>C4</b></td>
                <td style="background-color: #e0e3e5;" align="center" colspan="4"><b>C5</b></td>
                <td style="background-color: #e0e3e5;" align="center" colspan="4"><b>C5</b></td>
                <td style="background-color: #e0e3e5;" align="center" colspan="2"><b>E</b></td>
                <td style="background-color: #e0e3e5;" align="center" colspan="3"><b>G</b></td>
            </tr>
            <tr>
                <td align="center"><apex:commandButton value="Add Row" action="{!addRowA}" /></td>
                <td align="center"></td>
                <td align="center">International Flight</td>
                <td align="center">Domestic Flight</td>
                <td align="center"></td>
                <td align="center">C1.1</td>
                <td align="center">C1.2</td>
                <td align="center">C1.3</td>
                <td align="center">C1.4</td>
                <td align="center">C2.1</td>
                <td align="center">C2.2</td>
                <td align="center">C2.3</td>
                <td align="center">C2.4</td>
                <td align="center">C3.1</td>
                <td align="center">C3.2</td>
                <td align="center">C3.3</td>
                <td align="center">C3.4</td>
                <td align="center">C4.1</td>
                <td align="center">C4.2</td>
                <td align="center">C4.3</td>
                <td align="center">C4.4</td>
                <td align="center">C5.1</td>
                <td align="center">C5.2</td>
                <td align="center">C5.3</td>
                <td align="center">C5.4</td>
                <td align="center">C6.1</td>
                <td align="center">C6.2</td>
                <td align="center">C6.3</td>
                <td align="center">C6.4</td>
                <td align="center">E1.1</td>
                <td align="center">E2.2</td>
                <td align="center">Sales</td>
                <td align="center">Operation</td>
                <td align="center">Others</td>
            </tr>
            <apex:repeat value="{!rowPageA}" var="item" id="rowPage">
                <tr>
                    <td align="center"><apex:inputText id="number" value="{!num}"/></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                </tr>
            </apex:repeat>
        </table>
        <br/>
       
    </apex:pageBlock>

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

This is a code in controller.
public with sharing class CostCalculation2Extention{

    //-- Open Page --\\
    public Product__c theProduct {get; set;}
    private String productId {get; set;}
    public Product_Service__c[] lstProductService {get; set;}
    public Product_Service__c[] lstAddRowA {get; set;}
    //-- Open Page --\\
    
    //-- Attirbute --\\
    public List<Integer> rowPageA {get; set;}
    public List<Integer> rowPageB {get; set;}
    public List<Integer> num {get; set;}
    //-- Attirbute --\\
    
    //-- Constructor --\\
    public CostCalculation2Extention(ApexPages.StandardController controller) {
        productId = apexpages.currentpage().getparameters().get('CF00NO0000001EtuG_lkid');
        //system.debug('ProductId : ' + productId);
        theProduct = [select id, name from Product__c where id =: productId];
        //system.debug('The Product : ' + theProduct);
        lstProductService = [select id, name, Service__r.Name, Service__r.Id, Client_Expense_Adult__c, Client_Expense_Child__c, Tour_Leader_Expense__c, Local_Guide_Expense__c, Coach__c from Product_Service__c where Product__r.id =: theProduct.Id];
        //system.debug('List Product_Service : ' + lstProductService);
    }
    //-- Constructor --\\    
    
    //-- Add Row A --\\
    public void addRowA(){
        Integer numRow = 1;
        system.debug('numRow : ' + numRow);
        if(numRow == 1){
            system.debug('numRow : ' + numRow);
            rowPageA = new List<Integer>();
            for(integer i = 0 ; i < numRow ; i++){
                rowPageA.add(numRow);
                system.debug('row : ' + rowPageA.size());
                break;
            }
            numRow++;
            system.debug('numRow : ' + numRow);            
        }else{
            system.debug('numRow : ' + numRow);
            for(integer i = numRow ; i < (numRow+1) ; i++){
                rowPageA.add(numRow);
                break;
            }
            numRow++;
            system.debug('numRow : ' + numRow);
        }
    }
    //-- Add Row A --\\
}

This picture before click.
User-added image

This picture one time click.
User-added image

This picture two time click.
User-added image
Hi all,
I want to set this is table in vf page by apex code. How to set ?? 

User-added image

this is vf page me.
<apex:page standardController="Product_Service__c" extensions="CostCalculation2Extention" >

<apex:sectionHeader Title="Cost Calculation" subtitle="{!theProduct.Name}"/>
<apex:form >
    
    <apex:pageBlock title="Cost Calculator">
        <table border="1">
            <tr>
                <th>No. of Pax</th>
                <th colspan="2" align="center">A</th>
                <th>B</th>
                <th colspan="4" align="center">C1</th>
                <th colspan="4" align="center">C2</th>
                <th colspan="4" align="center">C3</th>
                <th colspan="4" align="center">C4</th>
                <th colspan="4" align="center">C5</th>
                <th colspan="4" align="center">C5</th>
                <th colspan="2" align="center">E</th>
                <th colspan="3" align="center">G</th>
            </tr>
            <tr>
                <td><apex:commandButton value="Add Row"/></td>
                <td>International Flight</td>
                <td>Domestic Flight</td>
                <td></td>
                <td>C1.1</td>
                <td>C1.2</td>
                <td>C1.3</td>
                <td>C1.4</td>
                <td>C2.1</td>
                <td>C2.2</td>
                <td>C2.3</td>
                <td>C2.4</td>
                <td>C3.1</td>
                <td>C3.2</td>
                <td>C3.3</td>
                <td>C3.4</td>
                <td>C4.1</td>
                <td>C4.2</td>
                <td>C4.3</td>
                <td>C4.4</td>
                <td>C5.1</td>
                <td>C5.2</td>
                <td>C5.3</td>
                <td>C5.4</td>
                <td>C6.1</td>
                <td>C6.2</td>
                <td>C6.3</td>
                <td>C6.4</td>
                <td>E1.1</td>
                <td>E2.2</td>
                <td>Sales</td>
                <td>Operation</td>
                <td>Others</td>
            </tr>
        </table>
    
    </apex:pageBlock>

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

Thank you.
This is error
Formula Expression is required on the action attributes.
Hi all,
I'm new for salesforce help me please. Why I can't open visualforce page by button.
This is my code

public PageReference onSave(){
        upsert(lstProductService);
        String url = 'Cost_Calculator_2?&CF00NO0000001EtuG_lkid='+theProduct.Id+'&CF00NO0000001EtuG='+theProduct.Name;
        PageReference pref=new PageReference('/'+url);
        return pref;
    }

This is my page.
User-added image

This code in visualforce page.
             <center><apex:commandButton value="Save" action="{!onSave}"/></center>

I want open the another page by visualforce page.
Thank you for ans.
Hi all,
I am new to visualforce. After query of records, I would like to update the same records with to the database but i am unable to save becuse there is no attribute receive data from the visualforce page.
This code vf page

<apex:page standardController="Product_Service__c" extensions="CostCalculationExtention">

    <script language="javascript">  
        function IsNumeric(sText,obj){  
            var ValidChars = "0123456789.";  
            var IsNumber=true;  
            var Char;  
            for (i = 0; i < sText.length && IsNumber == true; i++){   
                Char = sText.charAt(i);   
                if (ValidChars.indexOf(Char) == -1){  
                    IsNumber = false;
                }
            }
            if(IsNumber==false){  
                alert("Input number only!!");  
                obj.value=sText.substr(0,sText.length-1);  
            }  
       }  
    </script>
    
<apex:sectionHeader Title="Cost Calculation" subtitle="{!theProduct.Name}"/>
<apex:form >
    <apex:pageBlock title="Cost Calculation">
        <apex:pageblockTable value="{!lstProductService}" var="lstPS">
            
            <apex:column headerValue="Service">
                <apex:outputField value="{!lstPS.Service__r.Name}"/>
            </apex:column>
            
            <apex:column headerValue="Client Exp - Adult">
                 <apex:inputField id="clientAdult" value="{!lstPS.Client_Expense_Adult__c}" onkeypress="IsNumeric(this.value,this)"/>
            </apex:column>
            
            <apex:column headerValue="Client Exp - Child">
                <apex:inputField id="clientChild" value="{!lstPS.Client_Expense_Child__c}" onkeypress="IsNumeric(this.value,this)"/>
            </apex:column>
            
            <apex:column headerValue="T/L Exp">
                <apex:inputField id="tlExp" value="{!lstPS.Tour_Leader_Expense__c}" onkeypress="IsNumeric(this.value,this)"/>
            </apex:column>
            
            <apex:column headerValue="L/G Exp">
                <apex:inputField id="lgExp" value="{!lstPS.Local_Guide_Expense__c}" onkeypress="IsNumeric(this.value,this)"/>
            </apex:column>
            
            <apex:column headerValue="Coach">
                <apex:inputField id="coach" value="{!lstPS.Coach__c}" onkeypress="IsNumeric(this.value,this)"/>
            </apex:column>
        
        </apex:pageblockTable>
        <br/>
        <center><apex:commandButton value="Save"/></center>
    </apex:pageBlock>
    
</apex:form>
</apex:page>

This picture result code.
User-added image

This code controller.
public with sharing class CostCalculationExtention{
    
    //-- Open Page --\\
    public Product__c theProduct {get; set;}
    private String productId {get; set;}
    public Product_Service__c[] lstProductService {get; set;}
    //-- Open Page --\\
    
    //-- Constructor --\\
    public CostCalculationExtention(ApexPages.StandardController controller) {
        
        productId = apexpages.currentpage().getparameters().get('CF00NO0000001EtuG_lkid');
        //system.debug('ProductId : ' + productId);
        theProduct = [select id, name from Product__c where id =: productId];
        //system.debug('The Product : ' + theProduct);
        lstProductService = [select id, name, Service__r.Name, Client_Expense_Adult__c, Client_Expense_Child__c, Tour_Leader_Expense__c, Local_Guide_Expense__c, Coach__c from Product_Service__c where Product__r.id =: theProduct.Id];
        //system.debug('List Product_Service : ' + lstProductService);
        
    }
    //-- Constructor --\\
    
    //-- Save --\\
    public PageReference onSave(){
        
        return new PageReference('/' + ApexPages.currentPage().getParameters().get('CF00NO0000001EtuG_lkid'));
    }
    //-- Save --\\
}


I want to know what they should do next .

Thank you!!.

Hi everyone ,

I am new to salesforce. I have got the requirement from customer saying that salesforce need to call outside system through REST API.
I need to send data from salesforce to outside system. I don't have any idea regarding this. Would you please guide and suggest me on how to do this. 

Outside system is using Azure Microsoft.

I will be much appriciated.

Thank you.

Hi everyone ,

I would like to know that can I perform any other encrypting method other than existing one in salesforce as

I have to encrypt and use with other system. The other system is using another method of decypting so I have to make

change accordingly. Can I do that in component meaning I need to perform encrypting before sending email .

I have not use visual force page because I have to use component that attached to email template. 

I cannot find any other way and full blank.

 

Do you have any suggestion regarding this ?

 

Thank you so much ..

Hi all, I'm new to salesforce

I have question regarding visualforce page. When I try to add a new row in visualforce page , I want to copy the data form previous row to new row as well how would I do that ? Any suggustion, I would really appreciate.

Thank you

 User-added image

My page did not redirect url.

and i use this code in vf page.
<apex:commandButton value="Next" action="{!checkCurrencyAllProductService}"/>

and this in controller.

public void checkCurrencyAllProductService(){
        if(mCountCurrency!=0){
            for(integer i = 0 ; i < addCurrency.size() ; i++){
                //-- Check Currency in Land Hotel --\\
                if(addCurrency[i].CurrencyIsoCode == landHotel.CurrencyIsoCode){
                    landHotel.Rate__c = addCurrency[i].Rate__c;
                }
                //-- Check Currency in Land Hotel --\\
                
                //-- Check Currency in List Land Hotel --\\
                if(addCurrency[i].CurrencyIsoCode == lstLandHotel[i].CurrencyIsoCode){
                    lstLandHotel[i].Rate__c = addCurrency[i].Rate__c;
                }
                //-- Check Currency in List Hotel --\\
                
                //-- Check Currency in Land Restaurant --\\
                if(addCurrency[i].CurrencyIsoCode == landRestaurant.CurrencyIsoCode){
                    landRestaurant.Rate__c = addCurrency[i].Rate__c;
                }
                //-- Check Currency in Land Restaurant --\\
                
                //-- Check Currency in List Land Restaurant --\\
                if(addCurrency[i].CurrencyIsoCode == lstRestaurant[i].CurrencyIsoCode){
                    lstRestaurant[i].Rate__c = addCurrency[i].Rate__c;
                }
                //-- Check Currency in List Restaurant --\\
                
                //-- Check Currency in Land Attraction --\\
                if(addCurrency[i].CurrencyIsoCode == landAttraction.CurrencyIsoCode){
                    landAttraction.Rate__c = addCurrency[i].Rate__c;
                }
                //-- Check Currency in Land Attraction --\\
                
                //-- Check Currency in List Land Attraction --\\
                if(addCurrency[i].CurrencyIsoCode == lstAttraction[i].CurrencyIsoCode){
                    lstAttraction[i].Rate__c = addCurrency[i].Rate__c;
                }
                //-- Check Currency in List Attraction --\\
                
                //-- Check Currency in Land Activities --\\
                if(addCurrency[i].CurrencyIsoCode == landActivities.CurrencyIsoCode){
                    landActivities.Rate__c = addCurrency[i].Rate__c;
                }
                //-- Check Currency in Land Activities --\\
                
                //-- Check Currency in List Land Activies --\\
                if(addCurrency[i].CurrencyIsoCode == lstAttraction[i].CurrencyIsoCode){
                    lstAttraction[i].Rate__c = addCurrency[i].Rate__c;
                }
                //-- Check Currency in List Land Activies --\\
                
                //-- Check Currency in List Coach --\\
                if(mCountCoach >= 0){
                    if(addCurrency[i].CurrencyIsoCode == addCoach[i].CurrencyIsoCode){
                        addCoach[i].Rate__c = addCurrency[i].Rate__c;
                    }
                }
                //-- Check Currency in List Coach --\\
                
                //-- Check Currency in List Option --\\
                if(mCountOption >= 0){
                    if(addCurrency[i].CurrencyIsoCode == addOption[i].CurrencyIsoCode){
                        addOption[i].Rate__c = addCurrency[i].Rate__c;
                    }
                }
                //-- Check Currency in List Option --\\
                
                //-- Check Currency in List Tour Leader --\\
                if(mCountTourLeader >= 0){
                    if(addCurrency[i].CurrencyIsoCode == addTourLeader[i].CurrencyIsoCode){
                        addTourLeader[i].Rate__c = addCurrency[i].Rate__c;
                    }
                }
                //-- Check Currency in List Tour Leader --\\
                
                //-- Check Currency in List Local Guide --\\
                if(mCountLocalGuide >= 0){
                    if(addCurrency[i].CurrencyIsoCode == addLocalGuide[i].CurrencyIsoCode){
                        addLocalGuide[i].Rate__c = addCurrency[i].Rate__c;
                    }
                }
                //-- Check Currency in List Local Guide --\\
                
                //-- Check Currency in List Other --\\
                if(mCountOther >= 0){
                    if(addCurrency[i].CurrencyIsoCode == addOther[i].CurrencyIsoCode){
                        addOther[i].Rate__c = addCurrency[i].Rate__c;
                    }
                }
                //-- Check Currency in List Other --\\
                
                //-- Check Currency in List Commission --\\
                if(mCountCommission >= 0){
                    if(addCurrency[i].CurrencyIsoCode == addCommission[i].CurrencyIsoCode){
                        addCommission[i].Rate__c = addCurrency[i].Rate__c;
                    }
                }
                //-- Check Currency in List Commission --\\
            }
        }
        onSave();
    }

//-- Save --\\
    public PageReference onSave(){
        system.debug('On Save');
        upsert(landHotel);
        upsert(lstLandHotel);
        upsert(landRestaurant);
        upsert(lstRestaurant);
        upsert(landAttraction);
        upsert(lstAttraction);
        upsert(landActivities);
        upsert(lstActivities);
        upsert(handlingFee);
        if(mCountCoach >= 0){
            insert addCoach;
        }
        if(mCountOption >= 0){
            insert addOption;
        }
        if(mCountTourLeader >= 0){
            insert addTourLeader;
        }
        if(mCountLocalGuide >= 0){
            insert addLocalGuide;
        }
        if(mCountOther >= 0){
            insert addOther;
        }
        if(mCountCommission >= 0){
            insert addCommission;
        }
        //return new PageReference('/' + ApexPages.currentPage().getParameters().get('CF00NO0000001EtuG_lkid'));
        String url = '/apex/Cost_Calculator_2?&CF00NO0000001EtuG_lkid='+theProduct.Id+'&CF00NO0000001EtuG='+theProduct.Name;
        system.debug('URL : ' + url);
        PageReference pref=new PageReference(url);
        return pref;
    }
    //-- Save --\\

thank you in advance
 
Hi all, Why <apex:commandButton> in visualforce page not calling method in controller.

This is code in visualforce page.
<apex:pageBlockTable value="{!addCoach}" var="addC" id="table" style="width:500px">
                <apex:column headerValue="Other Name">
                    <apex:inputField value="{!addC.ServiceName__c}" html-placeholder="Other Name"/>
                </apex:column>
                
                <apex:column headerValue="Currency" style="width:50px">
                        <apex:outputPanel layout="block" styleClass="requiredInput">
                            <apex:outputpanel layout="block" styleClass="requiredBlock"/> 
                            <apex:selectList value="{!addC.CurrencyIsoCode}" size="1" multiselect="false" required="true">
                                <apex:selectOption itemValue="" itemlabel="==Not Specify=="></apex:selectOption>
                                <apex:selectOptions value="{!MyCurrencyIso}"/>
                            </apex:selectList>
                        </apex:outputPanel>
                </apex:column>
                
                <apex:column headerValue="Total Cost">
                    <apex:inputText value="{!addC.Total_Cost__c}" html-placeholder="Total Coast"/>
                </apex:column>
                
                <apex:column >
                    <apex:commandButton value="Add Row" action="{!addRow}"/>
                </apex:column>

                
            </apex:pageBlockTable>

And this code in controller.
public with sharing class CostCalculationExtention{

public List<Product_Service__c> addCoach {get; set;}
//-- Constructor --\\
    public CostCalculationExtention(ApexPages.StandardController controller) {
        //-- Add Coach --\\
        addCoach = [select ServiceName__c, Total_Cost__c, CurrencyIsoCode from Product_Service__c where Id =: productId];
        addCoach.add(new Product_Service__c(Product__c = productId, Service__c = service.Id, ServiceName__c = '', CurrencyIsoCode = '',        
        Total_Cost__c = 0));
        //-- Add Coach --\\
    }
//-- Add Coach --\\
    public void addRow(){
        system.debug('Start Add Coach');
        addCoach.add(new Product_Service__c());
        system.debug('End Add Coach');
    }
//-- Add Coach --\\

}

Thank you in advance
Hi all, I'm new for the salesforce.
I want to know when i click the button will add a row but when i click nothing happen, row didn't add .

This is a code in visualforce page.
<apex:page standardController="Product_Service__c"  extensions="CostCalculation2Extention">
<apex:sectionHeader Title="Cost Calculation" subtitle="{!theProduct.Name}"/>
<apex:form >
    
    <apex:pageBlock title="Cost Calculator">
        <table border="1" cellspacing="0" style="border-color: #eeeeee;">
            <tr>
                <td style="background-color: #e0e3e5;" align="center"><b>No. of Pax</b></td>
                <td style="background-color: #e0e3e5;" align="center"><b>Total</b></td>
                <td style="background-color: #e0e3e5;" align="center" colspan="2"><b>A</b></td>
                <td style="background-color: #e0e3e5;" align="center"><b>B</b></td>
                <td style="background-color: #e0e3e5;" align="center" colspan="4"><b>C1</b></td>
                <td style="background-color: #e0e3e5;" align="center" colspan="4"><b>C2</b></td>
                <td style="background-color: #e0e3e5;" align="center" colspan="4"><b>C3</b></td>
                <td style="background-color: #e0e3e5;" align="center" colspan="4"><b>C4</b></td>
                <td style="background-color: #e0e3e5;" align="center" colspan="4"><b>C5</b></td>
                <td style="background-color: #e0e3e5;" align="center" colspan="4"><b>C5</b></td>
                <td style="background-color: #e0e3e5;" align="center" colspan="2"><b>E</b></td>
                <td style="background-color: #e0e3e5;" align="center" colspan="3"><b>G</b></td>
            </tr>
            <tr>
                <td align="center"><apex:commandButton value="Add Row" action="{!addRowA}" /></td>
                <td align="center"></td>
                <td align="center">International Flight</td>
                <td align="center">Domestic Flight</td>
                <td align="center"></td>
                <td align="center">C1.1</td>
                <td align="center">C1.2</td>
                <td align="center">C1.3</td>
                <td align="center">C1.4</td>
                <td align="center">C2.1</td>
                <td align="center">C2.2</td>
                <td align="center">C2.3</td>
                <td align="center">C2.4</td>
                <td align="center">C3.1</td>
                <td align="center">C3.2</td>
                <td align="center">C3.3</td>
                <td align="center">C3.4</td>
                <td align="center">C4.1</td>
                <td align="center">C4.2</td>
                <td align="center">C4.3</td>
                <td align="center">C4.4</td>
                <td align="center">C5.1</td>
                <td align="center">C5.2</td>
                <td align="center">C5.3</td>
                <td align="center">C5.4</td>
                <td align="center">C6.1</td>
                <td align="center">C6.2</td>
                <td align="center">C6.3</td>
                <td align="center">C6.4</td>
                <td align="center">E1.1</td>
                <td align="center">E2.2</td>
                <td align="center">Sales</td>
                <td align="center">Operation</td>
                <td align="center">Others</td>
            </tr>
            <apex:repeat value="{!rowPageA}" var="item" id="rowPage">
                <tr>
                    <td align="center"><apex:inputText id="number" value="{!num}"/></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                    <td align="center"></td>
                </tr>
            </apex:repeat>
        </table>
        <br/>
       
    </apex:pageBlock>

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

This is a code in controller.
public with sharing class CostCalculation2Extention{

    //-- Open Page --\\
    public Product__c theProduct {get; set;}
    private String productId {get; set;}
    public Product_Service__c[] lstProductService {get; set;}
    public Product_Service__c[] lstAddRowA {get; set;}
    //-- Open Page --\\
    
    //-- Attirbute --\\
    public List<Integer> rowPageA {get; set;}
    public List<Integer> rowPageB {get; set;}
    public List<Integer> num {get; set;}
    //-- Attirbute --\\
    
    //-- Constructor --\\
    public CostCalculation2Extention(ApexPages.StandardController controller) {
        productId = apexpages.currentpage().getparameters().get('CF00NO0000001EtuG_lkid');
        //system.debug('ProductId : ' + productId);
        theProduct = [select id, name from Product__c where id =: productId];
        //system.debug('The Product : ' + theProduct);
        lstProductService = [select id, name, Service__r.Name, Service__r.Id, Client_Expense_Adult__c, Client_Expense_Child__c, Tour_Leader_Expense__c, Local_Guide_Expense__c, Coach__c from Product_Service__c where Product__r.id =: theProduct.Id];
        //system.debug('List Product_Service : ' + lstProductService);
    }
    //-- Constructor --\\    
    
    //-- Add Row A --\\
    public void addRowA(){
        Integer numRow = 1;
        system.debug('numRow : ' + numRow);
        if(numRow == 1){
            system.debug('numRow : ' + numRow);
            rowPageA = new List<Integer>();
            for(integer i = 0 ; i < numRow ; i++){
                rowPageA.add(numRow);
                system.debug('row : ' + rowPageA.size());
                break;
            }
            numRow++;
            system.debug('numRow : ' + numRow);            
        }else{
            system.debug('numRow : ' + numRow);
            for(integer i = numRow ; i < (numRow+1) ; i++){
                rowPageA.add(numRow);
                break;
            }
            numRow++;
            system.debug('numRow : ' + numRow);
        }
    }
    //-- Add Row A --\\
}

This picture before click.
User-added image

This picture one time click.
User-added image

This picture two time click.
User-added image
Hi all,
I want to set this is table in vf page by apex code. How to set ?? 

User-added image

this is vf page me.
<apex:page standardController="Product_Service__c" extensions="CostCalculation2Extention" >

<apex:sectionHeader Title="Cost Calculation" subtitle="{!theProduct.Name}"/>
<apex:form >
    
    <apex:pageBlock title="Cost Calculator">
        <table border="1">
            <tr>
                <th>No. of Pax</th>
                <th colspan="2" align="center">A</th>
                <th>B</th>
                <th colspan="4" align="center">C1</th>
                <th colspan="4" align="center">C2</th>
                <th colspan="4" align="center">C3</th>
                <th colspan="4" align="center">C4</th>
                <th colspan="4" align="center">C5</th>
                <th colspan="4" align="center">C5</th>
                <th colspan="2" align="center">E</th>
                <th colspan="3" align="center">G</th>
            </tr>
            <tr>
                <td><apex:commandButton value="Add Row"/></td>
                <td>International Flight</td>
                <td>Domestic Flight</td>
                <td></td>
                <td>C1.1</td>
                <td>C1.2</td>
                <td>C1.3</td>
                <td>C1.4</td>
                <td>C2.1</td>
                <td>C2.2</td>
                <td>C2.3</td>
                <td>C2.4</td>
                <td>C3.1</td>
                <td>C3.2</td>
                <td>C3.3</td>
                <td>C3.4</td>
                <td>C4.1</td>
                <td>C4.2</td>
                <td>C4.3</td>
                <td>C4.4</td>
                <td>C5.1</td>
                <td>C5.2</td>
                <td>C5.3</td>
                <td>C5.4</td>
                <td>C6.1</td>
                <td>C6.2</td>
                <td>C6.3</td>
                <td>C6.4</td>
                <td>E1.1</td>
                <td>E2.2</td>
                <td>Sales</td>
                <td>Operation</td>
                <td>Others</td>
            </tr>
        </table>
    
    </apex:pageBlock>

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

Thank you.
This is error
Formula Expression is required on the action attributes.
Hi all,
I am new to visualforce. After query of records, I would like to update the same records with to the database but i am unable to save becuse there is no attribute receive data from the visualforce page.
This code vf page

<apex:page standardController="Product_Service__c" extensions="CostCalculationExtention">

    <script language="javascript">  
        function IsNumeric(sText,obj){  
            var ValidChars = "0123456789.";  
            var IsNumber=true;  
            var Char;  
            for (i = 0; i < sText.length && IsNumber == true; i++){   
                Char = sText.charAt(i);   
                if (ValidChars.indexOf(Char) == -1){  
                    IsNumber = false;
                }
            }
            if(IsNumber==false){  
                alert("Input number only!!");  
                obj.value=sText.substr(0,sText.length-1);  
            }  
       }  
    </script>
    
<apex:sectionHeader Title="Cost Calculation" subtitle="{!theProduct.Name}"/>
<apex:form >
    <apex:pageBlock title="Cost Calculation">
        <apex:pageblockTable value="{!lstProductService}" var="lstPS">
            
            <apex:column headerValue="Service">
                <apex:outputField value="{!lstPS.Service__r.Name}"/>
            </apex:column>
            
            <apex:column headerValue="Client Exp - Adult">
                 <apex:inputField id="clientAdult" value="{!lstPS.Client_Expense_Adult__c}" onkeypress="IsNumeric(this.value,this)"/>
            </apex:column>
            
            <apex:column headerValue="Client Exp - Child">
                <apex:inputField id="clientChild" value="{!lstPS.Client_Expense_Child__c}" onkeypress="IsNumeric(this.value,this)"/>
            </apex:column>
            
            <apex:column headerValue="T/L Exp">
                <apex:inputField id="tlExp" value="{!lstPS.Tour_Leader_Expense__c}" onkeypress="IsNumeric(this.value,this)"/>
            </apex:column>
            
            <apex:column headerValue="L/G Exp">
                <apex:inputField id="lgExp" value="{!lstPS.Local_Guide_Expense__c}" onkeypress="IsNumeric(this.value,this)"/>
            </apex:column>
            
            <apex:column headerValue="Coach">
                <apex:inputField id="coach" value="{!lstPS.Coach__c}" onkeypress="IsNumeric(this.value,this)"/>
            </apex:column>
        
        </apex:pageblockTable>
        <br/>
        <center><apex:commandButton value="Save"/></center>
    </apex:pageBlock>
    
</apex:form>
</apex:page>

This picture result code.
User-added image

This code controller.
public with sharing class CostCalculationExtention{
    
    //-- Open Page --\\
    public Product__c theProduct {get; set;}
    private String productId {get; set;}
    public Product_Service__c[] lstProductService {get; set;}
    //-- Open Page --\\
    
    //-- Constructor --\\
    public CostCalculationExtention(ApexPages.StandardController controller) {
        
        productId = apexpages.currentpage().getparameters().get('CF00NO0000001EtuG_lkid');
        //system.debug('ProductId : ' + productId);
        theProduct = [select id, name from Product__c where id =: productId];
        //system.debug('The Product : ' + theProduct);
        lstProductService = [select id, name, Service__r.Name, Client_Expense_Adult__c, Client_Expense_Child__c, Tour_Leader_Expense__c, Local_Guide_Expense__c, Coach__c from Product_Service__c where Product__r.id =: theProduct.Id];
        //system.debug('List Product_Service : ' + lstProductService);
        
    }
    //-- Constructor --\\
    
    //-- Save --\\
    public PageReference onSave(){
        
        return new PageReference('/' + ApexPages.currentPage().getParameters().get('CF00NO0000001EtuG_lkid'));
    }
    //-- Save --\\
}


I want to know what they should do next .

Thank you!!.

Hi,

 

Could anyone tell me how can i get multi select pick list on visual force page with custom controller. I was trying the same with newly custom object and then using that as custom controller and things were fine but now i want to have a) visual force page b) custom controller and c) data (picklist data) pulled from custom object.

 

 

Thanks,

Dilip

  • October 09, 2012
  • Like
  • 1