• Krishna Sambaraju
  • SMARTIE
  • 1652 Points
  • Member since 2014

  • Chatter
    Feed
  • 48
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 345
    Replies
Helloo....
I have created a VF page for a Controller with remote action method. I am not able to get the call back to javascript function and display the result in output text field of  Page block section.Can anyone please help me resolve the issue. Please find VF code and Apex code below:

Apex Code:

public class RemoteFunction1CNTRL{
@RemoteAction
public static Account call(string accname){
 Account acc = [select id,name,phone from Account where name=:accname];
 return acc;
}
}

VF code:

<apex:page controller="RemoteFunction1CNTRL">
<apex:form id="fm">
<script>
function myfun(){
alert('Script function called');
var name = document.getElementById("{!$Component.pb1.it}").value;
alert('Searching for:'+''+name);

RemoteFunction1CNTRL.call(name,handleResponse,{escape:true});

function handleResponse(result,event){
alert('sobject:'+ result);
document.getElementById("{!$Component.pb2.sid}").innerHTML=result.Id;
document.getElementById("{!$Component.pb2.sname}").innerHTML=result.Name;
document.getElementById("{!$Component.pb2.sphone}").innerHTML=result.Phone;
}
}
</script>
<apex:pageBlock id="pb1">
<apex:inputText id="it"/>
<apex:commandButton value="Click" onclick="myfun();"/>
</apex:pageBlock>

<apex:pageBlock id="pb2">
<apex:outputText id="sid"/><br/>
<apex:outputText id="sname"/><br/>
<apex:outputText id="sphone"/><br/>
</apex:pageBlock>

</apex:form>  
</apex:page>
Hi Everyone,

I have a controller that gathers a list of names and then creates a string of names and puts them in an email.

The code works but the first name is displayed twice on the list. Can anyone correct it so that it only shows the names once?
 
//Loads of stuff before this...
	
List<Delegate__c> dels = [SELECT id, Name, FROM Delegate__c WHERE accountid__c =: AccountID]
    String listofDels;
      for(Delegate__c del: dels){
        if(listofDels == NULL) listOfDels = del.Name;
        listOfDels = listOfDels+ '<br/>'+del.Name;                   //This is displaying the same del.name twice
    }
	
	//sort all the email stuff out here...
	
	htmlBody = htmlBody.replace('[ListOfDelegates]', listofDels);   //replace text in the email with the new string of names.



Thanks
Joe
Hi all,

I have a lightning component that displays a list of records. On each of the records I have a button group and each button needs to perform an action on that particular record. So my question is, how do I pass (or go get) the object record or the record ID to the JS controller?

Heres is my component.cmp...
<aura:iteration items="{!v.timeline.entries}" var="entry">
	<li class="slds-timeline__item" id="alertItem"><!-- {!'alertItem_' + entry.feedItemId}-->
		
		<div class="slds-media slds-media--reverse">
			<div class="slds-media__figure">
				<div class="slds-timeline__actions">
					 <!--button group - start-->
					
					<div class="slds-button-group" role="group">
					  <button class="slds-button slds-button--icon-border" onclick="{!c.showModal}">
						<c:BBsvg class="{!'slds-button__icon'}" xlinkHref="{!'/resource/BB_SLDS091/assets/icons/utility-sprite/svg/symbols.svg#edit'}" />
						<span class="slds-assistive-text">Edit</span>
					  </button>
					  <button class="slds-button slds-button--icon-border" onclick="{!c.dismissAlert}">
						<c:BBsvg class="{!'slds-button__icon'}" xlinkHref="{!'/resource/BB_SLDS091/assets/icons/utility-sprite/svg/symbols.svg#clear'}" />
						<span class="slds-assistive-text">Dismiss</span>
					  </button>
					  <button class="slds-button slds-button--icon-more" onclick="{!c.showModal}">
						<c:BBsvg class="{!'slds-button__icon'}" xlinkHref="{!'/resource/BB_SLDS091/assets/icons/utility-sprite/svg/symbols.svg#clock'}" />
						<span class="slds-assistive-text">Snooze</span>
					  </button>
					</div>
					
					<!--button group - end-->
					
				</div>
			</div>
			<!-- more about the record resides here -->
		</div>
	</li>
</aura:iteration>
Here is my controller.js...
({

    showModal : function(component, event, helper) {
    	document.getElementById("backGroundSectionId").style.display = "block";
    	document.getElementById("snoozeSectionId").style.display = "block";
    },
    dismissAlert : function(component, event, helper) {
		//update record as dismissed - how do I pull in the specific record id from the list in the UI?
    	document.getElementById("alertItem").style.display = "none";
    },
    saveRecord : function(component, event, helper) {
    	//save changes to the record
    }
})

All suggestions are appreciated. Thanks!
 
Getting the following error for the trigger below:

Error: Compile Error: Invalid bind expression type of Bank__c for Id field of SObject Customer__c at line 3 column 57 (IN)

trigger BankT on Bank__c (after insert, before update) {
List<Customer__c> CustwithOpps = 
[SELECT ID,Name,Region__c FROM Customer__c WHERE ID IN :Trigger.New];

for(Bank__c a : CustwithOpps) {
Customer__c [] relatedOpps =a.Customer__c;
  } 
}
Hi all, hope you can help!

Please could someone help me create a custom button the Contact object that will send a template email to that particular contact and record the email in Activity History.

Our company has two brands and therefore two different templates, so we need to make sure the correct branded template is sent out to the contact.  The brand is determined by a custom picklist field on the Contact object called 'Brand__c' and has only two values 'Brand X' and 'Brand Y'.

How can this be done?

Many thanks,
Dave
Hi

We are new to the salesforce and we are implementing to integrate our app data to salesforce.And we are in confuse to work with SOAP API or REST API which is better because when we try to work with Rest API we are succesed in creating an Account, Lead but when we try to convert a lead to account but we failed.And also we read few post reagarding Rest Api saying that Rest Api doesnot support lead conversion is it right?
If it support lead conversion would you please let us know how to work on it using httpwebrequest.

And also let us know which Api is the best one to work with salesforce to integrate to our App.

Regards
Vinod



 
Hi I have to achive something that I'm struggling with at the moment (I've posted a few threads recently sorry)

I have a requirement as follows. I have a custom controller as follows
 
public with sharing class CreateIABookingController{
    public ItsApproved_Booking__c ItsApprovedBooking {get; set;} //Name the objects as a variables
    public ItsApproved_Product__c ItsApprovedProduct {get; set;}    
    public ItsApproved_Design__c ItsApprovedDesign {get; set;}
    public ItsApproved_Delivery__c ItsApprovedDelivery {get; set;}
    private string OpportunityId;
    public CreateIABookingController()
    
    {
        opportunityId = ApexPages.currentPage().getParameters().get('oppId');
        ItsApprovedBooking = new ItsApproved_Booking__c();
        ItsApprovedProduct = new ItsApproved_Product__c();
        ItsApprovedDesign = new ItsApproved_Design__c();
        ItsApprovedDelivery = new ItsApproved_Delivery__c();
    }
    
    public PageReference Save()
    {
        ItsApprovedBooking.Opportunity__c = opportunityId;
        insert ItsApprovedBooking;
        ItsApprovedProduct.Booking_Reference__c = ItsApprovedBooking.Id; //insert the reference field for the parent and declare variable id
        ItsApprovedProduct.Opp__c = opportunityId; //relate the Opp to the Product
        insert ItsApprovedProduct;            
        ItsApprovedDesign.Opportunity__c = opportunityId; //relate the Opp to the Design
        ItsApprovedDesign.Product_Reference__c  = ItsApprovedProduct.Id;
        ItsApprovedDelivery.Product__c = ItsApprovedProduct.Id;
        insert ItsApprovedDesign;
        ItsApprovedDelivery.ItsApproved_Design__c  = ItsApprovedDesign.Id;
        ItsApprovedDelivery.Opportunity__c = opportunityId; //relate the Opp to the Delivery
        insert ItsApprovedDelivery;
        
        return new PageReference ('/' + opportunityId);
    }
        
}
This allows the user to add a new Record (the Booking) with one related Product, Design and Delivery object on one page. This page is accessed via a button on the Opp record so that the Booking object is related to that OppID

Heres the VF page code
 
<apex:page controller="CreateIABookingController">
    <apex:form >
        <apex:pageBlock title="Booking Wizard">
            <apex:pageBlockButtons location="bottom">
                <apex:commandButton value="Save" action="{!Save}"/>
                </apex:pageBlockButtons>
            
            <apex:pageBlockSection columns="1" title="ItsApproved Booking Details">
                <apex:inputField value="{!ItsApprovedBooking.Booking_Title__c}" label="Booking Title: "/>
                <apex:inputField value="{!ItsApprovedBooking.Customer_Reference__c}" label="Customer Reference: "/>
                <apex:inputField value="{!ItsApprovedBooking.Incharge_Date__c}" label="In-Charge Date: "/>
            </apex:pageBlockSection>
                        
            <apex:pageBlockSection columns="3" title="Product Details">
                <apex:inputField value="{!ItsApprovedProduct.Product_Code__c}" label="Product Code: "/>
            </apex:pageBlockSection>
            
            <apex:pageBlockSection columns="1" title="Design Details">
                <apex:inputField value="{!ItsApprovedDesign.Artwork_Title__c}" label="Artwork Title: "/>
            </apex:pageBlockSection>
            
            <apex:pageBlockSection columns="1" title="Delivery Details">
                <apex:inputField value="{!ItsApprovedDelivery.Quantity__c}" label="Quantity: "/>
                <apex:inputField value="{!ItsApprovedDelivery.Depot_Code__c}" label="Depot Code: "/>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

What I need to do is achieve the following

1. Add row functionaility
I would like the user to be able to add additional Designs and Delivery rows related to the Product (Products can have multiple designs and multiple deliveries

2. I'd also like the user to be able to add a full row of related objects, IE. Another row with a new Product selected, along with Design and Deliveries (but that row to also have the option of adding additional Designs and Deliveries.

I've experimented with PageBlockTable, but I can't work out the List since until the VF save is pressed, nothing exisits.

I've got loads of code examples from around the web but the classes are so different to mine that I don't know where to start. I'm floundering and could really use some help.
 
Hi, I have the requirement: 2 tabs from Contacts: 1 of the tab is "Interlocutor" (spanish) and the another one is "Candidatos" both of them from contacts module.
I renamed the contacts for Interlocutor tab.
And for Candidatos one I created a new Tab (from contacts and through Visualforce: with follow code: <apex:enhancedList type="Contact" />)
What I need to do now is to filter the records for all the organization for each tab, I mean, as the origyn of the entire information is contact, i need to sepparate the data for each tab. If the user clicks on "Interlocutor" the system should filter "Automatically" the data from Contact with type = "Interlocutor"; and if the user clicks on the "Candidatos" the system should do the same but for contact type = "Candidato"
I guess this sould be done through visualforce in Candidatos tab, but I dont know how can I do this.
But for the Interlocutor tab, I have no idea! 
Can somebody help me on this subject? Please!!!!
Thanks!
Karelia.-
Good morning!

I have two validation rules in place. One is to not allow users to open a closed case and another to not allow a change of ownership on a closed case. However, the client has asked if we can change these rules to allow these functions by the case owner. Can someone tell me how to add this functionality? The validation rules are below.

AND(
ISCHANGED(Status),
ISPICKVAL(PRIORVALUE(Status), "Closed"),
$Profile.Name <> "System Administrator",
$User.Id <> '00580000004yyXl'
)

AND(
IsClosed,
ISCHANGED(OwnerId),
$Profile.Name <> "System Administrator",
$User.Id <> '00580000004yyXl'
)

Thank you for any help you can provide in this!

Melissa
Hi, I'm creating something that makes use of four custom objects.

The objects are related to the Opp object and are as follows
-Booking object
-Product (not SF native product, it's just names the same)
-Design
-Delivery

What I'm discovering is that to add a booking to the Opp with products, designs and deliveries is extremely unweildy for the user and requeries a great deal of clicks and I want to design the process to be as easy as possible.

Is it possible to create a visual force page all the fields neccessary for each object are visible? I fear this may require trigger writing, but if that's the case I'll post the question elswhere but I thought I'd ask here first.
 
I have a custom button that generates a PDF HTML page for Invoicing using a controller with queries.

At the moment, the user has to wait for approval and then press the PDF button , then save this to the 'Downloads' on the hard drive, then 'Send and Email', then click 'Template', then attach the saved PDF, then find the BCC people etc etc.  This is a pain.

It would be much better if this was automatically sent on approval to all the Contacts defined to receive Invoices.

What methodology should I use for attaching a PDF to an email and sending it?
Is there any methodology that I should be using to send an email using an Apex class at a specific time of day?
I am trying to write an Apex class that clones a record from a related record.  My app structure is a little complex:

Work_Order__c (Parent of Material Indent)
Custom Fields:  Quantity__c, Delivery Date__c
Custom Lookup:  Product__c

Material_Indent__c (Child of Work Order Object)
Custom Fields:  Quantity__c
Custom Lookup:  GSI_No__c, Work_Order__c

Product__C Object (Parent of BOM Line Item Object)
Custom Fields:  Irrelevant

BOM_Items (Child of Parent Product Object)
Custom Fields: Quantity__c
Custom Lookup: GSI_No__c

I am tryig to write a trigger that automates the process of creating an Indent from the BOM Items (which are related to the Product, which is in turn in the lookup in the Work Order).

The trigger will be initiated from the Work Order page with a button ("Create Indent").

This is where I am so far.  I am confused about whether I am even heading in the right direction?  I have doubts about the following:

1.  Is a trigger even a way to go for this?
2.  Will Page Reference return the Products__c custom field ID if I am running this via a button on the Work Order (Products__c is a Custom Field on Work_Order__c
3.  Is the method for creating a set of the BOM Items which have a Products__c=the Products__c found from the Page Reference on the Work Order correct?
4.  Am I correctly traversing the objects using BOMItemSet.add(BOMItems.GSI_No__c.id) to add the ID of the GSI number to the list?
 
trigger Indent on Work_Order__c (before update) {

 //   Create variable for capturing Product ID

Page Reference productid=Product__c.id; 

  // Create a set of all records

  Set<String> BOMItemSet = new Set<String>();
  for (BOM_Items__c BOMItems : Trigger.new) {

// Add the fields for Quantity and GSI No.

    if (BOMItems.Product__c = productid) {
      BOMItemSet.add(BOMItems.Quantity__c);
      BOMItemSet.add(BOMItems.GSI_No__c.id);  //NB This is a lookup
  }

After this, I was going to create another trigger to insert the set that I have created above into Material_Indents, the child record of the Product object.  However, I don't want to go on with this unless I am clear with the first step!

Please help!




 
I have a VF page in a custom object that has a save button inside a tabpanel and the VF page has a InlineEditSupport.  Everytime I update a field and save it, it updates but loads another Detail Page inside my VF page.  Any work around this?

 
<apex:page standardController="Property__c" showHeader="true" sidebar="false">
    <!-- Define Tab panel .css styles -->
    <style>
    .activeTab {background-color: #081f3f; color:white; background-image:none}
    .inactiveTab { background-color: lightgrey; color:black; background-image:none}
    </style>

    <!-- Create Tab panel -->
    <apex:tabPanel switchType="client" selectedTab="Property__c" id="AccountTabPanel"
        tabClass="activeTab" inactiveTabClass="inactiveTab">
        <apex:tab label="Property Information" name="name1" id="Property">
         <apex:form > 
         <apex:pageBlock >
         <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" id="saveButton" value="Save"/>
            </apex:pageBlockButtons>

           <apex:pageBlockSection columns="2">
                <apex:pageBlockSectionItem >
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Property Name" for="Property__c.Name" style="font-weight:bold"/>
                    <apex:outputField value="{!Property__c.Name}" id="Property"/>     
                </apex:pageBlockSectionItem>
​<apex:inlineEditSupport event="ondblClick" 
                        showOnEdit="saveButton,cancelButton" hideOnEdit="editButton" />
           </apex:pageBlocksection>           
        </apex:pageBlock>
        </apex:form>

       </apex:tab>
    </apex:tabPanel>
</apex:page>

 
Hi All,

I have a custom picklist field that is Courses which has some drop down values like Salesforce,Java, SAP etc. and the same field in three tabs.
In 3rd Tab, when i select value like SAP then it goes to controller and did some actions.-- its working fine.

1st and 2nd Tab, when i select same value SAP then not passing any values to controller and every time it takes value like '---select course---'  in debug log.

And i observed one thing in Debug Log, Internally it takes value which i select from VF page and sets. Again the value is changed as ---Select Course---. 
My Page:
<apex:page standardController="Contact" extensions="RunningBatchController" id="pg">
    <apex:form id="frm">
        <apex:tabPanel switchType="client" selectedTab="name1" id="theTabPanel">
        <apex:tab label="Running Batch Information" name="name1" id="tabOne" title="Running Batch">
            <apex:pageBlock title="Running Batch ">
                <apex:pageBlockSection title="Batch Information" columns="1">
                <apex:selectlist value="{!selectedCourse}" size="1" id="rc" label="Course Name: "> 
                    <apex:SelectOptions value="{!CourseList}" />  
                  <!--  <apex:actionSupport event="onchange" id="rpbt"/> -->   
                </apex:selectlist>
        
            <apex:pageBlockSectionItem >
            <apex:outputLabel value="Batch No:"/>
            <apex:inputField value="{!contact.Batch_No__c}"/>
            </apex:pageBlockSectionItem>
        </apex:pageBlockSection>
        <apex:pageBlockButtons >
            <apex:commandButton value="Search" action="{!searchBatches}" id="rbtn" reRender="rpbt"/>
        </apex:pageBlockButtons>
      <!--  <apex:pageBlockSection >-->
            <apex:pageBlockTable value="{!studentsList}" var="s" id="rpbt">
                <apex:column value="{!s.Name}"/>
                <apex:column value="{!s.Course__r.name}"/>
                <apex:column value="{!s.Batch_No__c}"/>
                <apex:column value="{!s.staff__c}"/>
                <apex:column value="{!s.MobilePhone}"/>
                <apex:column value="{!s.email}"/>
                <apex:column value="{!s.Status__c}"/>
            </apex:pageBlockTable>
     <!--   </apex:pageBlockSection>-->
    </apex:pageBlock>
    </apex:tab>
    
    
    <apex:tab label="Pending Batch Information" name="name2" id="tabTwo" title="Pending Batch">
            <apex:pageBlock title="Pending Batch ">
                <apex:pageBlockSection title="Batch Information" columns="1" id="pbs2">
                <apex:selectlist value="{!selectedCourse}" size="1" id="pc" label="Course Name: "> 
                    <apex:SelectOptions value="{!CourseList}"/>  
                    <apex:actionSupport event="onchange" reRender="ppbt"/>    
                </apex:selectlist>
                 
        </apex:pageBlockSection>
        <apex:pageBlockButtons >
            <apex:commandButton value="Search" action="{!searchPendingBatches}" id="btn" reRender="ppbt"/>
        </apex:pageBlockButtons>
      <!--  <apex:pageBlockSection >-->
            <apex:pageBlockTable value="{!studentsList}" var="s" id="ppbt">
                <apex:column value="{!s.Name}"/>
                <apex:column value="{!s.Course__r.name}"/>
                <apex:column value="{!s.Batch_No__c}"/>
                <apex:column value="{!s.staff__c}"/>
                <apex:column value="{!s.MobilePhone}"/>
                <apex:column value="{!s.email}"/>
                <apex:column value="{!s.Status__c}"/>
            </apex:pageBlockTable>
      <!--   </apex:pageBlockSection>-->
    </apex:pageBlock>
    </apex:tab>
    
    <apex:tab label="Completed Batch Information" name="name3" id="tabThree" title="Completed batch">
            <apex:pageBlock title="Completed Batch ">
                <apex:pageBlockSection title="Batch Information" columns="1" id="pbs3">
                <apex:selectlist value="{!selectedCourse}" size="1" id="cc" label="Course Name: ">
                     
                    <apex:SelectOptions value="{!CourseList}"/> 
                  <!--  <apex:actionSupport event="onchange" reRender="cpbt"/> -->   
                </apex:selectlist>
                 
        </apex:pageBlockSection>
        <apex:pageBlockButtons >
            <apex:commandButton value="Search" action="{!searchCompletedBatches}" id="Cbtn" reRender="cpbt"/>
        </apex:pageBlockButtons>
      <!--  <apex:pageBlockSection >-->
            <apex:pageBlockTable value="{!studentsList}" var="s" id="cpbt">
                <apex:column value="{!s.Name}"/>
                <apex:column value="{!s.Course__r.name}"/>
                <apex:column value="{!s.Batch_No__c}"/>
                <apex:column value="{!s.staff__c}"/>
                <apex:column value="{!s.MobilePhone}"/>
                <apex:column value="{!s.email}"/>
                <apex:column value="{!s.Status__c}"/>
            </apex:pageBlockTable>
      <!--   </apex:pageBlockSection>-->
    </apex:pageBlock>
    </apex:tab>
    
    </apex:tabPanel>
    </apex:form>
</apex:page>
​Controller:
public with sharing class RunningBatchController{
    
    public String selectedCourse { get; set; }
    public List<Contact> studentsList{get;set;}  
    
    public ApexPages.StandardController controller{get;set;}
    public RunningBatchController(ApexPages.StandardController controller) {
        this.controller = controller;
        system.debug('ddd '+controller);
        
    }

    public List<SelectOption> getCourseList(){
        
        List<SelectOption> CourseList = new List<SelectOption>();
        
        CourseList.add(new SelectOption('------- Select Course -------','------- Select Course -------')); 
        List<Product2> prodList = [Select id, Name from Product2];
        for(Product2 pc :prodList){
            CourseList.add(new SelectOption(pc.Id,pc.Name));     
        }
       return CourseList;    
    }
    
    
    
    
    
    public void searchBatches(){
        
        Contact bch = (Contact)controller.getRecord();
       system.debug('course '+selectedCourse);
       system.debug('batch '+bch.Batch_No__c);
      // String course = bch.Course__c;
       String batch = bch.Batch_No__c;
       
       if(selectedCourse != '------- Select Course -------' && batch != '--None--'){
           studentsList = [select id,Name,course__c,Course__r.name,Batch_No__c,Staff__c,MobilePhone,Status__c,Email from Contact where course__c =: selectedCourse and Batch_No__c =: batch and Status__c ='Active'];
        }else if(selectedCourse != '------- Select Course -------' && batch == '--None--'){
            studentsList = [select id,Name,course__c,Course__r.name,Batch_No__c,Staff__c,MobilePhone,Status__c,Email from Contact where course__c =: selectedCourse and Status__c ='Active'];
        }else{
            studentsList = [select id,Name,course__c,Course__r.name,Batch_No__c,Staff__c,MobilePhone,Status__c,Email from Contact where Status__c ='Active'];
        }
    }
    
    public void searchPendingBatches(){
        
        Contact bch = (Contact)controller.getRecord();
      system.debug('ppppp '+selectedCourse);
            
      if(selectedCourse == '------- Select Course -------'){
          system.debug('nothing ');
          studentsList = [select id,Name,course__c,Course__r.name,Batch_No__c,Staff__c,MobilePhone,Status__c,Email from Contact where Status__c ='Pending'];        
      }else{
          system.debug('selected course');
          studentsList = [select id,Name,course__c,Course__r.name,Batch_No__c,Staff__c,MobilePhone,Status__c,Email from Contact where course__c =: selectedCourse and Status__c ='Pending'];
        }
      
    }
    
    public void searchCompletedBatches(){
            
        Contact bch = (Contact)controller.getRecord();
                
       system.debug('cccc '+selectedCourse);
      if(selectedCourse == '------- Select Course -------'){
          system.debug('##');     
           studentsList = [select id,Name,course__c,Course__r.name,Batch_No__c,Staff__c,MobilePhone,Status__c,Email from Contact where Status__c ='In Active'];
           system.debug('@@'+studentsList.size());
      }else{
          system.debug('hii');
          studentsList = [select id,Name,course__c,Course__r.name,Batch_No__c,Staff__c,MobilePhone,Status__c,Email from Contact where course__c =: selectedCourse and Status__c ='In Active'];
        }
      
    }
    
}

 Debug Log:
User-added image

Please anyone help me with appropriate solution.

I appriciate your response.

Thank You
Rakesh.
Hi,

Can somoene please guide me with the steps to finish this task? I tied many differnt ways but it is not working.
User-added image

Thanks
Tarun


 
Hi All!

I currently have a button on the 'Lead' page, that opens a VF page with a Flow inside:

VF Page:
<apex:page standardController="Lead"> <h1>Create A Premier Quick Task</h1> <flow:interview name="QuickPremierTask" finishLocation="/{!id}"> <apex:param name="LeadID" value="{!ID}"/> <apex:param name="UserID" value="{!$User.Id}"/> </flow:interview> </apex:page>

I want to add Validation in the button code that will only allow the button to be clicked (to launch the VF page flow) if the fields 'Lead Source' or 'Initial Lead Source' are equal to the text 'Premier 1'

Normally I would simlpy exclude the button from the page layout with the use of a new Record Type, however this is not an option in this instance.

Can this be done using Javascript in the button code? (Or an alternate option)

Winning answer gets 10 internets!

Below code i got some error.Please modify and send the code
public class EmployeeRelatedList {
 private Empolyee_Details__c empDetail;
 //private Apexpages.StandardController controller;

    
    public EmployeeRelatedList(ApexPages.StandardController stdController) {
        //controller = stdController;
        this.empDetail = (Empolyee_Details__c)stdController.getRecord().id;
        
    }
    
    public Pagereference save() {
     if(id!= null){
     
        try{
            insert empDetail;
            return new Pagereference('/apex/Custom_pagenations'); 
     }
   }  
    else{
    update empDetail;
    here i got error
    
    
    } 
        catch(Exception e){
            Apexpages.addMessage(new Apexpages.Message(Apexpages.Severity.ERROR, e.getMessage()));
            return null;
        }
    }
}
THANKS

RANGA

I have created a visual force page that includes a checkbox.  How do I go about updating a custom field on another object with the result of the vf checkbox?  True (checked) = Answer1, False(not checked) = Answer 2?

I have read about wrapping etc, but not sure if this is the correct process or not?  

Please Help!!!!!!
Hello,

I have 2 record types for a Event viz. EA, EB.
I consider 3 profiles viz. P1, P2, P3.
For P1 => EA and EB are available
For P2 => Only EA is available.

For P1, I want option to select two record types, which i consider is by default as Two record type is available for him.

For P2, as only record type is available i want no option for selection, user should directly be redirected to Record type EA

Thank you

 
  • September 08, 2015
  • Like
  • 0
I am trying to complete the Apex Specialist super badge and getting the following error. Challenge is not yet complete...here is what's wrong. The Case object has not been renamed to 'Maintenance Request', although I have renamed the Case tab to Maintenance Request. Here are the screenshots of the error and the Rename Tabs and labels screen.
Super Badge - Challenge Not Complete Error

Rename Tabs and Labels - Screen

Can any one tell me why I am getting the above error?

Regards,
Krishna.
Hi,

I am getting the error "SSLHandshakeException: unable to find valid certification path to requested target" when trying to create a new force.com project in eclipse. Any ideas how to resolve this.

Regards,
Krishna.
Hi i need to show in opportunity fiekd that will contain what are the changes done in task ,event,log call those data updated  in opportunity field text area.
I have an Approval_Status__c field on the Opportunity. When a related OpportunityLineItem.UnitPrice is below the List Price I need this to update to 'Needs Approval'. If the Unit Price is above the List Price then the Approval_Status__c field should be null. 
Can anyone give me some help with wrighting a trigger for this?
I am trying to complete the Apex Specialist super badge and getting the following error. Challenge is not yet complete...here is what's wrong. The Case object has not been renamed to 'Maintenance Request', although I have renamed the Case tab to Maintenance Request. Here are the screenshots of the error and the Rename Tabs and labels screen.
Super Badge - Challenge Not Complete Error

Rename Tabs and Labels - Screen

Can any one tell me why I am getting the above error?

Regards,
Krishna.
hello guys,
i am trying to add multiple row in multiple product they are show releted product row but i m select single product so they are showing multiple row solve it ...
Hi

I have list  of emails and related checkboxes in vf page my question is i want to send emails based on what i checked in check box after that i click on vf page button it will be send emails.but I am facing some problems how to call apex method from java script or any suggestions fro this  ?
Hi all,

I have a command button on a Visualforce page and upon click the URL should open in an iFrame i.e. a web page inside an iFrame 

Idea is to display 'Button' on VF page and below that iFrame (both in VF page) and upon clicking the button it opens the URL/web page in an iFrame..

My development expertise are very limited and I've been researching and learning how to do things, but here is my code I am working.. please can you help me resolve the issue or with the correct code..?

<apex:page sidebar="False">

<apex:form >
  <apex:commandButton onclick="toGoogle();" value="Google"/>
 </apex:form>
 
  <script>
   function toGoogle() {

        redirectTo('http://www.google.com');
    }

   
    function redirectTo(target) {

        if (inIframe()) {
           // step out of an iframe (if opened via iframe)
            window.top.location.href = target;
            return false;
        } else {
          window.location.href = target;
        }
    }

    function inIframe() {
        try {
            return window.self !== window.top;
        } catch (e) {
            return true;
        }
    }
  </script> -->

</apex:page>

Thanks in advance.

Swapnil 
HI,

I want to copy one custom fields value to another custom fileds with a suffix value.For example
Code = 65892001
I want to put one A before this number and save it to another filed.(Like New code = A65892001).Is it possible??
Hi All,

I am facing diificulty to pass selected checkboxes values from groupWrapper which contains 3 lists as below. I am displaying details on VF page such as product rows for each ShipTo are grouped, then tax records are grouped for each product row detail. Basically 1 ShipTo has Mutliple Product rows and each product may have more than one Tax row details. Since these are nested under multiple tables, I have created 3 individual checkboxes but unable to capture these selected rows into controller. Please help me with suggestions

/* wrapper class to hold ShipTo, Related Products and Taxes details */
    @TestVisible public class InvoiceWrapper
    {
        public Invoice__c shipToLst {get; set;}
        public List<Invoice__c> productLst {get; set;}  
        public List<Tax__c> taxLst {get; set;}
        public Boolean shipToSelected {get; set;}
        public Boolean prodSelected {get; set;}
        public Boolean taxSelected {get; set;}
        
        public InvoiceWrapper()
        {
            shipToSelected = false;
            prodSelected = false;
            taxSelected = false;
        }
    }

/* Invoked when selected row is invoked , here only shipToSelected under wrapper list is captured. Other 2 boolean variables are recorded as False even though they are checked */
public PageReference getSelected(){
    
        for(InvoiceWrapper invwrapper : invoiceWrapperLst){
        
            system.debug('***:'+invwrapper.shipToSelected);
            system.debug('***:'+invwrapper.prodSelected);
            system.debug('***:'+invwrapper.taxSelected);
            
            selectedRows.clear();
            if(invwrapper.shipToSelected == true)   
                selectedRows.add(invwrapper.shipToLst);
        }
        system.debug('***:'+selectedRows);
        return null;
    }
<apex:page controller="theController" action="{!autoRun}">
<apex:form >
<apex:tabPanel id="tabPanel" selectedTab="{!selectedTab}">
  <apex:tab title="Education Details" label="Education Details" id="tab1" disabled="{!istab1disabled}">
  
  <apex:pageBlock title="" mode="edit">
 <apex:pageBlockSection title="Education Details">
 <apex:inputField value="{!employee.Employee_name__c}"></apex:inputField>  
 <apex:outputLabel value="Collegename:">
    

      <apex:selectList size="1" >

            <apex:selectOptions value="{!statusOptions}"/>
        </apex:selectList>
        </apex:outputLabel>
        
        
        
         <apex:outputLabel value="Education_details:">
    

      <apex:selectList size="1" value="{!SelectValue}">

            <apex:selectOptions value="{!statusOptions2}"/>
        </apex:selectList>
        </apex:outputLabel>
        
       
        
        
     </apex:pageBlockSection> 
  
  
  <apex:pageBlockButtons id="contentLoading">
    <apex:commandButton value="Next" action="{!enabletab2}" rerender="tabPanel"/>
    </apex:pageBlockButtons>
     </apex:pageBlock>
  </apex:tab>
  <apex:tab title="Employeement Details" label="Employee Details" id="tab2" disabled="{!istab2disabled}">
      
      <apex:pageBlock >
      <apex:pageBlockSection title="Employee Details">
      <apex:inputField value="{!employee.Department_name__c}"></apex:inputField> 
        
         <apex:outputLabel value="Position:">
    

      <apex:selectList size="1" value="{!SelectValue}">

            <apex:selectOptions value="{!statusOptions3}"/>
        </apex:selectList>
        </apex:outputLabel>
        </apex:pageBlockSection>
   <apex:pageBlockButtons id="contentLoading">

    <apex:commandButton value="Previous" action="{!enabletab1}" rerender="tabPanel" />
     <apex:commandButton value="Save" action="{!addemployeedetails}" />
     </apex:pageBlockButtons>
     
      </apex:pageBlock>
  </apex:tab>
</apex:tabPanel>
</apex:form>
</apex:page>



I am new to salesforce here is my apex code how to create an controller and insert this values
Hi,  
This is the request part of Webservice Api.
curl -v -u user@yourcompany.com:test -F "attachments[]=@/path/to/attachment1.ext" -F "attachments[]=@/path/to/attachment2.ext" -F "email=example@example.com" -F "subject=Title" -F "description=this is a sample" -X POST 'https://domain.test.com/api'
 I want to use this request in Apex class. How can i use it? Please suggest.  
Thanks,
Geeta Garg
I am running below SOQL in Developer Console and its working fine -
SELECT MSRE_Contact__r.name, MSRE_Contact__r.MSRE_Company__c, MSRE_Contact__r.MSRE_Contact_Title__c, MSRE_Investor__r.name, MSRE_Investor__r.Parent.Name, MSRE_Investment__c, MSRE_Investment__r.Product2.name, MSRE_Contact_Relationship__c, MSRE_Distribution__c, MSRE_Quarterly__c, MSRE_Legal__c, MSRE_Tax__c, Webcast__c, MSRE_Annual_Meeting__c, MSRE_Adv_Committee__c, CreatedDate, LastModifiedDate, lastModifiedBy.Name, IsDeleted FROM MSRE_Correspondence__c

Now same query if I am using in Apex calss below error coming -
System.SObjectException: SObject row was retrieved via SOQL without querying the requested field. Asset.Name

Here Product2 is lookup in Investment(Asset). Why its working in Developer Console and not in Apex? Any help would be appreciated.
Hi

We are new to the salesforce and we are implementing to integrate our app data to salesforce.And we are in confuse to work with SOAP API or REST API which is better because when we try to work with Rest API we are succesed in creating an Account, Lead but when we try to convert a lead to account but we failed.And also we read few post reagarding Rest Api saying that Rest Api doesnot support lead conversion is it right?
If it support lead conversion would you please let us know how to work on it using httpwebrequest.

And also let us know which Api is the best one to work with salesforce to integrate to our App.

Regards
Vinod