• anup ram
  • NEWBIE
  • 30 Points
  • Member since 2013

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 9
    Replies
We need to upload large files to Amazon from salesforce sites. We installed the amazon sfdc toolkit but it works with 100KB data, which is not good for our requirement.
Can anyone suggest a possible way?

SOAP and Rest calls fro SFDC will not handle large attachments. What are all the other possible ways? Please share the code also.

This is on priority. Please help. 

Are there any free appexchange apps?
I have a simple logic on flex to login to salesforce and create a record. The flex swf when embedded on VF page works fine internal to salesforce. But my requirement is to display the flex on site page to create record. The login fails on the same page when accessed through public sites. Any help is very appreciated.

Error is security error accessing url and also destination: default http

I am not sure how to use flex on salesforce sites to create record in salesforce.

<mx:Script>
<![CDATA[
    import com.salesforce.*;
    import com.salesforce.objects.*;
    import com.salesforce.results.*;
    import mx.controls.Alert;
        import com.salesforce.AsyncResponder;
        import com.salesforce.events.ApexFaultEvent;
        import com.salesforce.objects.LoginRequest;
        import com.salesforce.objects.SObject;
        import com.salesforce.results.Fault;
        import com.salesforce.results.LoginResult;
        import com.salesforce.results.QueryResult;
        import com.salesforce.results.UpsertResult;

    [Bindable] public var sfdc:Connection = new Connection();

    private function login():void {
        Security.loadPolicyFile("https://salesforce.com/services/Soap/u/crossdomain.xml");

        var lr:LoginRequest = new LoginRequest();
        sfdc.protocol = "https";
        sfdc.serverUrl = "https://login.salesforce.com/services/Soap/u/14.0";
    lr.username = "uname.com";
                           lr.password = "pwdsectoken";


        lr.callback = new AsyncResponder(loginSuccess, loginFault);


        sfdc.login(lr);

    }

    private function submitForm():void {

        var aSo:Array = new Array();
        var so:SObject = new SObject("Contact");
        so.FirstName = firstName.text;
        so.LastName = lastName.text;
        so.Email = email.text;

        aSo.push(so);

        sfdc.create(aSo,
            new AsyncResponder(
                function (obj:Object):void {
                    if (obj[0].success == true) {
                        Alert.show("Created record: "+obj[0].id);
                    } else {
                        Alert.show(obj[0].errors[0].message)
                    }
                }, sfdcFailure
            )
        );

    }

    private function loginSuccess(result:Object):void {
         Alert.show("Done");
        contactForm.enabled = true;
    }

    private function sfdcFailure(fault:Object):void {
        Alert.show(fault.faultstring);
    }

    private function loginFault(fault:Object):void
    {
        Alert.show("Could not log into SFDC: "+fault.fault.faultString,"Login Error");
        Alert.show("error " + fault.fault.faultDetail);
    }

]]>
</mx:Script>
<mx:Text text="To create a new Contact, Last Name is required by Salesforce.com while Email is required via a custom validation rule. &#xd;&#xd;Submit the form with different combinations to view the resulting messages returned from Salesforce.com.&#xd;" width="449"/>
<mx:Form id="contactForm" width="100%" height="100%" enabled="false">
    <mx:FormItem label="First Name">
        <mx:TextInput id="firstName"/>
    </mx:FormItem>
    <mx:FormItem label="Last Name">
        <mx:TextInput id="lastName"/>
    </mx:FormItem>
    <mx:FormItem label="Email">
        <mx:TextInput id="email"/>
    </mx:FormItem>
    <mx:FormItem>
        <mx:Button label="Submit" click="submitForm()"/>
    </mx:FormItem>
</mx:Form> 



HI all, I have a requirement to create records in salesforce from flex. But how do I connect to salesforce from flex?  flex is embedded on site page. How to do a post request in salesforce . I was planning to insert record into salesforce from Rest call

Hi,

I have a requirement to generate a pdf and send a email with thsi pdf attachments.

The pdf is generated and attached and email is sent.

 

when i login as system admin : pdf generated opens in adobe / nitro pdf

 

for other profiles > email is sent with attachments but pdf attachment doesnt open in pdf , it says invalid pdf file...

 

whats the problem...

The profile has access to the page which is rendered as pdf.

 

  PageReference pdf = Page.PdfGenerator;
                pdf.getParameters().put('id',objectId);
                pdf.setRedirect(true);
            // The contents of the attachment from the pdf stored as a Blob
                Blob body;       
                try
                {
                // Get contents of the attachment from the pdf
                    body = pdf.getContent();      
                }
                catch (VisualforceException e)
                {
                    body = Blob.valueOf('Encountered VF exception');
                }
               
system.debug(' body of pdf content ' + body);               
            //Generating a Email PDF attachment
                Messaging.EmailFileAttachment PDFAttachFile = new Messaging.EmailFileAttachment();
                PDFAttachFile.setContentType('application/pdf');
                PDFAttachFile.setFileName('test.pdf');
                PDFAttachFile.setInline(false);
                PDFAttachFile.Body = body;
            // Construct the email envelope
                OrgWideEmailAddress[] orgemail = [select Id,Address from OrgWideEmailAddress where Address = 'some email' limit 1];
                Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                mail.setUseSignature(false);
                if ( orgemail.size() > 0 )
               {
                    mail.setOrgWideEmailAddressId(some id);
                }
                mail.setToAddresses(new String[]{toEmailAddr });
                mail.setSubject('hi 123' );
                mail.setHtmlBody('Hi ');
                mail.setFileAttachments(new Messaging.EmailFileAttachment[] { PDFAttachFile });
            // Send the mail with Attachment
                Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail});

 

 

why oher profiles other than system admin cant generate a proper pdf?

plz urgent requirement...........................

Hi

 

I have a pageblocktable with some fields like price , user editable Price field, and total amount field ( quantity * price)

 

i have to calculate the grandtotal i.e total of totalamount field in every row .

 

This grandtotal has to be displayed on the page and also should be available for subsequent operations.

 

How to do this.

 

Please share a sample code .

Hi All,

 I am facing a problem in assigning the total to wrapperclass property.

 

I have a pageblocktable with displays a pist of product with price. The quantity is entered. The total amount is calculated by calling a method in controller. But I am not bale to assign the total to that perticular row so that I am not able to display proper total on the pageblocktable.

 

please tell how to associate the total to wrapper class ..

 

Apex:

 

public class pricefromproduct

{

// where name like '%searchkey%'    select Id from product2 where name like '%searchkey%'

public pricefromproduct()

{

 

}

public integer total{get;set;}

public string searchkey {get;set;}

public list<pricewrapper> prwrp {get;set;} {prwrp = new list<pricewrapper>();}

// public list<productlist> prod{get;set;} {prod = new list<productlist>();}

public pagereference priceproduct()

{

 list<product2> prod = [select id from product2 where name like :'%'+searchkey+'%'];

 system.debug('prod size' + prod.size());

// prolist = [select id,name from product__c where name like : '%'+searchkey+'%'];

 

list<pricebookentry> pricebk = [Select Id, Name, ProductCode, Pricebook2Id, UnitPrice From PricebookEntry where Product2Id in :prod and usestandardprice = false and isactive = true];

  /*  best way to remove duplicates from list

  list<string> pr = new list<string>{'james','smith','james'};

  set<string> myset = new Set<string>();

List<string> result = new List<string>();

myset.addAll(pr);

result.addAll(myset);

system.debug(' pr size before filter ' + pr.size() + '   after ' + result.size());

*/

system.debug('pricebook size' + pricebk.size());

for (pricebookentry pb : pricebk)

{

pricewrapper p = new pricewrapper();

p.prc = pb;

p.prodprice = integer.valueof(pb.unitprice);

p.prodname = pb.name;

 

prwrp.add(p);

}

return null;

}

 

public integer f{get;set;}

public integer q{get;set;}

public pagereference totalcount()

{

f = integer.valueof(Apexpages.currentPage().getParameters().get('f'));

q = integer.valueof(Apexpages.currentPage().getParameters().get('q'));

total = f * q;

system.debug(' total ' + total);

 

 

return null;

}

 

 

 

public class pricewrapper

{

public pricebookentry prc{get;set;}

public integer prodprice{get;set;}

public string prodname{get;set;}

public boolean issel {get;set;}

public integer quantity{get;set;}

public integer totalamount{get;}

     

  public pricewrapper()

{

 

}

}

 

}

 

 

 

 

 

 

Hi All,

 

I have a small problem in my page. I am not finding the method to figure it out.

 

Problem:

 

I have a search field to display the products with its price

2. i can select the product using checkbox and give the number of quantity . the javascript will calculate the totalamount. (working)

3.  I have a button to add product to cart

4. in the cart i can see product name, quantity, unitprice but not totalprice.

 

If i change the outputtext to inputtext for totalprice then it is getting displayed in cart items but if i give as inputtext for totalcount then automatically the quantity * unitprice value is not updated.

 

I found it a bit wierd kind of situation.

 

My code:

 

Controller:

 

public class productassign

{

 

public productassign(apexpages.standardcontroller controller)

{

 

}

//used to get a hold of the account record selected for deletion

public string SelectedAccountId { get; set; }

 

 

public string searchkey{get;set;}

public list<product__c> prolist;

 

public list<productlist> prod{get;set;} {prod = new list<productlist>();}

public integer rownum;

public void delRow()

{

rowNum = Integer.valueOf(apexpages.currentpage().getparameters().get('index'));

cartlist.remove(rowNum);

 

}

 

 

public pageReference searchprod()

{

prolist = [select id,name,price__c from product__c where name like : '%'+searchkey+'%'];

prolist.sort();

for (product__c pr : prolist)

{

productlist p = new productlist();

 

p.prot = pr;

p.proname = pr.name;

p.proid = pr.id;

p.proprice = integer.valueof(pr.price__c);

prod.add(p);

}

return null;

}

  public boolean displayPopup {get; set;}    

   

    public pagereference closePopup() {       

        displayPopup = false;  

        return null;

    }    

    public pagereference showPopup() {   

       

        displayPopup = true; 

        system.debug('show ppup  ' + displayPopup );

        return null; 

    }

   

  

 

 

   

public class productlist

{

 

public product__c prot{get;set;}

public string proname;

public id proid;

public integer proprice;

public integer quantity{get;set;}

public boolean isselect {get;set;}

public integer total{get;set;}

 

}

public integer maxnum;

public pagereference addtocart()

{

list<aggregateResult> res = [select max(orderid__c) from cart__c];

 

for (aggregateresult r : res)

{

maxnum = integer.valueof(r.get('expr0'));

maxnum = maxnum + 1;

 

}

 

for (productlist crt : prod)

{

 

if (crt.isselect)

{

cart__c c = new cart__c();

c.name = crt.proname;

 

c.orderid__c = maxnum;

c.product__c = crt.proname;

c.Quantity__c = crt.quantity;

//system.debug(crt.proname);

insert(c);

 

}

 

}

pagereference prref = new pagereference('/apex/oderlist?orderkey='+maxnum);

prref.setredirect(false);

return prref;

 

 

 

}

public list<cartwrapper> cartlist{get;set;} { cartlist = new list<cartwrapper>();}

 

public class cartwrapper

{

public productlist proobj{get;set;}

}

/* public pagereference addtocart3()

{

for (productlist crt : prod)

{

if (crt.isselect)

{

cartwrapper c = new cartwrapper();

 

c.proobj = crt;

cartlist.add(c);

}

}

pagereference prref = new pagereference('/apex/cartpage');

prref.setredirect(false);

return prref;

}*/

 

public pagereference addtocart2()

{

for (productlist crt1 : prod)

{

if (crt1.isselect)

{

cartwrapper c1 = new cartwrapper();

 

c1.proobj = crt1;

cartlist.add(c1);

}

}

 

return null;

}

public boolean getRendered()

{

Boolean render = (cartlist == null || cartlist.size() == 0 ? false : true);

 

return render;

}

}

 

 

VF page:

 

 

<apex:page standardController="Product__c" extensions="productassign" >

<apex:stylesheet value="{!$Resource.histyle}"/>

<style>

 

.changecss

 

{

 

background-color:grey;

 

 

}

</style>

<script>

 

  function computeTotal(quantityId, unitPriceId, totalId){

    var quantity = document.getElementById(quantityId).value;   

    var cost = document.getElementById(unitPriceId).innerHTML; 

         

    var totalPrice = quantity * cost ;

          alert('quantity is ' + quantity + 'price is ' + cost );

    document.getElementById(totalId).innerHTML = totalPrice;

  }

</script>

  <apex:form id="kh">

  <h1>Product search and cart page</h1>

  <apex:commandbutton value="press" action="{!showpopup}" rerender="kh" />

  <apex:outputpanel rendered="{!displayPopup}"> 

  This is popup display

 

</apex:outputPanel>

</apex:form>

 

 

<apex:form id="myform" >

 <div id="loadingDiv">

<!-- The screen element that will cover the form. Javascript will change the height of this to drop it down. -->

 

   <apex:pageblock id="hardCosts" title="Line Items - Hard Cost Estimate"> <!-- The form element to screen. -->

      <script>

     

      function showLoadingDiv() {

        

 var blockToLoad = document.getElementById('{!$Component.hardCosts}');

 var loadWidth = window.getComputedStyle(blockToLoad,"").getPropertyValue("width");

 var loadHeight = window.getComputedStyle(blockToLoad,"").getPropertyValue("height");

 //Set the loadingDiv to screen the element at the correct size.

 var loadingDiv = document.getElementById('loadingDiv');

 loadingDiv.setAttribute('style','background-color:black; opacity:0.35; height:' + parseFloat(loadHeight) + 'px; width:' + loadWidth + ';');

      }

      function hideLoadingDiv() {

 

 var loadingDiv = document.getElementById('loadingDiv');

 var blockToLoad = document.getElementById('{!$Component.hardCosts}');

 var loadWidth = window.getComputedStyle(blockToLoad,"").getPropertyValue("width");

 

 loadingDiv.setAttribute('style','height:0px; width: ' + loadWidth + '; background-color:black; opacity:1;');

      }

     

      </script>

 

 

 

 Enter Search Value :

<apex:inputText value="{!searchkey}"/> 

 

<apex:commandButton value="Search" action="{!searchprod}" status="status" rerender="myform" />

 

 

<apex:actionStatus id="status" onstart="showLoadingDiv()" onstop="hideLoadingDiv()" >

  <apex:facet name="start" > 

<br/> 

 loading..<br/>        

<img src="{!$Resource.loading}" border="0" height="50" width="50"/>

<!--  <apex:image url="{!$Resource.loading}" title="loading..." height="50" width="50" />  -->

   

           

</apex:facet>

<apex:facet name="stop" >

          

           

</apex:facet> 

</apex:actionstatus> 

 

 

 <apex:pageblockTable value="{!prod}" var="a" style="width:800px" rowclasses="changecss">

  <apex:column headervalue="Name" style="width:200px"> {!a.prot.name}</apex:column> 

<apex:column headervalue="Price" id="Price" style="width:200px"> {!a.prot.price__c}</apex:column>  

<!-- <apex:column headerValue="Quantity" style="width:200px"> <apex:inputtext value="{!a.quantity}"/></apex:column>  -->

 <apex:column headerValue="Quantity">

 <apex:inputtext id="quantity" style="width:200px" value="{!a.quantity}" onblur="computeTotal('{!$Component.quantity}','{!$Component.Price}','{!$Component.total}');"/>

        </apex:column>

 

<apex:column ><apex:inputcheckbox value="{!a.isselect}" style="width:20px"/> </apex:column>

<apex:column headerValue="total" style="width:200px">

         <apex:outputtext id="total" style="width:200px" value="{!a.total}"/>

        </apex:column>

  </apex:pageblockTable>

 

<apex:commandButton value="Add to cart2" action="{!addtocart2}" reRender="cartshow"/>  </apex:pageBlock>

 

 

 

 

 

 

<h1>cart list </h1>

<apex:outputpanel id="cartshow">  

   <apex:pageBlock id="cartsho" mode="readonly" rendered="{!rendered}" >

  

<apex:pageBlockSection columns="2">    <apex:pageblockSectionItem dataStyle="width:50%"></apex:pageblockSectionItem> 

<apex:pageblockSectionItem dataStyle="width:50%">

     <apex:pageBlockTable value="{!cartlist}" var="c" >

 

<apex:column headerValue="Delete" headerClass="ct">

 <apex:variable var="rowNum" value="{!0}"/>

<apex:commandLink style="font-size:15px; font-weight:bold; text-align:center;color:red;" value="X" action="{!delrow}" reRender="cartshow" >

<apex:param value="{!rowNum}" name="index" />

 

</apex:commandLink>

<apex:variable var="rowNum" value="{!rowNum+1}"/>

</apex:column>

         <apex:column value="{!c.proobj.prot.name}" headerValue="Product Name"/>

           <apex:column headervalue="Price" style="width:200px"> {!c.proobj.prot.price__c}</apex:column>

          <apex:column headerValue="Quantity"  >

                {!c.proobj.quantity }

            </apex:column>

             <apex:column headerValue="Total"  >

                <apex:outputtext value="{!c.proobj.total}"/>

            </apex:column>                        

            </apex:pageBlockTable>

<apex:commandButton value="Order" action="{!addtocart}"/>           

</apex:pageblockSectionItem>            

</apex:pageBlockSection>           

        </apex:pageBlock>

   </apex:outputpanel>

</div>

</apex:form>

 </apex:page>

 

 

 Any suggestions to overcome this problem?

 

Hi I have a urgent requirement to edit specific rows on pageblocktable.

I am able to delete the specific row but not getting how to edit specific row.

 

can somebody share me a working code snippet so that i can refer and implement the logic.

 

Please help me

 

 

Can u tell  me how i can reframe  logic to elimiate soql inside for loop. What is the best possible way.

 

I had written a logic in which a soql was placed inside a for loop. I got to know it is not a good way of implementation.

 

Please share your knowledge.

Hi ,

actionfunction not called. whats the mistake. please correct me where i am doing mistake.

 

I dont know if i am in right approach. I am pulling out price from LIST of products user enters tjhe quantity and total amount to be displayed. I am using param and actionfunction to do it.

I dont know if it will work onchange for a row in the list.

  please guide me.

 

 

VF :

<apex:form > 

<apex:actionFunction id="paramcall" name="paramcall" action="{!totalcount}" rerender="my">

<apex:param name="f" value="" assignTo="{!a.prodprice}"/>

<apex:param name="q" value="" assignTo="{!a.quantity}"/>

</apex:actionfunction>

</apex:form>

 

  <apex:form id="my">

 

<apex:pageBlock > Enter Search Value :

<apex:inputText value="{!searchkey}"/> 

<apex:commandButton value="Search" action="{!priceproduct}"/>

 

<apex:pageblockTable value="{!prwrp}" var="a">

<apex:column headervalue="Selected"><apex:inputcheckbox value="{!a.issel}"/>

</apex:column>

<apex:column headervalue="Name" >{!a.prodname}

</apex:column>

<apex:column headerValue="unitprice">

          <apex:outputText id="unitPrice" value="{!a.prodprice}"/>

        </apex:column>

 

<apex:column headerValue="Quantity" >

<apex:inputtext id="quantity" value="{!a.quantity}" onchange="paramcall(yes!)"  />

 

</apex:column>

 

 

<apex:column headerValue="total">

          <apex:outputText id="total"/>{!a.totalamount}

        </apex:column>

</apex:pageblockTable>

 

Apex: 

public integer total{get;set;}

public integer f{get;set;}
public integer q{get;set;}
public pagereference totalcount()
{
total = f * q;
system.debug(' total ' + total);
return null;
}

Hi,

 

I am getting syntax error while passing parameters to javascript from inputfield onblur attribute.

 

I do not know why the error is resulting in.

 

Please help me with the solution.

 

I hope there is no apex controller required along with the visualforce page.

 

VF CODE :

<apex:page standardController="Account" recordSetVar="accs" sidebar="false">

<script type="text/javascript">

 

  function computeTotal(quantityId, unitPriceId, totalId){

    var quantity = document.getElementById(quantityId).value;   

    var cost = document.getElementById(unitPriceId).innerHTML;       

    var totalPrice = quantity * cost;       

    document.getElementById(totalId).innerHTML = totalPrice;

  }

</script>

  <apex:form >

    <apex:pageBlock >

      <apex:pageBlockTable value="{!accs}" var="acc">

        <apex:column headerValue="Quantity">

         

                   <apex:inputText id="quantity" onblur="computeTotal('{!$Component.quantity}','{!$Component.unitPrice}','{!$Component.total}');"/>

 

        </apex:column>

        <apex:column headerValue="Unit Price">

          <apex:outputText id="unitPrice" value="10"/>

        </apex:column>

        <apex:column headerValue="Total Price">

          <apex:outputText id="total"/>

        </apex:column>

      </apex:pageBlockTable>

    </apex:pageBlock>

  </apex:form>

</apex:page>

Hi All,

I have a lookup field on a object. I have written a soql to return name and other fields from the object with the looku field in the where clause. But this is not returning me values.

\please help.

 

list<contact> con = [select id,name from contact where name like 'a%'];
integer consize = con.size();     // returning 1, ( correct )
system.debug(' con size filter ' + consize);
for (contact conn : con)
{
system.debug(' contact name ' + conn.name ); // returning correct name

list<class__c> cls = [select name__c,Fee__c from class__c where classteacher__c =:conn.name];

integer classsize = cls.size();   // showing 0 , but one class is available with class teacher of conn.name
system.debug(' class size ' + classsize);

 

here classteacher__c is the lookup field to contact.

there is one class with classteacher name which is retuerned by conn.name but it is not being fetched.

Please help.

 

 

Hi All,

I am coding for a S2S integration. I am using batch program to accomplish this. I have written a class for login and callout to external system. I had written both login and callout statements in a single method. The WS is working fine till database.executebatch(batchname,5) i.e scope of 5, scope more than 5 is returning too many callout error.

I was told to seperate the login to external system in Start method of batch and callout in execute method of batch.But I am not able to seperate the same. Please help me.

 

public class TestWebService {

    public String errMsg{get;set;}
    public String displayError{get;set;}
   
   
    public TestWebService()
{
displayError = 'none';
}  

    public void login(){
        //-----------------------------------
        // Login via SOAP/XML web service api
        //-----------------------------------
       
        HttpRequest request = new HttpRequest();
        request.setEndpoint('https://www.salesforce.com/services/Soap/u/26.0');
        request.setMethod('POST');
        errMsg+=' 1';
        request.setHeader('Content-Type', 'text/xml;charset=UTF-8');
        request.setHeader('SOAPAction', '""');
        request.setBody('<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Header/><Body><login xmlns="urn:partner.soap.sforce.com"><username>' + 'uname'+ '</username><password>' + 'pwd'+ '</password></login></Body></Envelope>');
      Dom.XmlNode resultElmt = (new Http()).send(request).getBodyDocument().getRootElement().getChildElement('Body','http://schemas.xmlsoap.org/soap/envelope/').getChildElement('loginResponse','urn:partner.soap.sforce.com').getChildElement('result','urn:partner.soap.sforce.com');       
        // Grab session id and server url
        //--------------------------------
       final String SERVER_URL = resultElmt.getChildElement('serverUrl', 'urn:partner.soap.sforce.com').getText().split('/services')[0];
       final String SESSION_ID = resultElmt.getChildElement('sessionId', 'urn:partner.soap.sforce.com') .getText();
        errMsg+=SERVER_URL+' <--> '+SESSION_ID;
       
        MyclassWS.myclass ws = new MyclassWS.myclass();
        MyclassWS.SessionHeader_element session = new MyclassWS.SessionHeader_element();
        
       session.sessionId=SESSION_ID;
        ws.SessionHeader=session;
        errMsg+= ' ****** ' + ws.mastermetdh('test') + 'juice in org2';       
    }
}

I am calling this login() from Batch execute. But i want to split login() to login ( and call it from start) and callout ( and call it from execute ) from this.

HI all, I have a requirement to create records in salesforce from flex. But how do I connect to salesforce from flex?  flex is embedded on site page. How to do a post request in salesforce . I was planning to insert record into salesforce from Rest call

Hi All,

 I am facing a problem in assigning the total to wrapperclass property.

 

I have a pageblocktable with displays a pist of product with price. The quantity is entered. The total amount is calculated by calling a method in controller. But I am not bale to assign the total to that perticular row so that I am not able to display proper total on the pageblocktable.

 

please tell how to associate the total to wrapper class ..

 

Apex:

 

public class pricefromproduct

{

// where name like '%searchkey%'    select Id from product2 where name like '%searchkey%'

public pricefromproduct()

{

 

}

public integer total{get;set;}

public string searchkey {get;set;}

public list<pricewrapper> prwrp {get;set;} {prwrp = new list<pricewrapper>();}

// public list<productlist> prod{get;set;} {prod = new list<productlist>();}

public pagereference priceproduct()

{

 list<product2> prod = [select id from product2 where name like :'%'+searchkey+'%'];

 system.debug('prod size' + prod.size());

// prolist = [select id,name from product__c where name like : '%'+searchkey+'%'];

 

list<pricebookentry> pricebk = [Select Id, Name, ProductCode, Pricebook2Id, UnitPrice From PricebookEntry where Product2Id in :prod and usestandardprice = false and isactive = true];

  /*  best way to remove duplicates from list

  list<string> pr = new list<string>{'james','smith','james'};

  set<string> myset = new Set<string>();

List<string> result = new List<string>();

myset.addAll(pr);

result.addAll(myset);

system.debug(' pr size before filter ' + pr.size() + '   after ' + result.size());

*/

system.debug('pricebook size' + pricebk.size());

for (pricebookentry pb : pricebk)

{

pricewrapper p = new pricewrapper();

p.prc = pb;

p.prodprice = integer.valueof(pb.unitprice);

p.prodname = pb.name;

 

prwrp.add(p);

}

return null;

}

 

public integer f{get;set;}

public integer q{get;set;}

public pagereference totalcount()

{

f = integer.valueof(Apexpages.currentPage().getParameters().get('f'));

q = integer.valueof(Apexpages.currentPage().getParameters().get('q'));

total = f * q;

system.debug(' total ' + total);

 

 

return null;

}

 

 

 

public class pricewrapper

{

public pricebookentry prc{get;set;}

public integer prodprice{get;set;}

public string prodname{get;set;}

public boolean issel {get;set;}

public integer quantity{get;set;}

public integer totalamount{get;}

     

  public pricewrapper()

{

 

}

}

 

}

 

 

 

 

 

 

Hi I have a urgent requirement to edit specific rows on pageblocktable.

I am able to delete the specific row but not getting how to edit specific row.

 

can somebody share me a working code snippet so that i can refer and implement the logic.

 

Please help me

 

 

Hi ,

actionfunction not called. whats the mistake. please correct me where i am doing mistake.

 

I dont know if i am in right approach. I am pulling out price from LIST of products user enters tjhe quantity and total amount to be displayed. I am using param and actionfunction to do it.

I dont know if it will work onchange for a row in the list.

  please guide me.

 

 

VF :

<apex:form > 

<apex:actionFunction id="paramcall" name="paramcall" action="{!totalcount}" rerender="my">

<apex:param name="f" value="" assignTo="{!a.prodprice}"/>

<apex:param name="q" value="" assignTo="{!a.quantity}"/>

</apex:actionfunction>

</apex:form>

 

  <apex:form id="my">

 

<apex:pageBlock > Enter Search Value :

<apex:inputText value="{!searchkey}"/> 

<apex:commandButton value="Search" action="{!priceproduct}"/>

 

<apex:pageblockTable value="{!prwrp}" var="a">

<apex:column headervalue="Selected"><apex:inputcheckbox value="{!a.issel}"/>

</apex:column>

<apex:column headervalue="Name" >{!a.prodname}

</apex:column>

<apex:column headerValue="unitprice">

          <apex:outputText id="unitPrice" value="{!a.prodprice}"/>

        </apex:column>

 

<apex:column headerValue="Quantity" >

<apex:inputtext id="quantity" value="{!a.quantity}" onchange="paramcall(yes!)"  />

 

</apex:column>

 

 

<apex:column headerValue="total">

          <apex:outputText id="total"/>{!a.totalamount}

        </apex:column>

</apex:pageblockTable>

 

Apex: 

public integer total{get;set;}

public integer f{get;set;}
public integer q{get;set;}
public pagereference totalcount()
{
total = f * q;
system.debug(' total ' + total);
return null;
}

Hi All,

I have a lookup field on a object. I have written a soql to return name and other fields from the object with the looku field in the where clause. But this is not returning me values.

\please help.

 

list<contact> con = [select id,name from contact where name like 'a%'];
integer consize = con.size();     // returning 1, ( correct )
system.debug(' con size filter ' + consize);
for (contact conn : con)
{
system.debug(' contact name ' + conn.name ); // returning correct name

list<class__c> cls = [select name__c,Fee__c from class__c where classteacher__c =:conn.name];

integer classsize = cls.size();   // showing 0 , but one class is available with class teacher of conn.name
system.debug(' class size ' + classsize);

 

here classteacher__c is the lookup field to contact.

there is one class with classteacher name which is retuerned by conn.name but it is not being fetched.

Please help.

 

 

Hi,

 

My requirement is that I want a field(column) in pageBlockTable to be calculated dynamically based on 2 other fields.

I have 3 columns - Order quantity, Unit Price & Total Extended Price.

 

 

What I want to do is :

Whenever the value under Order quantity is changed in a row, the corresponding Total Extended Price should be calculated and refreshed (Total Extended Price = Order quantity * Unit Price ).

 

How can I achieve the same in Visualforce ?

 

Thanks in advance.

 

 

 

Regards,

Lakshmi.

  • September 03, 2012
  • Like
  • 0