• Shrikant Bagal
  • SMARTIE
  • 836 Points
  • Member since 2014
  • Salesforce Developer


  • Chatter
    Feed
  • 27
    Best Answers
  • 1
    Likes Received
  • 2
    Likes Given
  • 6
    Questions
  • 264
    Replies
Hi,

I need to get list of user names and return a string like below

['first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth', 'tenth']



Thanks,
Vetri

 
public class StudentNew 
{
    public string name;
    public static decimal fee=10000;
    
    public void setData(string name)
    {
        this.name=name;
        fee=fee+1000;
    }
    
    public static getData(decimal fee)
    {
        fee=fee+5000;
    }
}

This generates error "Duplicate variable fee". bt if i change fee to another word in getData method it says constructor cannot have static (but it is not constructor is it). am i doing it wrong or if so correct me. Please reply
Hey Peeps!

I'm having an issue that I hope someone can help me with, concerning rendering a list of objects in a VF page.

I have a controller called Ticket, which contains a generic class:
public class Comment {
    Integer id {get; set;}
    String author {get; set;}
    String body {get; set;}
    String created {get; set;}
}
I have a list of these generic classes:
public List<Comment> comments {get {
    Comment [] cmt = this.fetchTicketComments(); 
    return cmt;
}set;}
The method fetchTicketComments calls another method:
private List<Comment> parseTicketComments(String json_string) {
	Comment [] ticket_comments = new List<Comment>();
	Map<String, Object> json_object = (Map<String, Object>) JSON.deserializeUntyped(json_string);
	List<Object> jira_ticket_comments = (List<Object>) json_object.get('comments');
	while (jira_ticket_comments.size() > 0) {
		Comment instance_comment = new Comment();
		Map<String, Object> cmt = (Map<String, Object>) jira_ticket_comments.get(0);
		Map<String, Object> author = (Map<String, Object>) cmt.get('author');
		instance_comment.id = Integer.valueOf(cmt.get('id'));
		instance_comment.author = String.valueOf(author.get('displayName'));
		instance_comment.body = String.valueOf(cmt.get('body'));
		instance_comment.created = Datetime.valueOf(String.valueOf(cmt.get('created')).replace('T', ' ')).format('M/d/y hh:mm a');
		
		ticket_comments.add(instance_comment);
		jira_ticket_comments.remove(0);
	}
	return ticket_comments;
}


Now to display this list of comments along with other data for a Ticket, I have this markup in my VF page:
<apex:pageBlockSection rendered="{!NOT is_new}" id="comment_detail" collapsible="true">
	<apex:repeat value="{!comments}" var="cmt">
		<apex:outputText >Comment:</apex:outputText>
 		<apex:inputTextarea cols="80" rows="4" value="{!cmt.body}" />
	</apex:repeat>
</apex:pageBlockSection>

The problem is that everytime I save, I get this error: 
Compilation error: Unknown property 'Ticket.Comment.body'

I'm confused because comments is a List of Comment objects, and a Comment object has a body property.

I'm fairly new to Apex, but not software development, so this is driving me nuts =)
I'm clearly missing some Java/Apex idiom here.

Thanks for any help.
Paul
Hi All,

Please can you help me with this. I want to Blacklist certain email domains so that users cannot create contacts with their personal email id. please can you help me on how this can be done.
Below are the listed email domains to blacklist how can we do this so that contact cant be created with the below (Email IDs)email domains.

@hotmail.com
@hotmail.co.uk
@outlook.com
@live.com
@aol.com
@gmail.com
@me.com
@yahoo.com
@ymail.co.uk

Many Thanksfor your help in advance.
Abraham
Program not shownig error, but when i am editing and saving the phone number in account object, the corresponding contacts otherphone number is not changing.  please help.
 
trigger updatecontacts on Account (before update) {
    
    map<id,account> m1=new map<id,account>();
    
    for(integer i=0;i<trigger.new.size();i++)
    {
        if(trigger.old[i].phone!=trigger.new[i].phone)
        {
           m1.put(trigger.old[i].id,trigger.new[i]);
        }
    }
    
    list<contact> cons=new list<contact>();
    for(contact c:[select id,accountid,otherphone from contact where id in:m1.keyset()])
    {
        account a1=m1.get(c.accountid);
        c.otherphone=a1.phone;
        cons.add(c);
    }
    
update cons;
}

 
i wote a apex class and test class.  no errors are showing. when i click on run test. then it is not working. please help
 
test class

@istest
public class testinsertaccount {

    testmethod static void mytest()
    {
        account acc=new account(name='jaddd');
        insert acc;
        integer a=[select count() from account];
    insertaccount i1=new insertaccount();
        i1.insert1();
        integer b=[select count() from account];
        system.assertequals(a,b);
    
    }
    
}





apex class:-

public class insertaccount {
    public account acc;
    public void insert1()
    {
        acc=new account(name='yugandhar',industry='banking');
        insert acc;
    }
    
    }

 
Hi all, 

We have a 3rd party app that moves all opportunities on a child account to the parent account every hour.  We do not want this to happen so I am trying to write an after update trigger that will move the opportunity back to the previous/child account.  I am running into trouble though with my code.  I am getting the following error: "Incompatible key type Opportunity for Map<Id,Opportunity>".  I am also getting the error "Variable o does not exist" -- I think one of my }s is off (both of these errors are happening on line 13).  Below is my code.  Can someone please look at it and figure out where I went wrong and shed some light on how to fix it? 

Thanks!


trigger SwitchBackAccount on Opportunity (after update) {
    
map<id,Opportunity> changeAcctId = new map<id,Opportunity>();
List<Opportunity> SROpps = new List<Opportunity>();
for(Opportunity o : trigger.new){
if(trigger.oldmap.get(o.id).AccountId != o.AccountId){
changeAcctId.put(o.id,o);
}
}    
List<Opportunity> opps = [select Id, AccountId from Opportunity where Id in :changeAcctId.keyset()];
if(opps <> NULL && changeAcctId.size() > 0){
for(Opportunity op : opps){
op.AccountId = changeAcctId.get(o).AccountId;    
opps.add(op);
}       
update SROpps;
}

}
Hi All,

I have written a small trigger which does not display the value from Line 6.

trigger TypeOfLienForNVOnProperty on Property__c (before insert, before update, after insert, after update) { 
    
    for(Property__c p : Trigger.new){
        if(p.Property_State__c != null && p.Property_State__c != '' && p.Property_State__c == 'NV'){
            system.debug('Value in State-->' + p.Property_State__c);
            system.debug('Value in Type of Loan-->' + p.Opportunity__r.Type_of_Loan__c);
            
            if(p.Opportunity__r.Type_of_Loan__c != null && p.Opportunity__r.Type_of_Loan__c != 'Principal & Interest'){
                system.debug('Value in Type of Loan-->' + p.Opportunity__r.Type_of_Loan__c);
                p.addError('For Nevada, only "Principal & Interest" is allowed as Type of Lien.');
            }
        }

Please help to let me know where I did wrong.
Hello,

I am trying to incorporate Multi-Select picklist in a VF page for a custom object.
Problem is Multi-Select is not showing all ~30 values. Instead it just displays 6-7 values.
How can I correct it??
Below is is VF page and related class.

VF Page...


<apex:page standardcontroller="Rules__c" extensions="addRules" tabStyle="Rules__c" sidebar="false" >
<apex:form >
<apex:pageblock id="theRuleRec" >
<apex:pageblocksection columns="1" id="thePagSec">
<apex:outputLabel value="Selection">
<apex:inputField value="{!rulRec.Selection__c}"/>
</apex:outputLabel>
<apex:pageBlockSectionitem >
<apex:outputLabel value="LOB Values">
<apex:inputField value="{!rulRec.Values_of_LOB__c}"/>
</apex:outputLabel>
</apex:pageBlockSectionitem>
<apex:pageBlockSectionitem >
<apex:outputLabel value="POI Value">
<apex:inputField value="{!rulRec.Values_of_POI__c}"/>
</apex:outputLabel>
</apex:pageBlockSectionitem>
<apex:outputlabel value="Destination">
<apex:inputField value="{!rulRec.Destination_Name__c}"/>
</apex:outputLabel> </apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save" />
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons> </apex:pageblock> <center>
<apex:outputText value="{!strMsg}" id="msg" style="color:#FF0000"/>
</center> <apex:pageblock id="theRuleLst" >
<apex:pageblockTable value="{!RuleRecords}" var="rule" rendered="{!if(editRec == true,false,true)}">
<apex:column >
<apex:inputCheckbox value="{!rule.Checkbox__c}" />
</apex:column> <apex:column value="{!rule.Id}" />
<apex:column value="{!rule.Selection__c}" />
<apex:column value="{!rule.Values_of_LOB__c}" />
<apex:column value="{!rule.Values_of_POI__c}" />
<apex:column value="{!rule.Destination_Name__c}" />
<apex:column value="{!rule.Rule_Updated__c}" />
<!-- <apex:column > <apex:commandButton value="Edit" action="{!editRulLst}"/>
</apex:column> -->
</apex:pageblockTable>
<apex:pageblockTable value="{!RuleRecords}" var="rule" rendered="{!if(editRec == true,true,false)}" id="theRuleLstEdit">
<apex:column >
<apex:inputCheckbox value="{!rule.Checkbox__c}" />
</apex:column> <apex:column value="{!rule.Id}" />
<apex:column headerValue="Selection" >
<apex:inputfield value="{!rule.Selection__c}"/>
</apex:column> <apex:column headerValue="POI Values" >
<apex:inputfield value="{!rule.Values_of_POI__c}"/>
</apex:column> <apex:column headerValue="LOB Values" >
<apex:inputField value="{!rule.Values_of_LOB__c}"/>
</apex:column> <apex:column headerValue="Destination Name" >
<apex:inputField value="{!rule.Destination_Name__c}"/>
</apex:column> </apex:pageblockTable>
<apex:pageBlockButtons >
<apex:commandButton value="Update" action="{!updateRulLst}" rerender="theRuleLst,thePagSec" rendered="{!if(editRec == true,true,false)}" disabled="{!if(RuleRecords.size = 0,true,false)}"/>
<apex:commandButton value="Edit" action="{!editRulLst}" rendered="{!if(editRec == false,true,false)}" id="theRuleRec" disabled="{!if(RuleRecords.size = 0,true,false)}"/>
<apex:commandButton value="Delete" action="{!deleteRulLst}" rerender="theRuleLst,thePagSec,msg" rendered="{!if(editRec == true,true,false)}" disabled="{!if(RuleRecords.size = 0,true,false)}"/>
<apex:commandButton value="Cancel" action="{!cancelLst}" rerender="theRuleLst,thePagSec" rendered="{!if(editRec == true,true,false)}"/> </apex:pageBlockButtons>
</apex:pageblock>
</apex:form>
</apex:page>

Apex Class...

<Very Long and useed only for Edit/Delete/Save>
<If needed, I wil post it>

Any help is appreciated.
Thanks in advance.
sir,  please solve this error.
 
simple test class for map. getting error at line 7 :  Variable is not visible: colors


@istest
public class apex2test {

    testmethod static void apex2test()
    {
        apex2 ap=new apex2();
        system.assertEquals(ap.colors.get('green'),'this is start signal');
    }
}





apex class:----------



public class apex2 {

   public map<string,string> colors;
    
    public apex2()
    {
        colors=new map<string,string>();
        
        colors.put('red','this is stop signal');
        colors.put('green','this is start signal');
        colors.put('yellow','thisis slowdown signal');
    
        system.debug('the data of red is: '+colors.get('red'));
        system.debug('the count of colors is: '+colors.size());
        
    }
        }

 
I am getting error at simple test class for map object.  At line 9:Variable is not visible: colors          please help me.
 
@istest

public class apex2test {

    @istest static void mytest()
    {
        apex2 ap=new apex2();
        
        system.assertequals(ap.colors.get('red'),'this is stop signal');
                            
    }
    
}






apex class:----------



public class apex2 {

    map<string,string> colors;
    
    public apex2()
    {
        colors=new map<string,string>();
        
        colors.put('red','this is stop signal');
        colors.put('green','this is start signal');
        colors.put('yellow','thisis slowdown signal');
    
        system.debug('the data of red is: '+colors.get('red'));
        system.debug('the count of colors is: '+colors.size());
        
    }
    
    
}

 
I edited my class and saved it successfully but when I accessed my page which uses the class, I get an error of
DML currently not allowed
An unexpected error has occurred. Your development organization has been notified.

controller
public class DefinitionController {

    public DefinitionController() {
            this.DefTable();
    }

  public void DefTable(){
    listplatforms = [select Name,Status__c from Platform__c];

      for(Platform__c idlistplatforms : [select Id from Platform__c]){
        List<Def__c> existplatforms = [select Platform__c from Def__c where Platform__c=:idlistplatforms.Id];

            if(existplatforms.size() > 0)
            {
                idlistplatforms.Status__c = 'Set';
                //update idlistplatforms;
                System.debug('Found'+ idlistplatforms);
            } 
            else 
            {
                idlistplatforms.Status__c = 'Not Set';
                //update idlistplatforms;
                System.debug('Not Found'+ idlistplatforms);
            }
            update idlistplatforms;
      }
  }
    
}
I think the problem is because of the update part. How do I overcome this error?

Thanks in advance !

 
I have a table and a controller
<apex:page sidebar="false" controller="DisplayStatus">
          <apex:pageBlock title="Gadget (Gadget__c)">
             <apex:pageBlockTable value="{!gadgetlist}" var="gadget">
                 <apex:column headerValue="Gadget" value="{!gadget.Name}"/>
                 <apex:column headerValue="Action">
                       <apex:outputlink>Edit</apex:outputlink>
                 </apex:column>
             </apex:pageBlockTable>
         </apex:pageBlock> 
</apex>
If I click Edit it will return the value of its corresponding row (gadget.Name) in a System.debug.
ex.

Gadget                     Action

Smartphone               Edit
Watch                       Edit
Camera                     Edit

If I click Edit in the 2nd row, I would return Smartphone in a System.Debug statement.
How could I do this?

 
Hi,

I am trying to create a page similar to this but the quicksave function is not working.  When i hit the save button it refreshes the page but the data is unchanged.  What is wrong with this code?
 
<apex:page StandardController="Opportunity" RecordSetVar="opp">
 <apex:form >
     <apex:commandbutton action="{!quicksave}" value="Save"/>
     <apex:pageblock mode="inlineedit">
         <apex:pageBlockTable value="{!opp}" var="o">
             <apex:column value="{!o.name}"/>
         </apex:pageBlockTable>
     
     </apex:pageblock>
 
 </apex:form>
 </apex:page>

 
Here is my code example:
global class ControllerGetNext { 

     webService static String GetNextProcess() {

           if(AllowedZone(strTimeZone) == true)
		        	{
		        		foundLead = true;
		        		strLead = lstLeadToAssign[i].Id;
		        	}

     }

     public boolean AllowedZone(string myZone)
    {
           //Some code
           return true;
     }
}
This code seems pretty straight forward.  I have a class and then I created a public function within that class.  I try to consume the function within another function of my class and I get the error about incorrect signature.

Can anyone help me with this?
 
Hello Helpers

I have a visual force page  with 2  tabs

On tab  1 I  have some components  like  grids  and customr button

I would like  to   switch automatically  from Tab 1  to Tab 2  when I press the custom button BUT ONLY AFTER  the apex controller method  associated to  custom buton Action has  completed

I tried  to use  oncomplete  to achieve this.  My problem is  that the tab  is switched but  it looks  like the operation  in DoSonethingatApexside  is not performed

     <apex:pageBlockButtons >
     <apex:commandButton action="{!DoSonethingatApexside}" value="Preview"            
     oncomplete="RichFaces.switchTab('{!$Component.theTabPanel}','{!$Component.tabPreview}','Preview')">
     </apex:commandButton> 
     </apex:pageBlockButtons> 


If  I remove the oncomplete  and press the custom button and switch tomTab 2  manually  all Are OK
I see in tab 2  the results  of the custom button action

any suggestions?


Thanks in adsvance
csbaa


  • June 26, 2015
  • Like
  • 0
Hello friends
 I have a requirement where I need to display under each account name its related contacts & opportunities in a single visual force page.
like as follows:

Accname:AxisBank
contact1:
oppor1:

Kindly let me know.
regards
sonali verma


 
I am trying to have a JavaScript function executed after the completion of a save method in my Apex controller using an apex:actionStatus tag, but I can't seem to be able to get it to work.  Here is the portion of the code I am working with that isn't working properly:

<apex:page showHeader="false" controller="AddCodesController">
    <script>

    function CloseWindow() {
        console.log('hey');
        window.opener.refreshParent();
        window.close()
    }
    </script>
    <apex:form id="addCodesForm">
        <apex:pageBlock title="Add Related Codes" id="myData">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save & Close" status="closer"/>
                <apex:commandButton value="Cancel" onclick="window.close()"/>   
                <apex:actionStatus startText="(Saving...)" stopText="" onStop="CloseWindow();" id="closer"/>
            </apex:pageBlockButtons>  
       </apex:pageBlock>
    </apex:form>
</apex:page


I put the console.log() in there just to see if it was firing, and I can't get it to show up.  I have searched and looked at probably 5 or 6 different examples and it seems like I have written this properly, but I can't for the life of me figure out what is going wrong.  Any help would be greatly appreciated it.
Hi friends
I admit I am novice to VF. 

For every account name I need to display related contacts & opportunities like this in a single visual force page.

UserName: krishna
---------------------------
accname: AxisBak
contact1:
contact2:
oppor1:
oppor2

accname:Airtel
Contact2:
contact3

Please let me know how this is achieved

Regards
krishna casukhela
P
Hello ,
         I create a webservice for consuming rest api from .net . I am facing issue in test class for this . It's gives error callout not allowed from test method. How to write test class for below controller.
 
public with sharing class WebserviceCall {

    public WebserviceCall(ApexPages.StandardController controller) {

    }

    public String message {get; set;}
    
    public PageReference getaccesstoken() { 
      string jsonstring ='userName=test@gmail.com&Password=123&grant_type=password';
        HttpRequest req = new HttpRequest();
        HttpResponse res = new HttpResponse();
        Http http = new Http();
       // req.setClientCertificateName('Client Certificate');
       
        req.setEndpoint('http://google.com');
        req.setMethod('POST');
       // req.setHeader('SOAPAction', 'Soap Action');
        //req.setHeader('Authorization','Auth Token');
      
       req.setBody(jsonstring);
 
           try {
            res = http.send(req);
            message = res.getBody();
    TokenInformation token = new TokenInformation();
    token =(TokenInformation)System.JSON.deserialize(message, TokenInformation.class);
  // JSONParser parser = JSON.createParser(res.getBody());
            System.debug(token.access_token);
                 //HttpServletResponse httpResponse = (HttpServletResponse)response;
              string s = token.access_token;
            string a1 = s.substring(0,255);
            string a2 = s.substring(255,510);
            string a3 =s.substring (510,s.length());
            //Here SessionData__c is custom setting used for store access_token
       SessionData__c objToken = new SessionData__c();
       objToken.Name ='token2';
       objToken.Id ='a0G28000000ENAI';
    objToken.Access_Token1__c =a1;objToken.Access_Token2__c =a2;
               objToken.Access_Token3__c =a3;

upsert objToken;
               
        } catch(System.CalloutException e) {
            System.debug('Callout error: '+ e);
             message = res.toString() + res.getBody();
            System.debug(res.toString());
        }
        return null;
        
}       
    
    
    
    
}

Hello Guys,


We are facing an issue with <lightning: map> component for Microsoft Edge Browser
- Map lightning component does not work in Edge, please check the following link (Open it in Microsoft Edge)

https://developer.salesforce.com/docs/component-library/bundle/lightning:map/example


it's showing generic map not spotted the exact marker on map (You can check error in Browser Console)

Hi All,

Nice to meet you..virtually!
I have been almost 2.5 years experience in SFDC. and I am looking for Part time freelancing work in cloud computing (SFDC) field and am reaching out to you to ask for your help with any leads or contacts.If you know of any opportunities or leads that you might be able to share with me, please send them my way.

Techical Profile Summary:

Certifications:
Certified Force.com Developer (DEV- 401)
Salesforce.com Certified Force.com Advanced Developer - Level 1 (DEV 501). - (Platform Developer - I)

Profile Summary:
Strong Implementation and Integration experience using Custom objects, Triggers,
workflows/ workflow rules, VisualForce Pages,​​and Apex classes,Salesforce
REST API, Web Services,Metadata API,​SOQL, SOSL​,Force.com Sites ​and
Communities,test Methods.


Contact Details:
1. Email : - srbagal.ceo@gmail.com
2. Skype : srbagal
3. Mobile:- +919960548267
Linkedin Profile : -  https://in.linkedin.com/in/srbagal

Thanks in advance for your help!

Thanks!
Shrikant
Hello Guys,

Q: Is it Possible to upload Large file with Chunks In Salesforce using Any think without Third Party Application Please.
- Any API
- REST API
- Javascript
- RemoteAction
- Any Other Option.

Thanks!
 

Hello Guys,

Q: Is it Possible to upload Large file with Chunks In Salesforce using Any think without Third Party Application Please.
- Any API
- REST API
- Javascript
- RemoteAction
- Any Other Option.

Thanks!
 

I have enabled the autocomplete lookup functionality for my Org but Its not working for my custom lookup.
Strange think is whenever I add one of Standard lookup field like "Owner" its start working for both Custom and Standard lookup.

Any one face same problem.

Thanks!
I am looking for creatve Idea which will helps to Salesforce users
I have enabled the autocomplete lookup functionality for my Org but Its not working for my custom lookup.
Strange think is whenever I add one of Standard lookup field like "Owner" its start working for both Custom and Standard lookup.

Any one face same problem.

Thanks!
For some reason this fails - q.QuoteLineItems is null. Can someone tell me why?
 
@isTest
private class QuoteTest {

   static Account A;
   static Opportunity o;
   static Quote q;
   static Product2 p;
   static PriceBookEntry pe;
   static OpportunityLineItem oli;
   static QuoteLineItem qli;

   static {
       a = new Account(name = 'Test account', Jurisdiction__c = 'Denmark', currencyIsoCode = 'DKK');
       insert a;

       o = new Opportunity(name = 'Test opportunity', AccountId = a.id, closeDate = date.today(), stageName = 'Demonstration Scheduled');
       insert o;

       p = new Product2(name = 'Test product', type__c = 'Subscription', limits__c='a;b\nc;d');
       insert p;

       Id pbId = Test.getStandardPricebookId();

       pe = new PriceBookEntry(PriceBook2Id = pbId, Product2Id = p.id, UnitPrice = 100, IsActive = true);
       insert pe;

       oli = new OpportunityLineItem(OpportunityId = o.id, Quantity = 1, PricebookEntryId = pe.id, totalPrice = 200);
       insert oli;

       q = new Quote(name = 'Test quote', OpportunityId = o.id, PriceBook2Id = pbId);
       insert q;

       qli = new QuoteLineItem(QuoteId = q.id, PriceBookentryId = pe.Id, Quantity = 1, UnitPrice = 1);
       insert qli; 
       System.debug(q);
       System.debug(qli);
       System.debug(q.QuoteLineItems);
   }

User-added image
public class sparedetails
{
    public Spare_Details__c sparedet{get;set;}
    public String sparedetail {get;set;}
    public String asparedetail {get;set;}
    public Boolean check{get;set;}
    public Boolean pcheck{get;set;}
    public Engineer_Checklist__c ec{get;set;}
    public List<sparts> ssList{get;set;}    
    
    public class sparts{
        public List<SelectOption> sdetail{get;set;}
        public List<selectOption> sdetaildep{get;set;}
        public integer qty{get;set;}
        public String aparts{get;set;}
        public sparts(){
            this.sdetail=sdetails();  // Here how to call, i have call this type error in "Invalid Field"
            this.sdetaildep=getasparedetails(); // Same as here
            this.qty=0;
            this.aparts='';
        }
    }
    
    public sparedetails(ApexPages.StandardController controller) {
    check=false;
    pcheck=false;
    //ec=[select id,Engineer__r.name from Engineer_Checklist__c where id=:apexpages.currentpage().getparameters().get('id')];
    //sparedet = [select aspareparts__c,qty__c,spareparts__c,sparepartsinp__c from Spare_Details__c where id=:apexpages.currentpage().getparameters().get('id')];
    ssList=new List<sparts>();
    }
    
    public PageReference addrow(){
             
        ssList.add(new sparts());
        return null;
    }
    public void removeRow(){
        Integer count=Integer.valueOf(apexpages.currentpage().getparameters().get('index'));
        ssList.remove(count);
    }
    
    public List<SelectOption> sdetails()
    {
        List<SelectOption> spd = new List<SelectOption>();
        
        spd.add(new SelectOption('None','--- None ---')); 
        spd.add(new SelectOption('sd','Smoke Detector')); 
        spd.add(new SelectOption('hd','Heat Detector')); 
        spd.add(new SelectOption('msd','Multi Sensor Detector')); 
        spd.add(new SelectOption('bs','Base')); 
        spd.add(new SelectOption('ss','Smoke Sounder')); 
        spd.add(new SelectOption('hs','Heat Sounder')); 
        spd.add(new SelectOption('bc','Breakglass Callpoint')); 
        spd.add(new SelectOption('tk','Test Keys')); 
        spd.add(new SelectOption('rg','Replacement Glass')); 
        spd.add(new SelectOption('bc','Breakglass Cover')); 
        spd.add(new SelectOption('es','Electronic Sounder')); 
        spd.add(new SelectOption('fb','Fire Bell')); 
        spd.add(new SelectOption('bec','Beacon')); 
        spd.add(new SelectOption('dr','Door Release')); 
        spd.add(new SelectOption('pc','Printer Consumables')); 
        spd.add(new SelectOption('slab','SLA Battery')); 
        spd.add(new SelectOption('nic','Nicad Hi-Temp Cells X'));
        spd.add(new SelectOption('anic','Additional Nicad Hi-Temp Cells X'));
        spd.add(new SelectOption('el','Emergency Lights'));
        spd.add(new SelectOption('ael','Additional Emergency Lights'));
        spd.add(new SelectOption('elt','EL Tube'));
        spd.add(new SelectOption('aelt','Additional EL Tube'));
        spd.add(new SelectOption('ftt','4,6,8FT Tube'));
        spd.add(new SelectOption('lbs','Log Book Supplied - Qty'));
        spd.add(new SelectOption('oth','Other'));        
        return spd;  
    } 
    
    public List<SelectOption> getasparedetails()
    {
        List<SelectOption> spdl = new List<SelectOption>();   
        
        if(sparedetail  == 'None'){
        check=false;
        }
         
        if(sparedetail  == 'sd' || sparedetail  == 'hd' || sparedetail  == 'ss' || sparedetail  == 'hs' || sparedetail  == 'es' || sparedetail  == 'bec'){
        
        pcheck=true;
        
            spdl.add(new SelectOption('at','ADT'));
            spdl.add(new SelectOption('ad','Apollo Discovery'));
            spdl.add(new SelectOption('as65','Apollo S65'));
            spdl.add(new SelectOption('ax95','Apollo XP95'));
            spdl.add(new SelectOption('aut','Autronica'));
            spdl.add(new SelectOption('ed','EDA'));
            spdl.add(new SelectOption('em','EMS'));
            spdl.add(new SelectOption('get','Gent'));
            spdl.add(new SelectOption('hoc','Hochiki'));
            spdl.add(new SelectOption('nitt','Nittan'));
            spdl.add(new SelectOption('not','Notifier'));
            spdl.add(new SelectOption('men','Menvier'));
            spdl.add(new SelectOption('pro','Protec'));
            spdl.add(new SelectOption('raf','Rafiki'));
            spdl.add(new SelectOption('sys','Systemsensor'));
            spdl.add(new SelectOption('zit','Ziton'));
            spdl.add(new SelectOption('oth','Other'));
        }        
        if(sparedetail  == 'msd'){
        }        
        if(sparedetail  == 'bs'){        
        pcheck=true;
            spdl.add(new SelectOption('db','Detector Base'));
            spdl.add(new SelectOption('dob','Diode Base'));
        }        
        if(sparedetail  == 'bc'){   
        pcheck=true;     
            spdl.add(new SelectOption('at','ADT'));
            spdl.add(new SelectOption('ad','Apollo Discovery'));
            spdl.add(new SelectOption('as65','Apollo S65'));
            spdl.add(new SelectOption('ax95','Apollo XP95'));
            spdl.add(new SelectOption('aut','Autronica'));
            spdl.add(new SelectOption('ed','EDA'));
            spdl.add(new SelectOption('em','EMS'));
            spdl.add(new SelectOption('get','Gent'));
            spdl.add(new SelectOption('hoc','Hochiki'));
            spdl.add(new SelectOption('nitt','Nittan'));
            spdl.add(new SelectOption('not','Notifier'));
            spdl.add(new SelectOption('men','Menvier'));
            spdl.add(new SelectOption('pro','Protec'));
            spdl.add(new SelectOption('raf','Rafiki'));
            spdl.add(new SelectOption('sys','Systemsensor'));
            spdl.add(new SelectOption('zit','Ziton'));
            spdl.add(new SelectOption('wp','Waterproof'));
            spdl.add(new SelectOption('oth','Other'));
        }        
        if(sparedetail  == 'tk' || sparedetail  == 'rg' || sparedetail  == 'bc' || sparedetail  == 'fb' || sparedetail  == 'dr' || sparedetail  == 'pc' || sparedetail  == 'ftt' || sparedetail  == 'lbs' || sparedetail  == 'oth'){
            check = true;
            pcheck=false;
        }        
        if(sparedetail  == 'slab'){
        pcheck=true;        
            spdl.add(new SelectOption('1.2a','12v 1.2Ah'));
            spdl.add(new SelectOption('12a','12v 12Ah'));
            spdl.add(new SelectOption('17a','12v 17Ah'));
            spdl.add(new SelectOption('2.1a','12v 2.1Ah'));
            spdl.add(new SelectOption('2.8a','12v 2.8Ah'));
            spdl.add(new SelectOption('24a','12v 24Ah'));
            spdl.add(new SelectOption('3.2a','12v 3.2Ah'));
            spdl.add(new SelectOption('7a','12v 7Ah'));
            spdl.add(new SelectOption('10a','6v 10Ah'));
            spdl.add(new SelectOption('ed','EDA'));
            spdl.add(new SelectOption('es','EMS'));
        }        
        if(sparedetail  == 'nic' || sparedetail  == 'anic'){     
        pcheck=true;   
            spdl.add(new SelectOption('1c','1 Cell'));
            spdl.add(new SelectOption('2c','2 Cell'));
            spdl.add(new SelectOption('3c','3 Cell'));
            spdl.add(new SelectOption('4c','4 Cell'));
            spdl.add(new SelectOption('5c','5 Cell'));
            spdl.add(new SelectOption('oth','Other'));
        }        
        if(sparedetail  == 'el' || sparedetail  == 'ael'){  
        pcheck=true;      
            spdl.add(new SelectOption('16w','16w 2D'));
            spdl.add(new SelectOption('28w','28w 2D'));
            spdl.add(new SelectOption('38w','38w 2D'));
            spdl.add(new SelectOption('2d','28w 2D c/w P/c'));
            spdl.add(new SelectOption('8w','8w Bulkhead'));
            spdl.add(new SelectOption('eb','Exit Box'));
            spdl.add(new SelectOption('ld','LED'));
            spdl.add(new SelectOption('ldb','LED Bulkhead'));
            spdl.add(new SelectOption('leb','LED Exit box'));
            spdl.add(new SelectOption('lgd','Legend'));
            spdl.add(new SelectOption('tb','Twinspot Beam'));
        }        
        if(sparedetail  == 'elt' || sparedetail  == 'aelt'){   
        pcheck=true;     
            spdl.add(new SelectOption('4w','4 Watt Tube rep.'));
            spdl.add(new SelectOption('6w','6 Watt Tube rep.'));
            spdl.add(new SelectOption('8w','8 Watt Tube rep.'));
            spdl.add(new SelectOption('2d','2D Lamp/Biax'));
        }    
          
        return spdl;
    }       
}


Here how to call my picklist method in wrapper class.
 
hi everyone...could u rectify the error.....
trigger conchangecity on Contact (after update) {
if(trigger.isafter){
if(trigger.isupdate){
set<id>conids=new set<id>();
list<account> acclst=new list<account>();
for(contact con:trigger.new){
if(con.mailingcity!=trigger.oldmap.get(con.accountid).mailingcity && con.mailingcity!=null)
conids.add(con.accountid);
}
contact con=new contact();
for(account acc:[select id,billingcity from account where id in:conids]){
acc.billingcity=trigger.newmap.get(con.accountid).mailingcity;
acclst.add(acc);
}
update acclst;
}
}

}

thanks inadvance...
Hi this is my wrapper class.
Here i am getting the error like : Unknown property 'WrapperClassProcessSelectedclass.Wrapperclass.name'
please help me.
public class WrapperClassProcessSelectedclass {

   public list<Wrapperclass> Wrapperactlst1 {get; set;}
    public list<account> Selectedaccounts {get; set;}
    
    public WrapperClassProcessSelectedclass (){
            Wrapperactlst1  = new list<Wrapperclass>();
            
            for(account acc : [select id, name, billingcity, phone from account ])
            Wrapperactlst1.add(new wrapperclass(acc));
            
     }
        public void process (){
        Selectedaccounts  = new list<account>();
            for(Wrapperclass wra : Wrapperactlst1 ){
                if(wra.isselected == true)
                Selectedaccounts.add(wra.acc);
            }
        }
    public class Wrapperclass {
        public account acc {get; set;}
        public boolean isselected {get;set;}
        public Wrapperclass(account   a){
            acc =  a;
            isselected = false;
        }
          }
 
}

Thanks and regards,
Anji reddy
I have environment hub enabled for my org.
But environment hub tab is missing from the tab list.
My profile is set to system admin...
Any info on this would be helpful !!! Thank you :)
Hi all
 
I have created a VF page where using two pageblock table on same object.requirment is i will be enter value in 1st page block table.and in second page block i will be created multiple record and when i am going to save its showing error...

Visualforce ErrorHelp for this Page
System.NullPointerException: Attempt to de-reference a null object
Error is in expression '{!save_close}' in component <apex:commandButton> in page newbankbook: Class.addrowCon.save_close: line 45, column 1
Class.addrowCon.save_close: line 45, column 1

 
<apex:page standardController="BankBook__c" extensions="addrowCon">
<apex:define name="body">
            
            <div style="width:900px;margin: 10px auto 10px auto;background-color:Gray;">
             <apex:image id="theImage" value="{!$Resource.Emami}" width="100" height="100"/>
             <apex:outputLink style="font-weight: bold;float:right;" value="{!URLFOR($Page.LoginPage)}"><b>Back To Home</b></apex:outputLink> 
<apex:form >

   <apex:pageBlock title="New BankBook Entry:" >
    
        
      
       <Div align="right">
             <apex:inputText value="{!num}" style="width:45px"/>
             <apex:commandButton value="Add rows" action="{!add_rows}"/> 
       </Div>
       <br/>
       <div style="width:400px;">
       <apex:pageBlockTable value="{!accts1}" var="a1" id="table1">
          
          <apex:column headerValue="Date" style="background:gray;"  >
    <apex:inputField value="{!a1.Txn_Date__c}"/>
</apex:column>
 <apex:column headerValue="Payment Type" style="background:gray;">
    <apex:inputField value="{!a1.Credit_Debit__c}"/>
</apex:column>
 <apex:column headerValue="Company Account" style="background:gray;">
    <apex:inputField value="{!a1.Related_Bank_Acc__c}"/>
</apex:column>
      
       </apex:pageBlockTable>
       
       
        </div>
      
       
      <apex:pageBlockTable value="{!accts}" var="a" id="table">
         <apex:column headerValue="Master Code" style="background:gray;">
            <apex:inputField value="{!a.Entries_Code__c}"/>
         </apex:column>
         <apex:column headerValue="Master Name" style="background:gray;">
            <apex:inputField value="{!a.Debtor_Name__c}"/>
         </apex:column>
         <apex:column headerValue="Amount" style="background:gray;">
            <apex:inputField value="{!a.Amount__c}"/>
         </apex:column>
        
         <apex:column headerValue="Narration" style="background:gray;">
            <apex:inputField value="{!a.Narration__c}"/>
         </apex:column>
         
        <apex:column headerValue="">
            <apex:commandButton value="Enter" action="{!addRows}" rerender="wtable" style="background:pink" >
         <apex:param name="addCount" value="1" assignTo="{!addCount}"/> 
      </apex:commandButton>
         </apex:column>
       </apex:pageBlockTable>
        <apex:commandButton value="Save" action="{!save_close}" rerender="error"/>
   </apex:pageBlock>
    </apex:form>
    </div>
        </apex:define>
</apex:page>
 
public class addrowCon
{ 
    public addrowCon(ApexPages.StandardController controller) 
    
    
    {
   accts = new List<BankBook__c >(); 
     accts.add(new BankBook__c ()); 
     accts1 = new List<BankBook__c >(); 
     accts1.add(new BankBook__c ());  

    }


  public integer num { get; set; }
  public List<BankBook__c > combinedList {get; set;}
  public List<BankBook__c > accts {get; set;}
  public List<BankBook__c > accts1 {get; set;} 
  public static Integer addCount {get; set;}
  private Integer nextIdent=1;
 
   public PageReference add_rows() {
    for(integer i=0;i<num ;i++)
        {
          accts.add(new BankBook__c ());    
        }
        
        return null;
     }
 public void addRows()
 {
  for (Integer idx=0; idx<addCount; idx++)
  {
   accts.add(new BankBook__c());
  }
 }    
     
     
     
     
     
  public PageReference save_close()
  {       
        
  insert combinedList;
        
     PageReference home = new PageReference('/home/home.jsp');
     home.setRedirect(true);
     return home;
  }
}

User-added image
Hi all,

We are using Qualaroo to collect feedback from clients in our application. These responses come through to a custom object in Salesforce.

Along with the response, we get the email address of the client (which is a unique identifier).

When a new response is added, we need a trigger that searches contacts based on the email, and then updates the lookup relationship with that contact.

As this will be the first piece of apex that's we will be using, we will also require help to deploy it.

Is anyone able to help?

Regards,
Elliott
Hi All,

I have the below trigger which when few field update happens to contact record it sends a webservice callout. Now i want it to send a webservice call out even when the contact is created in salesforce, can anyone please help me in modying this trigger such that it sends callout after record is newly created in salesforce also and not only on updation like it is currently doing. It should send callout during both update and create actions. Thanks!!
 
trigger Contactcallout on Contact (after update) {
Map<Id, String> m = new Map<Id, String>();
list<Contact> validContacts = new list<Contact>();
set<ID> accIds = new set<ID>();
for (contact c : Trigger.new) {
    if(c.RecordTypeId == '012D0000000BaFA'){
        contact old = Trigger.oldMap.get(c.Id);
         if (c.Email != old.Email||c.FirstName!=old.FirstName||c.LastName!=old.LastName||c.phone!=old.phone||c.Title__c!=old.Title__c||c.status__c!=old.status__c||c.AccountID!=old.AccountID)
         {
             validContacts.add(c);
                accIds.add(c.accountid);
         }
     }
}
map<ID, Account> accMap;
if(!accIds.IsEmpty()) // guard condition for SOQL
    accMap = new map<ID, Account>([select name from account where id in :accIds]);

for (contact c : validContacts) {
    Account acc = accMap.get(c.AccountID);
    string accName = acc == null ? null : acc.Name;
    WebServiceCallout.sendNotification(c.Id,c.Email,c.FirstName,c.LastName,c.phone,c.Title__c,accName,c.status__c);
            
    
    }
}

Many thanks in advance
Abraham
Hello All,
 
 I would like to get a sample code to identify "How many times a Visual force page has been opened / hit " by the user.
 Please guide me with the code (Visualforce remoting way / apex:variable way / best possible solution) which we can propose to customer.
 
Thanks !

 
Hi Friends

How to overcome /increase the text field type size in custom setting..
Hi Team,

My project size is 6 MB and I am using salesforce Enterprice edition. I am getting this error when I am trying to upload my existing html project as
static resource ,"static resource cannot exceed 5MB".I think we can upload 10 MB at a time. Let me know what is the problem?
Hi,

I need to get list of user names and return a string like below

['first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth', 'tenth']



Thanks,
Vetri

 
when ever parent picklist chages automatically child picklist values should be chage
ex: my parent picklist 1,2,3,4
     child picklist values 1a,1b,2a,2b....like that
   
i wrote a trigger that, ownername should be come at representative__C field.  ownerid is displaying but firstname or lastname or alias is not coming. please help.
trigger usernametorepresentative1 on employee__c (before insert,before update) {
    
 for(employee__C e1:trigger.new)
 {
    e1.representative__c=e1.owner.alias;
     //     e1.representative__c=e1.ownerid;   //  this is coming.
     //         e1.representative__c=e1.owner.lastname;
     //             e1.representative__c=e1.owner.firstname;


 }
}

 
Error
-----------

Visualforce Error
Help for this Page

System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Related Bank Acc]: [Related Bank Acc]
Error is in expression '{!save}' in component <apex:commandButton> in page add: Class.ManageListController1.save: line 60, column 1

Class.ManageListController1.save: line 60, column 1


 
<apex:page tabstyle="Account" showHeader="false" sidebar="false" Controller="ManageListController1">

<apex:define name="body">
            
            <div style="width:900px;margin: 10px auto 10px auto;background-color:Gray;">
             <apex:image id="theImage" value="{!$Resource.Emami}" width="100" height="100"/>
             <apex:outputLink style="font-weight: bold;float:right;" value="{!URLFOR($Page.LoginPage)}"><b>Back To Home</b></apex:outputLink> 
 <apex:form >
 <style> .headerRow .headerStyle{background-color:#638658;color:#FFFFFF} </style>

   <apex:pageBlock title="Bank Book Entry:">
      
       <div style="width:200px;align=Right;">
      <apex:pageBlockTable value="{!wrappers1}" var="wrapper1" id="wtable1">
      <apex:column headerValue="Date" style="background:gray;" headerClass="headerStyle" >
    <apex:inputField value="{!wrapper1.acc.Txn_Date__c}"/>
</apex:column>
 <apex:column headerValue="Payment Type" style="background:gray;">
    <apex:inputField value="{!wrapper1.acc.Credit_Debit__c}"/>
</apex:column>

<apex:column headerValue="Company Account" style="background:gray;">
    <apex:inputField value="{!wrapper1.acc.Related_Bank_Acc__c}"/>
</apex:column>
         
      </apex:pageBlockTable>
      
          </div>
   <div style="width:500px;margin: 10px auto 10px auto;">
   
      <apex:pageBlockTable value="{!wrappers}" var="wrapper" id="wtable">
      
         
       
         <apex:column headerValue="Ident" style="background:gray;">
            <apex:outputText value="{!wrapper.ident}"/>
         </apex:column>
         <apex:column headerValue="Master Code" style="background:gray;">
            <apex:inputField value="{!wrapper.acc.Entries_Code__c}"/>
         </apex:column>
         <apex:column headerValue="Amount" style="background:gray;">
            <apex:inputField value="{!wrapper.acc.Amount__c}"/>
         </apex:column>
         <apex:column headerValue="Narration" style="background:gray;">
            <apex:inputField value="{!wrapper.acc.Narration__c}"/>
         </apex:column>
          
       <apex:column headerValue="">
            <apex:commandButton value="Enter" action="{!addRows}" rerender="wtable" style="background:pink" >
         <apex:param name="addCount" value="1" assignTo="{!addCount}"/> 
      </apex:commandButton>
         </apex:column>
       
         <apex:column headerValue="Action">
            <apex:commandButton value="Delete" action="{!delWrapper}" rerender="wtable" style="background:Red">
               <apex:param name="toDelIdent" value="{!wrapper.ident}" assignTo="{!toDelIdent}"/> 
            </apex:commandButton>
         </apex:column>
         
      </apex:pageBlockTable>
     </div>
        
        
      <apex:commandButton value="Add 5 Rows" action="{!addRows}" rerender="wtable" style="width:100px;margin: 10px auto 10px auto;">
         <apex:param name="addCount" value="5" assignTo="{!addCount}"/> 
      </apex:commandButton>
      
      <apex:commandButton value="Save" action="{!save}" style="width:100px;margin: 10px auto 10px auto;"/>
   
    
     </apex:pageBlock>
 </apex:form>
  </div>
        </apex:define>
</apex:page>
public class ManageListController1 
{

    
    public ManageListController1(ApexPages.StandardController controller) {

    }

 public List<AccountWrapper> wrappers {get; set;}
  public List<AccountWrapper> wrappers1 {get; set;}
 public static Integer toDelIdent {get; set;}
 public static Integer addCount {get; set;}
 private Integer nextIdent=0;
  
 public ManageListController1()
 {
  wrappers=new List<AccountWrapper>();
  Wrappers1=new List<AccountWrapper>();
  for (Integer idx=0; idx<1; idx++)
  {
   wrappers.add(new AccountWrapper(nextIdent++));
    wrappers1.add(new AccountWrapper(nextIdent++));
   
  }
 }
  
 public void delWrapper()
 {
  Integer toDelPos=-1;
  for (Integer idx=0; idx<wrappers.size(); idx++)
  {
   if (wrappers[idx].ident==toDelIdent)
   {
    toDelPos=idx;
   }
  }
   
  if (-1!=toDelPos)
  {
   wrappers.remove(toDelPos);
  }
 }
  
 public void addRows()
 {
  for (Integer idx=0; idx<addCount; idx++)
  {
   wrappers.add(new AccountWrapper(nextIdent++));
  }
 }
  
 public PageReference save()
 {
  List<BankBook__c> accs=new List<BankBook__c>();
 
  for (AccountWrapper wrap : wrappers)
  {
   accs.add(wrap.acc);
  }
 insert accs;
  
   
  return new PageReference('/' + Schema.getGlobalDescribe().get('BankBook__c').getDescribe().getKeyPrefix() + '/o');
 }
 
 public pageReference parentPage () {

          return new pageReference('/apex/Receivables');
} 
  
  
  
 public class AccountWrapper
 {
  public BankBook__c acc {get; private set;}
  public Integer ident {get; private set;}
   
  public AccountWrapper(Integer inIdent)
  {
   ident=inIdent;
   acc=new BankBook__c();
  }
 }
}


 
Hi, 
Iam trying to create an app with soap or rest api (a third party app for salesforce integration), I came to know that the API access is there for Professional and above versions..I got this point.

But if I build the app and then releases will the clients having group and contact versions able to use my app? as my app mainly needs the api access?

quick help is highly appreciated..thanks 
My first AppExchange App:

Salesforce Bulk Object Field Creator app easily imports objects fields from CSV or XLS or XLSX file to Salesforce. It will help Salesforce Administrators and Developers to create upto 500 fields of 16 different field types in single go.


Bulk Object Field Creator

Below is the URL for AppExchange:
https://appexchange.salesforce.com/listingDetail?listingId=a0N30000000qDqqEAE
 
Kindly share your feedback and suggestions for further advancements.

 
Regards
Mohit Bansal
Mobile:+91 995-317-0767
E-Mail: mishu67777@gmail.com