• Prabha
  • NEWBIE
  • 319 Points
  • Member since 2012

  • Chatter
    Feed
  • 10
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 91
    Replies
I want to display all child records on parent object  here is my code 
But it displaying only contact records, I want to display all records which related to the parent object (it means all child objects records should display in parent Account object) please help me how to use triggers here.

Apex Code:
public class ContactsRecordsToAccounts{
  
    Public Id accID;
    public List<Contact> contactList{get;set;}
    public ContactsRecordsToAccounts(){
   contactList = new List<Contact>();
   accID=  ApexPages.currentPage().getParameters().get('acId');
   contactList =  [SELECT FirstName,LastName,Email,Phone FROM Contact WHERE AccountID = : accID];
 }
}

Visualforce Page Code:

<apex:page controller="ContactsRecordsToAccounts" sidebar="false" showHeader="false">
     <apex:pageBlock >
           <apex:pageBlockTable value="{!contactList}" var="con">
                      <apex:column value="{!con.FirstName}"/>
                       <apex:column value="{!con.LastName}"/>
                       <apex:column value="{!con.Phone}"/>
                       <apex:column value="{!con.Email}"/>
           </apex:pageBlockTable>
        </apex:pageBlock>
</apex:page>

Hello,

I have a junction object between and contact and a custom object like below

Custom_object_X__C
- Id

Jucntion__c
-Id
- LookUpToJCustom_object_X__c
-LookUpToContact__c

Contact
-Id

On the custom object there is a related list of Jucntion__c, so in page layout it is like below

Record of Custom_object_X
- Name
- Picklist X
- ......
- ....
>Related list 1
>Related list to display Jucntion (This related list will also display the contact it is related to in one of the column)

Use case:
I want a custom button to select few records of junction and send an email to contacts. also if possible to select the emil template of choice

Like below, we are abe to select the quote, simillarly i want to able to select the records on junction object and send email to Quote
User-added image 

thanky you for sugetion
 

Hi All,
 I'm using a custom apex controller. I have some master/detail relationships between some custom objects (Client --> Booking)
I'm trying to create a new child record on the Booking object (dependent child object). 
How do I specify the reference to the parent object when creating this new Booking record. 
I have a soql query that returns the existing clients which are then displayed in a selectList. 
I want to be able to associate the selected record in that select list as the master record associated with this new booking record. 
I'm hoping I'm not confusing the crap out of everyone. 
Here is my schema:
User-added image

Also as this is a custom controller, do I have to assign the Last Modified Date, Created By field values explicitly I can create a new booking record? I'm assuming nothing comes for free here? I'm not even sure what I'm suppose to put in those for those either. My primary hiccup is how do I assign the Availability and Client fields? Does that have to equal the Client.Name from the client object and Availability.Name from Availability Object?
 
<apex:page standardController="Booking__c" extensions="testing10" docType="html-5.0">
    <apex:form >
    	<apex:pageBlock >
        	<apex:pageBlockSection >
                <apex:pageBlockSectionItem >
                <apex:outputLabel >Booking Date</apex:outputLabel>
                <apex:inputfield value="{!Records.Start_Date_Time__c}">
                <apex:actionSupport action="{!UpdateSitter}" event="onchange" reRender="D1"/>   
           		</apex:inputfield>
	        </apex:pageBlockSectionItem>                 
                </apex:pageBlockSection>
            
            <apex:pageBlockSection columns="1" id="D1">
                 <apex:outputLabel rendered="{!FlagH}">Baby Sitters</apex:outputLabel>
                 <apex:selectList value="{!SelectedSitter}" size="1" rendered="{!FlagH}"> <!--var holding selected item-->
                 <apex:selectOptions value="{!RecordOption}" rendered="{!FlagH}"/> 
                  </apex:selectList>
              
                  <apex:outputLabel rendered="{!FlagH}">Clients</apex:outputLabel>
                  <apex:selectList value="{!SelectedClient}" size="1" rendered="{!FlagH}"> <!--var holding selected item-->
                  <apex:selectOptions value="{!ClientOption}" rendered="{!FlagH}"/> 
                  </apex:selectList>
                
                  <apex:outputLabel rendered="{!FlagH}">Number of Hours Needed</apex:outputLabel>
                  <apex:input type="number" id="hoursI" value="{!hours}" html-min="2" html-max="8" rendered="{!FlagH}"/      
                
              <apex:pageBlockTable value="{!Sdate}" var="sd" rendered="{!FlagH}">
                    <apex:column value="{!sd}"/>
                   <apex:column value="{!Record.End_Date_Time__c}"/>
             </apex:pageBlockTable>
                
              </apex:pageBlockSection>
              <apex:pageBlockButtons location="bottom">
	          <apex:commandButton action="{!save}" value="Save"/>
	          </apex:pageBlockButtons>
        
        </apex:pageBlock>
    </apex:form>
</apex:page>

public class testing10 {
   public Booking__c Records{get;set;}
    public Boolean FlagH{get;set;}
    public Datetime DTime {get;set;}
    public List<SelectOption> RecordOption{get;set;} //stores the babysitters names in the picklist
    public Date PickDate{get;set;}
    public String Sdate{get;set;}
    public String SelectedSitter{get;set;}
    public String SelectedClient{get;set;}
    public List<SelectOption> ClientOption{get;set;} 
    public Integer hours{get;set;} 
  
 
    public PageReference UpdateSitter(){
  
      RecordOption = new List<SelectOption>();  //list to hold my babysitters returned 
      ClientOption = new List<SelectOption>(); //list to hold clients
        
        try{
          Dtime = Records.Start_Date_Time__c; //retrive datetime input 
          PickDate= DTime.date(); //convert datetime to date type
          Sdate = String.valueOf(PickDate);
          SelectedClient ='';
            
          RecordOption.add(new SelectOption('', '----Noness----'));
          ClientOption.add(new SelectOption('', '----Select Client----'));
            
          List<Availability__c> tempval = new List<Availability__c>([SELECT Id, Name, BabySitter__r.name, BabySitter__r.First_Name__c from Availability__c WHERE Date_Available__c =: PickDate and Booked__c=FALSE]);
          List<Client__c> tempClient = new List<Client__c>([SELECT Id, Name, First_Name__c, Last_Name__c from Client__c]);
            FlagH=false; //hides rendered block until returned date has an associated value (babysitters)
            if(tempval.size() > 0){  //babysitters are found
                FlagH=true;
                for(Availability__c a : tempval){
                    RecordOption.add(new SelectOption(a.Id, a.BabySitter__r.First_Name__c));
                }
               
                if (tempClient.size() > 0){
                      for(Client__c c : tempClient){
                    	ClientOption.add(new SelectOption(c.Id, c.Name));
                	}
				}
                
                //calculate end date/time
                Records.End_Date_Time__c = Records.Start_Date_Time__c + (hours/24);
                
                //assign client to new booking??????
                Records.Client__c = SelectedClient;
                
                //assign Availability/sitter?????????
                Records.Availability__r.Name = SelectedSitter;
              
            }
           
       
        }catch(Exception e){
            
        }    
       
        return null;
    }
    
    public PageReference save(){
        insert Records;
        //need to save booking with selected babysitter, selected date
        //update availability to booked (boolean)
        //return to listview page (parent page)
        return null;
    }
    public testing10(ApexPages.StandardController controller){
        FlagH = false;
        SelectedClient ='';
        SelectedSitter = '';
        Records = (Booking__c)controller.getRecord();
        
        
    }
    public testing10(){}
}

 
I created an Apex Trigger, a few custom fields, and a couple validation rules so that I can check that a contact role is assigned to an opportunity. It actually allows me to check that multiple contacts are assigned at different stages of the sales cycle. It works great in my sandbox but I can't deploy the Apex Before Trigger because it doesn't reach the code coverage thresholds. I'm a point-and-click admin that happened to pull this together based on articles I found. Can someone help me write the test so that I can pass the code coverage test and deploy this?

Here is the Apex before trigger:
trigger updatecontactrolecount on Opportunity (before insert, before update)
{

Boolean isPrimary;
Integer iCount;

Map<String, Opportunity> oppty_con = new Map<String, Opportunity>();//check if the contact role is needed and add it to the oppty_con map
for (Integer i = 0; i < Trigger.new.size(); i++)
{
    oppty_con.put(Trigger.new[i].id,
    Trigger.new[i]);
}
isPrimary = False;
for (List<OpportunityContactRole> oppcntctrle :[select OpportunityId from OpportunityContactRole where (OpportunityContactRole.IsPrimary = True and OpportunityContactRole.OpportunityId in :oppty_con.keySet())])
{
if (oppcntctrle .Size() >0)
{
isPrimary = True;
}
}
iCount = 0;
for (List<OpportunityContactRole> oppcntctrle2 : [select OpportunityId from OpportunityContactRole where (OpportunityContactRole.OpportunityId in :oppty_con.keySet())])//Query for Contact Roles
{
if (oppcntctrle2 .Size()>0)
{
iCount= oppcntctrle2 .Size();
}
}
for (Opportunity Oppty : system.trigger.new) //Check if roles exist in the map or contact role isn't required
{
Oppty.Number_of_Contacts_Roles_Assigned__c = iCount;
Oppty.Primary_Contact_Assigned__c =isPrimary;
}
}

Thank you!
Nick
I'd like to create a role for 2 of my reps to be able to view, add, and edit notes for all of my accounts.  How can i go about doing that?
Hai,
My requirment is when i click on list page that means i created output link for id click that id it will navigate to record view page but it is not displaying values to the record view page
i write vf page and code
vf page
=----------------------
<apex:page controller="list_controller1" sidebar="false" tabStyle="Employee_Information__c">
<apex:form >
<apex:pageBlock title="Employee List">
<apex:pageBlockSection title="Employee Information Displaying ">
<apex:pageBlockTable value="{!empdetails}" var="e">
<apex:column headerValue="ID">
<apex:outputLink value="https://c.ap2.visual.force.com/apex/Record_detail_Vf_Page?id = e.id">{!e.id}</apex:outputLink>
</apex:column>
<apex:column value="{!e.First_Name__c}"/>
<apex:column value="{!e.Middle_Name__c}"/>
<apex:column value="{!e.Last_Name__c}"/>
<apex:column value="{!e.Date_of_Birth__c}"/>
<apex:column value="{!e.Father_Husband_Name__c}"/>
<apex:column value="{!e.Marital_Status__c}"/>
</apex:pageBlockTable>

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

controller
------------------------------
public class list_controller1
{

    public Employee_Information__c[] getEmpdetails()
    {
        empdetails = Database.query(query);
        return empdetails;
    }

    Employee_Information__c[] empdetails;
    string query = 'select id,First_Name__c,Middle_Name__c,Last_Name__c,Date_of_Birth__c,Father_Husband_Name__c,Marital_Status__c from Employee_Information__c';

    

}

please help me any one
User-added imageUser-added image

in the first image i click the id link it will navigate to secong image but here values are not displaying for fields .
please help me
any one
User-added image

Hi,
I have an object 'Address' and I made a visual for for adding an address on Account.When i introduce a filter the list with the address is updated. Can I make this page to work in salesforce1 ?
Hi Guys,

i have three page visulaforce wizard with a custom controller. I tried to override New button with the forst oage in th ewizard but coukdnot find the visulaforce page in the drop down list. can any one suggest a way to override new button with custom controller visualforce page or any other alternative to implement the wizard?


 
  • April 09, 2015
  • Like
  • 0
I have a Lookup field on a Contact record called Spouse__c. It enables me to add a link to another Contact to the Contact record. We manually reciprocate so both Contacts have their related spouse.
I also have a Deceased__c checkbox.  I am trying to indicate on Spouse 1 if Spouse 2 has the Deceased checkbox checked.

IF(Spouse__r.Deceased__c,'',
TEXT(SpouseDeceased)
)

But this doesn't work.

Hello!

 

I have a custom button that creates a pdf and emails it to a client from a custom object.  I now want to have the button only work when the record has a status of approved.  I have a status field Status__c, with multiple values, Approved being the one I want to have the fire off of.  I am not sure how to accomplish this.  The button is referencing a visual force page, and I am not sure if this condition needs to be set on the VF page or in the button (on click java script).  Any suggestions? 

Hi

 

Is the following possible in pageblock table?

 

I have a map structure: map<string, list<string>> ,

the values could be,

for example:

key: fruits:

values: orange, apple, grape

key: Vehicle:

values: car, motorbike, trolley, lorry, truck

key: shape:

values: round, square.

 

Now I want to show that in a pagblock table where keys as column headers and values as column values! 

 

I was only able to get that with map<string, string>. 

 

 
       <apex:pageBlockTable value="{!a1}" var="ms">
           <apex:repeat value="{!a1}" var="r"> 
                   <apex:column headerValue="{!r}"> 
                       <apex:repeat value="{!a1[r]}" var="r1"> 
                         {!r1}
                       </apex:repeat>
                   </apex:column>
           </apex:repeat>
       </apex:pageBlockTable>

 Please enlighten me on this. 

Can it be done as the way I want it to be?

 

 

Prabhan

  • August 11, 2013
  • Like
  • 0

Hi Gurus,

 

I have been working on a requirement which includes FTP integration. 

 

The requirement is that we need to send all the Accounts with their child records in csv to an FTP server. And Accounts alone are morethan 100,000 records.

 

We started working trembling, we used apex classes for each 5000 records as the heap is getting heavier for a single class. Now there are multiple chunks coming out of that apex class files.

 

We tested it with a button in VF page and class. And we used the same to send a mail. Successful. Then we tested the same with apex scheduler as the requirement demands that entire hierarchy is to be sent every by 8:00 PM. 

 

Now we got stuck at the part of integrating it with FTP. 

 

We have been searching a lot, and some older posts said that "we can not ftp out any files directly from cloud".

 

And also this .. http://www.chiragmehta.info/chirag/2010/03/22/salesforce-ftp-integration-data-loader-web-service-http/

 

........................................................

 

All we are trying to do is to send the file to an FTP. Is there anybody out there who did such kind of integration, please send some workaround.

 

  • October 04, 2012
  • Like
  • 0

Hi,

 

I am trying to populate value in one field based on the picklist selection in different field of the samae object.

 

exactly like "stage" and "probability" in opportunity..

 

please check the code and tell me why it is not working only in apex:pageBlockTable.

I searched the boards and followed some solution but its not coming,

 

my VF is:

<apex:page standardController="contact" extensions="practice4">

  <script type="text/javascript">
   function populatefield()
    {
     var ex = document.getElementById('{!$Component.form.block.sec.firstfieldID}').value;
     if(ex=="one")
      document.getElementById('{!$Component.form.block.sec.secondfieldID}').value = '1';
     else
      document.getElementById('{!$Component.form.block.sec.secondfieldID}').value = '';
      
     var ex = document.getElementById('{!$Component.form.block.sec.table.firstfieldID1}').value;
          alert(ex);
     if(ex=="one")
      document.getElementById('{!$Component.form.block.sec.table.secondfieldID1}').value = '1';
    }
  </script>
  
<apex:form id="form" >
<apex:pageBlock id="block" >
<apex:pageBlockSection id="sec" >

 <apex:inputField id="firstfieldID" value="{!contact.third__c}" onchange="populatefield();" />
 <apex:inputField value="{!contact.second__c}" id="secondfieldID" />                   

 <apex:pageBlockTable id="table" value="{!section1}" var="allGNG">
  <apex:column headervalue="pick" width="15%" >
  <apex:inputField id="firstfieldID1" value="{!allGNG.third__c}" onchange="populatefield();" >
  </apex:inputField>
  </apex:column>  
  <apex:column headerValue="value">
  <apex:inputField value="{!allGNG.second__c}" id="secondfieldID1" />                   
  </apex:column>

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

my controller is  

public class practice4 {

    public practice4(ApexPages.StandardController controller) {

    }
    public contact[] section1 = new contact[0];
    
     Public List<contact> getsection1()
    {
     section1= [SELECT third__c, second__c from contact];
     return section1;
    }


}

what I saw is "document.getElementById" is getting the values from pageblocksection, but not from pageblocktable.

 

Is there any other way...?!?

 

Thanks

Prabhan

 

 

  • August 01, 2012
  • Like
  • 0

Hi all,
I am not able to clear this challenge. Please advise. https://trailhead.salesforce.com/content/learn/projects/workshop_mgmt/workshop_mgmt_flow

User-added imageUser-added imageUser-added image

global class SendNPSbutton {
    @AuraEnabled
    public static void sendNPSEmail(Id cId)
    {
        EmailTemplate emiailTemp = new EmailTemplate();
        String htmlBody; 
        String plainBody;
        String subject;
        List<String> sendTo = new List<String>();
        contact cc = [select id from contact limit 1];
        
        Closing__c cpps = [SELECT Id,RecordTypeId,RecordType.Name,Seller_Email__c,Buyer_Email__c,Owner.FirstName,
                           Buyer_Account__c,Seller_Account__c,Seller_Account__r.Name,Appointment__r.Name
                           FROM Closing__c where Id=: cId LIMIT 1];
        
        if(cpps.Id != null)
        {
            if(cpps.RecordType.Name =='Listing Team'){
                sendTo.add(cpps.Seller_Email__c);
                emiailTemp = [SELECT Id, Name,Subject, DeveloperName,HtmlValue, Body FROM EmailTemplate where DeveloperName = 'NPS_Survey_npsSeller'];
                subject = emiailTemp.Subject;
                htmlBody= emiailTemp.HtmlValue;
                htmlBody = htmlBody.replace('{!Closing__c.Seller_Account__c}', cpps.Seller_Account__r.name);
                htmlBody = htmlBody.replace('{!Closing__c.OwnerFirstName}', cpps.Owner.FirstName);
                plainBody = emiailTemp.Body;
                plainBody = plainBody.replace('{!Closing__c.Seller_Account__c}', cpps.Seller_Account__c);
                plainBody = plainBody.replace('{!Closing__c.OwnerFirstName}', cpps.Owner.FirstName);
            }else{
                sendTo.add(cpps.Buyer_Email__c);
                emiailTemp = [SELECT Id, Name,Subject, DeveloperName,HtmlValue, Body FROM EmailTemplate where DeveloperName = 'NPS_Survey_nps'];
                subject = emiailTemp.Subject;
                htmlBody= emiailTemp.HtmlValue;
                htmlBody = htmlBody.replace('{!Closing__c.Buyer_Account__c}', cpps.Appointment__r.Name);
                htmlBody = htmlBody.replace('{!Closing__c.OwnerFirstName}', cpps.Owner.FirstName);
                plainBody = emiailTemp.Body;
                plainBody = plainBody.replace('{!Closing__c.Seller_Account__c}', cpps.Seller_Account__c);
                plainBody = plainBody.replace('{!Closing__c.OwnerFirstName}', cpps.Owner.FirstName);
            }
            // process the merge fields
            // String subject = emailTemplate.Subject;
            //  subject = subject.replace('{!Contact.FirstName}', c.FirstName);

            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            mail.setTemplateId(emiailTemp.Id);
            List<String> ccTo = new List<String>();
            ccTo.add('xyz@gomail.com');
            mail.setCcAddresses(ccTo);
            mail.setReplyTo('xyz@gomail.com');
            mail.setSenderDisplayName('XYZ');
            mail.setTargetObjectId(cc.id);
            mail.setTreatTargetObjectAsRecipient(false);
            mail.setWhatId(cpps.Id);
            mail.setToAddresses(sendTo);     
            mail.setBccSender(false);
            mail.setUseSignature(false);
            mail.setHtmlBody(htmlBody);
            mail.setSubject(subject);
            mail.setPlainTextBody(plainBody);
            mail.setSaveAsActivity(false);  
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
           
        }
    }
    
}

 

TEST Class:

@istest(SeeAllData=true)

public class SendNPSButton_test{
    
    static testmethod void testvalidate(){
        List<String> sendTo = new List<String>();
        Account acc = new Account();
        acc.Name = 'Name test';
        insert acc;
        Closing__c cl = new Closing__c();
        //cl.RecordTypeId=Schema.SObjectType.Closing__c.getRecordTypeInfosByName().get('Buying Team').getRecordTypeId();
        cl.Buyer_Email__c = 'ravi.7293@gmail.com';
        cl.Seller_Email__c ='ravi.7293@gmail.com';
        cl.Seller_Account__c = acc.Id;
        insert cl;
       EmailTemplate emiailTemp = [SELECT Id, Name,Subject, DeveloperName,HtmlValue, Body FROM EmailTemplate where DeveloperName = 'NPS_Survey_npsSeller'];
        /*Closing__c cpps = [SELECT Id,RecordTypeId,RecordType.Name,Seller_Email__c,Buyer_Email__c,Owner.FirstName,
                           Buyer_Account__c,Seller_Account__c,Seller_Account__r.Name,Appointment__r.Name
                           FROM Closing__c where Id=: cl.Id LIMIT 1];*/
        system.debug('cl>>: '+ cl);
        Test.startTest();
       // Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
         //   mail.setTemplateId(emiailTemp.Id);
        //mail.setToAddresses(sendTo);
        //Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
        system.debug('cl11>>: '+ cl.Seller_Email__c);
        system.debug('cID>>: '+ cl.ID);
        SendNPSbutton.sendNPSEmail(cl.Id);
        //Integer emailInvocations = Limits.getEmailInvocations();
        Test.stopTest();
        //system.assertEquals(1, emailInvocations, 'An email should be sent');
        
    }
}

 

 

when I click on the button to redecte me to another visualforce page I get a blank page it's not working for me but for others, it's work I use google chrome as navigator .

it works for other members, and am working on Classique version 
I have a validation rule in effect where a field needs to be checked off in order to save the record.  It acts as an acknowledgment.  After it is checked and the record saved, I would like the checkbox to uncheck itself.  Is there a trigger I can implement that would uncheck the box after completion, however not interfere with the validation rule that enforces the checkbox to be checked when saving.  Appreciate your help with this!

Thanks,
Mike
I have created the lightning component and want to display it on VF page and render as PDF. For this, I have created a Lightning Dependency App and added it to VF page using $Lightning.createComponent(String type, Object attributes, String locator, function callback). 
I have followed steps mentioned in the following documentation: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_visualforce.htm
But nothing is displayed in PDF.

Here is the code:
App:
​<aura:application access="GLOBAL" extends="ltng:outApp">
    <aura:dependency resource="c:AccountSnapshotComponent"/>
</aura:application>

VF Page:
<apex:page renderAs="pdf" standardStylesheets="false">
    <apex:includeLightning />
    <div id="lightning" />
    <script>
        $Lightning.use("c:AccountSnapshotApp", function() {
            $Lightning.createComponent("c:AccountSnapshotComponent",
                                       { label : "Press Me!" },
                                       "lightning",
                                       function(cmp) {
                                           // do some stuff
                                       });
        });
    
    </script>
</apex:page>

 Please help to display data in PDF format.
I want to display all child records on parent object  here is my code 
But it displaying only contact records, I want to display all records which related to the parent object (it means all child objects records should display in parent Account object) please help me how to use triggers here.

Apex Code:
public class ContactsRecordsToAccounts{
  
    Public Id accID;
    public List<Contact> contactList{get;set;}
    public ContactsRecordsToAccounts(){
   contactList = new List<Contact>();
   accID=  ApexPages.currentPage().getParameters().get('acId');
   contactList =  [SELECT FirstName,LastName,Email,Phone FROM Contact WHERE AccountID = : accID];
 }
}

Visualforce Page Code:

<apex:page controller="ContactsRecordsToAccounts" sidebar="false" showHeader="false">
     <apex:pageBlock >
           <apex:pageBlockTable value="{!contactList}" var="con">
                      <apex:column value="{!con.FirstName}"/>
                       <apex:column value="{!con.LastName}"/>
                       <apex:column value="{!con.Phone}"/>
                       <apex:column value="{!con.Email}"/>
           </apex:pageBlockTable>
        </apex:pageBlock>
</apex:page>
Hello,

We do have salesforce classic right now. in future, we are going to roll out to lighting.
the visual force pages whatever I am going to develop in classic version should be lighting friendly i,e, when we roll out to lighting the vf page, should not give any issue.
my question is when I am developing vf page in the classic version is it enough to use  lightningStylesheets="true" or should I develop vf page using lighting API.
Can anyone please guide how can develop vf page in a classic which can be used both in classic and lighting.

If I need to develop using lighting API, please give some example 
the page should display table formate  account records with checkboxes and sortable header's




 
  • January 26, 2018
  • Like
  • 0
Hello Developer Friends, I am trying to create a list view button that will mark a case as Spam (custome checkbox field) and Update the Case Status to Resolved. The below is what I've got but I know it is worng. Any help is appreciated!

Thank you and be well!

Jo
 
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}

var record = new sforce.SObject("Case");  

c.Is_Spam__c = 'true';
caseObj.Status = 'Resolved';
record.Id = "{!Case.Id}";


var result = sforce.connection.update([record]);
window.location.reload();

 

Hello,

I have a junction object between and contact and a custom object like below

Custom_object_X__C
- Id

Jucntion__c
-Id
- LookUpToJCustom_object_X__c
-LookUpToContact__c

Contact
-Id

On the custom object there is a related list of Jucntion__c, so in page layout it is like below

Record of Custom_object_X
- Name
- Picklist X
- ......
- ....
>Related list 1
>Related list to display Jucntion (This related list will also display the contact it is related to in one of the column)

Use case:
I want a custom button to select few records of junction and send an email to contacts. also if possible to select the emil template of choice

Like below, we are abe to select the quote, simillarly i want to able to select the records on junction object and send email to Quote
User-added image 

thanky you for sugetion
 

I have this controller<

public class AIRList {   
    public ApexPages.StandardSetController setAIR {
            get {
            if(setAIR == null) {
String accountID = System.currentPageReference().getParameters().get('accountID');
String caseID = System.currentPagereference().getParameters().get('caseID');
                setAIR = new ApexPages.StandardSetController(Database.getQueryLocator(
                    [SELECT id,Name, product_name__c,quantity__c,pfx_account_number__c FROM ams_inventory_rollup__c where accountID__c = :accountId]));

            }
            return setAIR;
        }
        set;
    }
        public List<AMS_Inventory_Rollup__c> getAMSInventories() {
        return (List<AMS_Inventory_Rollup__c>) setAIR.getRecords();
    }
}
That populates this VF page, 

<apex:page controller="AIRList"> <apex:form > <apex:pageBlock > <apex:pageBlockTable value="{!AMSInventories}" var="a"> <apex:column > <apex:inputCheckbox /> </apex:column> <apex:column value="{!a.Name}"/> <apex:column value="{!a.Product_Name__c}"/> <apex:column value="{!a.Quantity__c}"/> <apex:column value="{!a.PFX_Account_Number__c}"/> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>

I need to take the selected items form the page, and add them to a case related object/List. Case_cancelled_Inventories that is the child in a masetr/detail relationship to case.