• Arun MK
  • NEWBIE
  • 404 Points
  • Member since 2011
  • Salesforce Developer


  • Chatter
    Feed
  • 14
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 72
    Replies
Hello,

I have created a fields like below :
CustomField__2017__c
CustomField__2018__c
CustomField__2019__c
CustomField__2020__c

I want to store values in them but the field should be dynamic

CustomField__{YYYY}__c = 'XXX'

YYYY can be 2017 or 2020, how can i do it in Apex

Thank you for advise 

 
I'm trying to retrieve the record type Name of the Lead object in the following piece of code:
Lead objLead;
//constructor
        public LeadToMerchantController(ApexPages.StandardController controller) {    
                objLead = (Lead)controller.getRecord();
            }
        ...
            String leadType = objLead.RecordType.Name;
                    System.debug('leadType ' + leadType);

but instead I receive 'Null' as a value of 'leadType'.
Please advise how to retrieve the name of the Lead record type?

 

Hi,
 
            I have 2 visualforce pages ....i.e Page1,Page2 ... when i open  Page1 means after 1min automatically page2 must me populate in as a chat box..at one corner..in page1. 
how it is possible..
which technique i have to use..

hi again, 

 

i'm in the very beginning stages of trying to get the activity history from a related object to display in a visual force page - very new to this as i'm sure you'll be able to tell...

 

i have this controller......

 

public class ContactController {

List<Contact> contact;

public List<Contact> getContact() {

if (contact == null) {
contact = [SELECT Id, Name, Email FROM Contact where Id =: '0035000000Zm8Zq'];
}
return contact;
}
}

 

and this vf page that calls it...

 

<apex:page controller="ContactController">

 

<apex:relatedList list="ActivityHistory" ></apex:relatedList>
</apex:page>

 

it displays nothing. i'm wondering if i'm even going about this in the right way? my assumption is that if i return the contact from the controller, i should be able to use the apex related list to display the activity history. 

 

any help/direction is greatly appreciated. 

 

apologies for multiple consecutive posts, but these are issues that have been driving me batty for too long. 

 

so i have a profile that i have used record types to limit the visibility of picklist options. the profile is owner/manager. it works great. the problem is, that i have many owners and managers and their dashboard as it pertains to profiles are pretty much identical expect for which picklist values they should see. i'm wondering/hoping that there is a way to show differnt picklist values to different users without having to create a different profile for each owner/manager who should be seeing something slightly different?

 

anyone come across this issue before? what was your solution?

 

thanks

 

dustin

On my VF page I want to be able to only show select fields for USER for editing purposes. I have created this VF page and have the VIEW option at the top with the dropdown based on User Profile. Once I select a different profile and hit the GO button it takes me to the USER page and I want it to rerender my VF page with the type User Profile I selected in the View. 

 

My theory is that this line of code is what needs to be updated but not positive. 

 

<apex:actionSupport event="onchange" rerender="user_table"/>

 

Here is my code. 

 

<apex:page standardController="User" recordSetVar="users" tabStyle="User">
       <apex:form >
       <apex:pageBlock >
               <apex:pageMessages />
               <apex:pageBlock >
                       <apex:panelGrid columns="2">
                               <apex:outputlabel value="View:"/>
                              <apex:selectList value="{!filterId}" size="1">
                                        <apex:actionSupport event="onchange" rerender="user_table"/>
                                        <apex:selectOptions value="{!listviewoptions}"/>
                             </apex:selectList>
                             <apex:commandButton value="Go" action="{!list}"/>
                     </apex:panelGrid>
                </apex:pageBlock>

                <apex:pageBlockButtons >
                        <apex:commandButton value="Save" action="{!quicksave}"/>
                        <apex:commandButton value="Next" action="{!next}"/>
                        <apex:commandButton value="Previous" action="{!previous}"/>
                </apex:pageBlockButtons>

                <apex:pageBlockTable value="{!users}" var="u" id="u_table">
                        <apex:column value="{!u.name}"/>
                        <apex:column value="{!u.Profile__c}"/>
                        <apex:column headerValue="Signature Name">
                                 <apex:inputField value="{!u.Signature_Name__c}"/>
                        </apex:column>
                        <apex:column headerValue="Email">
                                <apex:inputField value="{!u.Signature_Email__c}"/>
                       </apex:column>
                       <apex:column headerValue="Title">
                               <apex:inputField value="{!u.Signature_Title__c}"/>
                       </apex:column>
                       <apex:column headerValue="Phone">
                                <apex:inputField value="{!u.Signature_Phone__c}"/>
                       </apex:column>
                       <apex:column headerValue="Mobile">
                               <apex:inputField value="{!u.Signature_Mobile__c}"/>
                       </apex:column>

             </apex:pageBlockTable>

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

  • August 21, 2013
  • Like
  • 0

hello,

 

is there anyway to pass variables to a home page component from data on the usr record? or from a url? i'm have an iframe on a home page component that displays an s control that displays a calendar for a certain group, and based on which group it needs a different id in the url for the iframe to render the proper data. 

 

thank you.

 

dustin

I need to include the record approval submission buitton and approval history related lists on my vfpage. I am using the code below, but the related list is not rendering?

 

<apex:relatedList list="ProcessInstance"/>
<apex:relatedList list="ProcessInstanceHistory"/>

 

I am recieving the error:

'ProcessInstance' is not a valid child relationship name for entity PCN

 What is the correct name for the approval related list?

 

Thank you

Hi All,

 

 


On upload of document  to content we are creating records on custom object with a field containing the link to document and we are displaying the field on visualforce page.But the issue is some users try to delete the document from content and the link still shows up on visualforce page as the link doesn't gets deleted from the field.(custom object)

  

 

Thanks

Hi my name is Alejandra,

 

I try to display in a column an variable that change with condition. The thing is that the variable set the last value, and not iterate with rows of table.

 

<apex:pageBlockTable value="{!contact.Beneficios__r}" var="beneficio" cellPadding="3" border="1" columnsWidth="50px,110px,60px,60px,230px" rules="all">
        <apex:column value="{!beneficio.Name}"/>
        <apex:column value="{!beneficio.Catalogo_Beneficio__c}"/>
        <apex:column value="{!beneficio.Moneda__c}"/>
        if({!beneficio.monto_estimado__c} == null){
            <apex:variable var="monto" value="{!beneficio.Monto_Dolares__c}" />
        }
        else{     
            <apex:variable var="monto" value="{!beneficio.monto_estimado__c}" />     
        }
        <apex:column value="{!monto}"/>
        <apex:column value="{!beneficio.proposito__c}"/>
</apex:pageBlockTable>

 

Please can tell me what is wrong in mi code?

 

Regards,

Hi,

Am new to salesforce, I had customized my org with my requirements, But am facing some problem:

 

I have a Custom JunctionObject__c  which has 2 fileds

1. CustomField1__c master-detail relation to CustomObject1__c and Similarly  

2. CustomField2__c master-detail relation to CustomObject2__c. 

 

I had Customized the new edit page to VF1 n used StandardController=”JunctionObject__c ” Extension="testController"

And overriden the "New" button of JunctionObject__c  to VF1.

 

So when we go from CustomObject1__c (PARENT) record we can see the related block JunctionObject__c , NOW when I click the "NEW" button the VF! appears Good. and I insert the data and click Save Button am going to detail page of JunctionObject__c,

But I need to be redirected to the CustomObject1__c detail page of that id. 

Here's below is the VF1 page :

<apex:page standardController="JunctionObject__c" extensions="TestController">
<apex:form id="myForm">  
 <apex:pageBlock title="JunctionObject Edit" mode="edit">
   <Apex:pageBlockButtons >
    <apex:commandButton action="{!save}" value="Save"/>   
    <apex:commandButton action="{!cancel}" value="Cancel"/>   
   </Apex:pageBlockButtons>
   <apex:pageBlockSection title="JunctionObject Information" columns="1">
     <apex:inputField  value="{!JunctionObject__c.CustomObject1__c}" />  // this helps me in pre-populating the value from Parent. 
    <apex:inputField value="{!JunctionObject__c.CustomObject2__c}" /> 
   </apex:pageBlockSection> 
  </apex:pageBlock>
 </apex:form>
</apex:page>

and Controller i.e. Extension is:

public class testController {

    public JunctionObject__c record;
    ApexPages.StandardController con;

    public testController (ApexPages.StandardController controller) {
    this.con = Controller; 
    system.debug( con.getRecord() );
        try { 
        this.record = [select id,Name,CustomField1__c,CustomField2__c from JunctionObject__c  where id = :con.getRecord().id limit 1];
        } 
        catch( Exception ee) { 
            this.record = new JunctionObject__c (); 
        }
    }
}

I didn't write any code for save Method, Please suggest me the code for Save Method which saves the object and redirects it to the parent CustomObject1__c.

 

Please help me in Save Method i.e. Code which saves the object and redirects it to the parent CustomObject1__c.

i.e. a Save button when clicked saves the inputvalues to the JunctionObject and Redirectes straight away to the previous CustomObject1 from where it came.

 

-ThankYou.

Does anyone have information how to encrypt attachments in SFDC?  

 

Thanks in advance,

John

  • August 20, 2013
  • Like
  • 0

Hi folks, 

 

I have a custom object with a field called source that has a list of 20 master values associated with it. i have created a record type for profile group A. it works just as advertised and restricts the list of values that i assigned when creating a new record. However, for records that existed prior to the creation of the the record types, the list of values in the picklist still contain all of the values from the master list. is there a way to update/assign/unassign the picklist values for the older records?

 

thanks

 

dustin

I had the pleasure of writing my first trigger today.  I'm not new to programming, just new to the APEX language.  In creating this trigger, I tried to adhere as much as I can to some of the best practices outlined in many of the resources available.  I do however have some concerns about my code, specifically with regards to what I'm reading about governor limits.

 

Here's a brief background into what the business process is and why the trigger is necessary: We have a need to keep track of the campaigns a lead or contact takes part of.  We have a specific text field in the Lead and Contact table where a list of campaign names of the campaigns they are a part of will be stored.  This field will be updated each time a new campaign member record is created or modified for this lead or contact. 

 

The trigger is on the Campaign Member table, and basically, each time the trigger fires, the field (on the Lead or Contact record, depending on which one it is) will be re-calculated based on all of the campaigns that person is a part of.  The guts of the trigger will get a list of all the Campaign Member records for the Lead or Contact (of this current Campaign Member record), from a SOQL statement.  This SOQL statement is embedded in the "for" loop, which may break if the governor limit for SOQL queries are reached, in this case, 100 SOQL queries.  So, if we have a bulk upload of Campaign member records using say a data loading tool of some sort, it seems to me that using this trigger, we'd hit the governor limit real quick.  How can this be improved so that we do not reach the governor limits?

 

Any help is appreciated!

 

Thanks,

Frank

 

Trigger code below:

==================================================

 

trigger UpdateProspectWithCampaignName on CampaignMember (after insert, after update, after delete) {
    if (Trigger.isAfter && (Trigger.isInsert || Trigger.isUpdate)) {      
        // Iterate over each CampaignMember record
        for (CampaignMember newCM : Trigger.new) {  
            string mycampaigns = '';         
            if (!string.isEmpty(newCM.ContactId)) { //If the Prospect is a Contact record
                Contact ContactToMod = [SELECT Id, Name, Test_CL__c, (SELECT Campaign.Name FROM CampaignMembers)
                FROM Contact
                WHERE Id = :newCM.ContactId];
                // Access child records.
                List<CampaignMember> cms = ContactToMod.CampaignMembers;
                for(CampaignMember thisone : cms){
                    mycampaigns += thisone.Campaign.Name + ';';
                }
                mycampaigns = mycampaigns.removeEnd(';');
                ContactToMod.Test_CL__c = mycampaigns;
                update ContactToMod;                         
            } else  { //If the Prospect is a Lead record
                Lead LeadToMod = [SELECT Id, Name, Test_CL__c, (SELECT Campaign.Name FROM CampaignMembers)
                FROM Lead
                WHERE Id = :newCM.LeadId];
                // Access child records.
                List<CampaignMember> cms = LeadToMod.CampaignMembers;
                for(CampaignMember thisone : cms){
                    mycampaigns += thisone.Campaign.Name + ';';
                }
                mycampaigns = mycampaigns.removeEnd(';');
                LeadToMod.Test_CL__c = mycampaigns;
                update LeadToMod;           
            }    
        }
    }
}

 

 

Hi, 

I have a LWC added to Lightning Record Detail Page which has some buttons. On Click of these buttons, I want to navigate to the tabs inside a lightning record detail page.

User-added image

When the User clicks on the Fix Quote Contract Mismatches button, I want to navigate to the Fix Quote Contract Mismatches tab.

I am not sure if this is possible. But if anyone got any idea, please let me know.

Hi,

I have 2 users A and B. User A has Admin profile and so has the option to login as other users.

Now lets say, User A logged into the system and logged in as User B. 
Now, when I try to get the loggen in user Id using Userinfo.getUserId() or any other apex method, I get the User B record id. 

Is there a way, I can get the actual logged user i.e., User A record Id

Hey, I am trying to integrate salesfprce pivotal tracker. I am having some problem while trying to add a story to the project through API. I am able to get the access token. 
Can someone tell me what is the mistake that I am doing here in my code? 

My Sample Code: 

HTTPRequest req = new HTTPRequest(); 
req.setHeader('Authorization', 'Basic ' + EncodingUtil.base64Encode(Blob.valueOf(accessToken))); 
req.setHeader('Content-type:','application/json'); 
req.setMethod('POST'); 
req.setEndpoint(Label.Pivotal_Tracker_End_Point_URL+'368415/stories'); 
req.setBody('{"name":"Exhaust ports are ray shielded"}'); 
req.setCompressed(true); 
HTTPResponse resp = new HTTPResponse(); 
resp = h.send(req); 

Error that I got: 

"kind": "error", 
"error": "Authorization failure.", 
"possible_fix": "Your project permissions are determined on the Project Membership page. If you are receiving this error you may be trying to access the wrong project, or the project API access is disabled, or someone listed as the project's Owner needs to change your membership type.", 
"code": "unauthorized_operation", 
"general_problem": "You aren't authorized to access the requested resource." 


However when I try to add a story through the Advanced REST Client from google chrome, it was successful. So, it should be something wrong in my code.

Hi,

 

I am currently trying to find out the root cause of an error using Checkpoint. This error happens only when i login as "User A" who is not a system admin.

 

To find out this error, I logged as myslef (System Admin profile), I put my checkpoint on the line where the error is throwing. Then I logged in as "User A" using Login As option and accessed the page where it was throwing error. 

 

After the error was thrown, I logged out as User A and checked my Checkpoints Result Panel, where I could not find any logs created for that.

 

Is it that Checkpoint does not work when i login as Some Other User using Login As option?

 

Regards,

Arun

Hi,

I have 2 users A and B. User A has Admin profile and so has the option to login as other users.

Now lets say, User A logged into the system and logged in as User B. 
Now, when I try to get the loggen in user Id using Userinfo.getUserId() or any other apex method, I get the User B record id. 

Is there a way, I can get the actual logged user i.e., User A record Id
Hello,

I have created a fields like below :
CustomField__2017__c
CustomField__2018__c
CustomField__2019__c
CustomField__2020__c

I want to store values in them but the field should be dynamic

CustomField__{YYYY}__c = 'XXX'

YYYY can be 2017 or 2020, how can i do it in Apex

Thank you for advise 

 
global class BatchJobStatus implements Database.Batchable<sObject>,Database.AllowsCallouts

{
 public String query;
 global Database.querylocator start(Database.BatchableContext BC){
        query = 'Select id, AccountId, Account_Company_Id__c, JobDiva_ID__c, StageName from Opportunity where JobDiva_ID__c!=null AND StageName ='\Lost\'';
        return Database.getQueryLocator(query);
    }
 global void start(){
        Database.executeBatch(new BatchJobStatus(),100);
    } 

global void execute(Database.BatchableContext bc, List<Opportunity> oppList){
       for (Opportunity opp : oppList) {
        if(opp.StageName=='Lost'){
opp.StageName = 'Closed';
        }try{
update oppList;
}
   catch(Exception e) {
            System.debug(e);
        }
         
    }    
}
global void finish(Database.BatchableContext bc){
        // execute any post-processing operations
    }    
}

Code is not working. The opportunity satge is not getting updated.
Hi All,
I have a trigger on attachment object to update the case owner based on the attachment type.
But the owner is being reassigned to case default owner (under Support Settings)

I have tried the dml options but it didn't work.
Any pointers/workarounds will be highly appreciated.
Many thanks in advance
When I try to create a new account using mass convert lead button, I get an error

Error in expression '{!convertLeads}' in component in page massleadconverter: Class.MassLeadConverterController.convertLeads.

We don't use the rating field. How can I fix this? 
I'm trying to retrieve the record type Name of the Lead object in the following piece of code:
Lead objLead;
//constructor
        public LeadToMerchantController(ApexPages.StandardController controller) {    
                objLead = (Lead)controller.getRecord();
            }
        ...
            String leadType = objLead.RecordType.Name;
                    System.debug('leadType ' + leadType);

but instead I receive 'Null' as a value of 'leadType'.
Please advise how to retrieve the name of the Lead record type?
I am trying to display json data in a visual force page. In the process of that I'm using Execute Anonymous to pinpoint my errors. I have code sample from a trail that works:
 
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals');
request.setMethod('GET');
HttpResponse response = http.send(request);
// If the request is successful, parse the JSON response.
if (response.getStatusCode() == 200) {
    // Deserialize the JSON string into collections of primitive data types.
    Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
    // Cast the values in the 'animals' key as a list
    List<Object> animals = (List<Object>) results.get('animals');
    System.debug('Received the following animals:');
    for (Object animal: animals) {
        System.debug(animal);
    }
}

The above url produces json that looks like this:
{"animals":["majestic badger","fluffy bunny","scary bear","chicken"]}

So, my code is here:
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('http://12.15..13/GPDataAPI/api/values');
request.setMethod('GET');
HttpResponse response = http.send(request);
system.debug('response: ' + response.getBody());
// If the request is successful, parse the JSON response.
if (response.getStatusCode() == 200) {
    // Deserialize the JSON string into collections of primitive data types.
    Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
   // Cast the values in the 'animals' key as a list
   // This is where my issue is because my array doesn't have a 'named' element
    List<Object> payments = (List<Object>) results.get('payments');
    System.debug('Received the following animals:');
    for (Object payment: payments) {
        System.debug(payment);
    }
}

If I highlight and run only to the system.debug the code works and I can see in the logs that the body is correct. 
The source json for my call is:
[{"CustNmbr":"F592611 ","DocNmbr":"EBM01006295 ","DocDate":"2017-11-21T00:00:00","CheckNmbr":" ","Amt":100.00000,"Paid":"Paid","Posted":"2017-11-22T00:00:00","UnPaid":"100.00000"}]

I believe my problem is here:
List<Object> payments = (List<Object>) results.get('payments');
    System.debug('Received the following animals:');
    for (Object payment: payments) {
        System.debug(payment);
    }
and is because my source json is just an array of an object without a name (payments) where the SF code that does work has a key ('animals'). 

Any suggestions would be greatly appreciated.
 
Hi ,
Can you help me fix this error .CustomerPricingModifier: System.LimitException: Too many SOQL queries: 101" error
I get this error when Data is sent from Orcale to Salesforce via Mulesoft.

trigger CustomerPricingModifier on Customer_Pricing_Modifiers__c (after insert)
{
    for(Customer_Pricing_Modifiers__c cp:Trigger.New){
        integer i=[Select count() from Customer_Pricing_Modifiers__c WHERE External_Unique_ID__c=:cp.External_Unique_ID__c];
        if(i>1){
        CustomerDupTriggHandler.DuplicateHandler(trigger.new);
        }
    }
}
  • March 06, 2018
  • Like
  • 0
Hi,

I have 2 users A and B. User A has Admin profile and so has the option to login as other users.

Now lets say, User A logged into the system and logged in as User B. 
Now, when I try to get the loggen in user Id using Userinfo.getUserId() or any other apex method, I get the User B record id. 

Is there a way, I can get the actual logged user i.e., User A record Id

Or maybe I don't need a trigger. I created a field on a Case called Survey Sent Date which enters the date of when a survey was sent. I want that date to transfer to the Contact object from that case. From what I am reading, it looks like I may have to write a trigger. I am really unsure how to write a trigger. If I write a trigger, do I have to write a class as well?

Thanks in advance for your help!

Shannon

Folks,

 

Is there a way to mark State field of a Lead as required? I mean that red vertical line. I know it may be possible with a VF page but I would rather not want to use a VF Page.

 

 

Hi 

 

I have a requirment where my company president wants all of his activity hidden from everyone(No Read access also). No one should be able to see his activity on Account, Contact and Opportunities. 

 

Sharing settings for my ORG - Account  and Contact Public Read and Opportunity Private 

                                             Activity Private

 

Permissions in my ORG profile level : Lot of profiles have View all and Modify all on Accounts , conatcts and Opportunites so                                                          alteast they will be able to see it.

 

Things i tried  : I tired placing a new role above me( System Admin) and tried but still people who have view all are able to                            see it .

 

Thanks

Akhil

  • August 22, 2013
  • Like
  • 0

 

Hi,
 
            I have 2 visualforce pages ....i.e Page1,Page2 ... when i open  Page1 means after 1min automatically page2 must me populate in as a chat box..at one corner..in page1. 
how it is possible..
which technique i have to use..
Need help in writing test class for class that makes webservice callout. Only the dummy response part isn't working.
 
As suggested by other users, I have created a static variable in test class and used it in the original class also. So, while running the test class, the callout is by-passed successfully.
 
Below is the code coverage part. As you can see in the image, I am successfully by-passing the callout in Line 120.
But from Line 127 onwards, it is not covered as responseList is empty.
 
 
 
I have created the dummy response in the test class. Is this the correct way of creating the dummy response? Or do I need to make any changes in creating dummy response?
 
Here's the test class code.

Test.StartTest(); 
 
//setting the static variable to true, so it wont enter in the real webservice class
BatchKeyAccountsWS.testmode_con=true; 
 
//calling the webservice class
BatchKeyAccountsWS d = new BatchKeyAccountsWS('select id FROM Account Order by CreatedDate DESC LIMIT 1'); 
ID scheduleC = Database.executeBatch(d,1);
 
//instantiating the wsdl2apex class
nshSalesforce.SF_InPort stub = new nshSalesforce.SF_InPort(); 
 
//Creating dummy response List
List<nshSalesforce.Item_element> responseList = new List<nshSalesforce.Item_element>(); 

nshSalesforce.Item_element response = new nshSalesforce.Item_element();
response.ZTERM='1000';
response.PP='1000';
response.GUEBG=System.today();
responseList.add(response);
 
Test.StopTest();

 

 Please help
 

 I want to create the Visual Force page where i can select the record from lookup and its  child records should get displayed in the datatable with  Add, Save and delete button, there should be a checkbox for every record and after selecting the checkbox it should allow me to delete that particular record. I have design VF page but its not working, code is as below -

 

**********Controller****************
public class TestPageController {

public Account acc {get;set;}

public List conlist{get;set;}
public List con{get;set;}

// Public Contact inList{get;set;}
// Public List l{get;set;}
// List conlist;

public TestPageController()
{
acc=new Account();
conList= new List();
}

public PageReference getContacts() {
con= [select id, firstname, AssistantName,Birthdate,Phone from Contact where Accountid =: acc.parentid];
system.debug('#########'+con);
conlist = new List();
for(Contact c: con)
{
conlist.add(new Contactwrapper(c,false));
}
system.debug('#########'+conlist);
return null;

}
public PageReference getSelected()
{
// conlist.clear();
for(Contactwrapper awp: conlist)
if(awp.selected == true)
{
// conlist.add(accwrapper.acc);
system.debug('********'+awp.cw.firstname);

}
return null;
}

public pageReference getDelete(){
List dList = new List();
for(Contactwrapper wrap: conlist){
if(wrap.selected == true)
{
dList.add(wrap.cw);
}
}
if(dList !=null && dList.size() >0){
delete dList;
}
return null;
}

public void getCancel(){

}

public PageReference AddRow() {
Contact conObj = new Contact();
conlist.add(new Contactwrapper(conObj,false));
return null;
}

public pageReference SaveRecord(){
List ctList = new List();
for(Contactwrapper wrap: conlist){
if(wrap.selected == true)
{
ctList.add(wrap.cw);
}
}
if(ctList!=null && ctList.size() >0){
update ctList;
}
return null;
}

public class Contactwrapper{
public Contact cw{get; set;}
public Boolean selected{get; set;}

public Contactwrapper(Contact c,boolean b){
cw = c;
selected = b;
// system.debug('********'+acc);
}
}

}


***************** VF Page ********************

<apex:page controller="TestPageController" showHeader="false" sidebar="false"> <script> function savemsg() { alert('Record saved!!') } </script> <apex:form >
<apex:pageBlock >
<apex:pageblockSection >
<apex:inputField value="{!acc.parentid}" label="Select Account"/>
</apex:pageblockSection>
<apex:pageBlockButtons location="Bottom" >
<apex:commandButton value="Show Contacts" action="{!getContacts}" reRender="table"/>

</apex:pageBlockButtons>
</apex:pageBlock>
<apex:pageBlock id="table" title="Display Contacts">
<apex:pageBlockSection >
<apex:pageBlockTable value="{!conlist}" var="c">
<apex:column headerValue="Select" >

<apex:inputCheckbox value="{!c.selected}">
<apex:actionSupport event="onclick" action="{!GetSelected}" rerender="Selected_PBS"/>
</apex:inputCheckbox>
</apex:column>
<apex:column >
<apex:inputField value="{!c.cw.firstname}"/>
</apex:column>
<apex:column >
<apex:inputfield value="{!c.cw.AssistantName}" />
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>

<apex:pageblock title="Buttons">

<apex:pageBlockButtons location="Bottom">
<apex:commandButton value="Add New" action="{!AddRow}"/>
<apex:commandButton value="Save" action="{!SaveRecord}" onclick="savemsg()"/>
<apex:commandButton value="Delete" action="{!getDelete}"/>

</apex:pageBlockButtons>

</apex:pageblock>
</apex:form>
</apex:page>
***************************************************************************************************************************************

  • August 22, 2013
  • Like
  • 0

i write a code in apex for setting the chatter photo of a user . iwrite a function

 

public PageReference setPhoto(){

Http h = new Http();
HttpRequest req = new HttpRequest();
string firstImageURL = 'https://ap1.salesforce.com/resource/1377118388000/sample_pic';
firstImageURL = firstImageURL.replace(' ', '%20');
req.setEndpoint(firstImageURL);
req.setMethod('GET');
req.setHeader('Content-Type', 'image/jpeg');
req.setCompressed(true);
req.setTimeout(60000);
HttpResponse res = null;
res = h.send(req);
blob image = res.getBodyAsBlob();
ConnectApi.BinaryInput bb=ConnectApi.BinaryInput(image, 'image/png','myfile');
System.debug('user is'+ConnectApi.ChatterUsers.setPhoto(null,'00590000001jFln',bb));
return null;

}

 

when i try to save it it is giving me error  

Error: Compile Error: Method does not exist or incorrect signature: ConnectApi.BinaryInput(Blob, String, String) at line 28 column 27

 

 

and i am following this http://www.salesforce.com/us/developer/docs/apexcode/Content/connectAPI_inputs.htm#capi_binary_input 

can you please guideline whether this documentation is wrong or right ?? and how to get ConnectApi.BinaryInput instance

I want to execute schedule class per every one hour from developer console..? how can i run this class every one hour can any body help how can i achiee this...?

I have a pageBlockTable with inputcheckbox. I want to count the number of records selected and display the count in the ApexPages.message.

 

Any idea how I can do this? Thanks!!

 

 

VFP


<apex:pageBlockTable value="{!priceist}" var="p" id="results">

<apex:column >
<apex:inputCheckbox value="{!p.selected}" onchange="updateSelectCount(this);"/>
</apex:column>


<apex:column >
...
</apex:column>

</apex:pageBlockTable>
   
   
</apex:pageBlock>

 

//Apex class


 public PageReference approveRecord(){

 

    // my logic and finally


  ApexPages.addMessage(new ApexPages.message(ApexPages.severity.Confirm,'All records successfully approved!'));    // Here instead of 'All' i want {!count}

}

  • August 21, 2013
  • Like
  • 0