• miku1051
  • NEWBIE
  • 30 Points
  • Member since 2011

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 24
    Questions
  • 30
    Replies
I want to show opportunity fields on Force.com and also update an opportunity from force.com sites..

When i am using apex:input fields the fields are not showing in input mode.When i use inputtext it works.My problem is about date fields it comes as a inputtext and dateselector doesn't come.

Now i also want to update the opportunity record.I have found that we can't update standard object.I have found one link where it says if you use without sharing then you can update. Workarounds for Sites page to update standard object?

But i am not able to do it.Please help in this.Its really very urgent for me.

VF page

<apex:page controller="oppDetailUsersCntlr"  showHeader="false" cache="false" >
<apex:form >
<apex:sectionHeader title="Opportunity" subtitle="Detail"/>
<apex:pageBlock mode="inlineEdit" rendered="{!editSection}">
     <apex:pageBlockButtons >
         <apex:commandButton value="Save" id="saveButton" action="{!saveOpp}"/>
         <apex:commandButton value="Edit" id="editButton" action="{!editOpp}"/>
     </apex:pageBlockButtons>
     <apex:pageBlockSection columns="2">
         <apex:inputText value="{!opp.name}"/>
         <apex:inputField value="{!opp.closedate}"/>
         <apex:outputField value="{!opp.accountid}"/>
         <apex:inputText value="{!opp.Probability}"/>
      </apex:pageBlockSection> 
</apex:pageblock>
</apex:page>


Controller

public void saveOpp()
{
editSection=false;
saveSection=true;

Opportunity o=new opportunity(id=id);
o.Probability=opp.Probability;
update o;
System.debug('==============oooooooo============'+o);

}



Hi i want to open a popup window using jquery after clicking on more button..

Jqyery more/less link in pageblock table

<script src="https://code.jquery.com/jquery-1.8.2.js" type="text/javascript"></script>
<title>jQuery Add More/Less link to Text</title>
<script type="text/javascript">
$(function() {
var showChar = 120, showtxt = "more", hidetxt = "less";
$('.sfdc_richtext').each(function() {
var content = $(this).text();
if (content.length > showChar) {
var con = content.substr(0, showChar);
var hcon = content.substr(showChar, content.length - showChar);
var txt= con +  '<span class="dots">...</span><span class="morecontent"><span>' + hcon + '</span>&nbsp;&nbsp;<a href="" class="moretxt">' + showtxt + '</a></span>';
$(this).html(txt);
}
});
$(".moretxt").click(function() {
if ($(this).hasClass("sfdc_richtext")) {
$(this).removeClass("sfdc_richtext");
$(this).text(showtxt);
} else {
$(this).addClass("sfdc_richtext");
$(this).text(hidetxt);
}
$(this).parent().prev().toggle();
$(this).prev().toggle();
return false;
});

});
</script>



Using this jquery code i am able to show the more/less link in which characters are more than 120.Now i want to open a VF window pop when anyone clicks on that more link.I am new to query please help.Also i need to pass a id to that VF page window popup when anyone clicks on more link.

enter image description here

above is the page block table and more link in image.

<apex:pageBlockTable value="{!salesFaqList}" var="faq" id="pbTable" rendered="{!showData}">

                  <apex:column value="{!faq.FAQ_Categories__c}" width="190px" style="height:50px"/>

      <apex:column value="{!faq.Answer__c}" />
</apex:pageBlockTable >



Answer is the last field in page block table.I want to open a VF pop up window on click of that link and also pass ID in URL of that page.Please help

I have a picklist field Status on account.There are 3 values One,Two,Other.

IF Other is selected i need a text field to show so that user can enter some information.I know thats not possible on standard layout.

Is it possible i can make that text field non-editable if Other value is selected..?

Can someone suggest me a possible workaround for this.??

Thanks

Can we do this for an existing third party application or do we need any customization needed to the third party app to make it canvas ready...

Please help...its urgent..

I need to create a webhook for salesforce in data insertion from external system(chargebee) for every event that occurs in chargebee that will hit the webhook URL to send notification in salesforce. any idea how to start on it...

I am getting Cross-site Scripting (XSS) while scanning in force.com scanner.if i remove javascript there is no error..what to change in javascript code..please help its quite urgent...may be encode something...

Class

 accid=ApexPages.currentPage().getParameters().get('accid');
    public meetingCtlr1(ApexPages.StandardController controller) 
    {
      conRecList=[Select id,name,email from contact where Accountid=:accid];
    }

conRecList on VF page

I have used this in javascript on VF page
<script>
    for(var i=0;i<{!conRecList.size};i++)
    var id='thePage:theform:thePB:conTable:'+i+':'+checkboxid;
    document.getElementById(id).checked=bool; 
</script>  

i want to insert an event record...but like i have more than 1 lead..i want to insert more than 1 leads as an invitee...

Like using whoid we can insert 1 record ... Using the standard interface we can click on add to inviteesbutton and add multiple invitees..How to add multiple using code so that it shows below on salesforce events...any help will be appreciated...

 

Event e= new Event();
e.Subject='Call';
e.ownerid=userinfo.getuserid();
e.StartDateTime=datetime.now().adddays(5);
e.EndDateTime=datetime.now().adddays(5);
e.WhatId=recid;
**//e.WhoId=**
insert e;
Map<String, Schema.SObjectField> fieldMap = leadSchema.getDescribe().fields.getMap();
Opportunity opp=[Select id,name,accountId from Opportunity];
 Map<String,string> valueMap=new Map<String,String>();

    for(opportunity o:opp)
           {
                for(String fieldName: fieldMap.keySet())
                {
                    **valueMap.put(fieldName,o);**
                }

           }

 I want to create a map of apiname and value pair..please help... 

i want record value...like if apiname of opportunity field is name..then i want record value..ie opportunity name...

VF Page component class Not getting value of soID.query works if i pass hard coded ID.Please someone tell me where i am wrong..**The constructor gets called first, before any variables are set. I dont know how to do this...

 

 

public with sharing class saleslinecntlr {
public string soID{get;set;}
List<Sales_Order_Line__c> saOrderLin;
public saleslinecntlr ()
{
System.debug('---------'+soID);
    saOrderLin=[Select id,name,Product__r.Name,Serial_Number__c,Quantity__c,Sale_Price__c,Total__c
                                             from Sales_Order_Line__c where salesorderid=:**soID** order by name];


}
    public List<Sales_Order_Line__c> getsaOrderLin() {
    return saOrderLin;
}

}

 

I have a Visualforce page with a lookup. When looked up, the result can be selected but the window does not close, forcing it to press the "Close Window"(cross window) button. I am using internet explorer 9. its working fine on IE 8 but not on IE 9.I am trying to solve this issue from last 2 days.i need urgent help.is it possible to run in compatability mode in IE9..please help...

Any suggestions?

Thanks in advance.

My scenario:

When i insert opportunity line-item on Parent Opportunity...opportunity line-item are also created on child opportunity(same as line-item on Opportunity).If there are 2 child opportunities then same opportunity line-items records will be created on both the child opportunity.

My problem is i have a button on opportunity when clicked on that a VF page opens and shows opportunity line-item records(editable) of parent opportunity.if i update any line-item record of parent opportunity then the child-opportunity line-item record should also be updated on all the child opportunities

As IDS of both opportunity line items records are different on child and parent opportunity. How to update child opportunity(opportunity line-item record) id parent opportunity opportunity line-item records are updated.

I am slightly confused..how should i do this..

I am able to able update the parent opportunity (opportunity line-item records). But how to update child-opportunity opportunity line-item records. Also I am able to get the ids of child opportunity opportunity line-item records.I dont know how to use them...Please help...

<apex:commandlink action="{!removeline}" onclick="if(confirm('Are you sure?')) "   reRender="thePB" target="_top" > <img src="{!$Resource.Red_Cross}" alt="Remove" title="Remove" />
<apex:param name="deleteid" value="{!op.Id}" assignTo="{!deleteid}"/>
</apex:commandlink >

 

I have cross image in front of every record.on click of that i am sending id to the controller.but the problem is when i click on cross 2 records and then click on delete button only 1 record is deleted.Can anyone suggest me how to save ids(more than 1 record) in controller and delete records on delete click.I am learning salesforce

//inside<apex:repeat>
<a href="javascript&colon;;" onclick="if(confirm('Are you sure?')){remove2('{!oplist.lineNumber1}');}">

 

<apex:actionFunction name="remove2" action="{!removeoppline2}" reRender="thePB">
                      <apex:param name="name" value="rono" assignTo="{!proname}"/>
                 </apex:actionFunction>

 I also want to send record id like {!oplist.opplineNo.id} on remove image click..how can i send both line number and recordid simontaneously....pl help me with it

on button click on opportunity... i am showing opportunityline items records on a page with line number using repeat.

I have used wrapper class for showing line number.

My Problem

opportunityline items fields are editable on page..so user can update them...i am having problem updating it...how to specify id for updating...

 

in Constructor

List<OpportunityLineItem> oli;
oli=[Select Id,opportunityId From OpportunityLineItem where opportunityId=:id];
showsavedoppLineitems();

 

 wrapper class

public list<linenumberclass> wrapperopllist;//List used in repeat on page
public Class linenumberclass
{
    public integer lineNumber{get;set;}
    public OpportunityLineItem oppLineNo{get;set;}
    

   
     public linenumberclass(OpportunityLineItem oppLineNo,Integer lineNumber)
    {
        this.oppLineNo=oppLineNo;
        this.lineNumber=lineNumber;
    }

}

 method called from constructor

public void showsavedoppLineitems()
{   
    
 List<OpportunityLineItem> lOpp=[select id,Business_Type__c,pricebookentry.pricebook2id,pricebookentryid from OpportunityLineItem where id in:opplineIttems]; 
   for(OpportunityLineItem l:lOpp)
    {    
         opline = new OpportunityLineItem ();
         opline.OpportunityId=id;
         opline.pricebookentry=pre.get(l.pricebookentryid);
         opline.pricebookentryid=l.pricebookentryid;
         opline.Territory1__c=l.Territory1__c;
         wrapperopllist.add(new linenumberclass(opline,m));
          m++;
    }
}

 

i am calling this method on button click...so i have the updated record value in oplist...

 

public list<OpportunityLineItem > opllist{get;set;}

 



public void add{ for(linenumberclass ln:wrapperopllist) { opline = new OpportunityLineItem (); opline.opportunityid=id; opline.PricebookEntry=ln.oppLineNo.pricebookentry; opline.PricebookEntryid=ln.oppLineNo.pricebookentryid; opline.Line__c=ln.linenumber; opllist.add(opline); } }

i dont know how to update oplist.... 

 

 

As i am showing the records in editable mode...if any user edits them and click on them records should be updated .

i dont know how to update existing records.i dont how to pass id.

please help me out this...thanks

 

Which developer tool can be used to create a data model 
Select two options

A.Force.com IDE
B.Force.com Data Loader
C.Application Set -up Menu
D.API


I got this Question in one of the mock exam sites...I am confused in this Question.Please help me with this..

public with sharing class createmassleadcntr {
public Lead ld{get;set;}
public Lead ld1{get;set;}
public list<Lead> listld=new list<lead> ();
public boolean perinfo{get;set;}
public boolean sav{get;set;}
    public createmassleadcntr(ApexPages.StandardController controller)
    {
        perinfo=false;
        ld=new Lead();
        ld1=new Lead();
        sav=false;
    }

public void add()
{
        sav=true;
        system.debug('------'+ld);
        if(ld.lastname==null)
        {
            perinfo=true;
        }
 
        else
        {
          
            ld.Company=ld1.Company;
            ld.Phone=ld1.Phone;
            ld.street=ld1.street;
            ld.LeadSource=ld1.LeadSource;
            listld.add(ld);
            ld=new Lead();
            
        }
       
}
public void save()
{
    sav=false;
    if(ld.lastname!=null && ld.Company!=null)
    {
        ld.Company=ld1.Company;
        ld.Phone=ld1.Phone;
        ld.street=ld1.street;
        ld.LeadSource=ld1.LeadSource;
        listld.add(ld);
    }
        upsert listld;
        ld=new Lead();
        ld1=new Lead();
        perinfo=false;
}

 can some pl help me with test class...i am not able to cover ...pl help///

public with sharing class createmassleadcntr {
public Lead ld{get;set;}
public Lead ld1{get;set;}
public list<Lead> listld=new list<lead> ();
public boolean perinfo{get;set;}
public boolean sav{get;set;}
    public createmassleadcntr(ApexPages.StandardController controller)
    {
        perinfo=false;
        ld=new Lead();
        ld1=new Lead();
        sav=false;
    }

public void add()
{
        sav=true;
        system.debug('------'+ld);
        if(ld.lastname==null)
        {
            perinfo=true;
        }
 
        else
        {
          
            ld.Company=ld1.Company;
            ld.Phone=ld1.Phone;
            ld.street=ld1.street;
            ld.LeadSource=ld1.LeadSource;
            listld.add(ld);
            ld=new Lead();
            
        }
       
}
public void save()
{
    sav=false;
    if(ld.lastname!=null && ld.Company!=null)
    {
        ld.Company=ld1.Company;
        ld.Phone=ld1.Phone;
        ld.street=ld1.street;
        ld.LeadSource=ld1.LeadSource;
        listld.add(ld);
    }
        upsert listld;
        ld=new Lead();
        ld1=new Lead();
        perinfo=false;
}

 Please help me the test class....???

trigger test on Lead (after insert) 
{
	try
	{
		Set<String> setEmails = new Set<String>();
		Map<String, Contact> mapCons = new Map<String, Contact>();
		List<Contact> lstContact = new List<Contact>();
		
		List<Contact> lstCont = [Select Id, Name , Email_2__c from Contact where Email_2__c in : setEmails];
		for(Contact objC : lstCont)
		{
			mapCons.put(objC.Email_2__c, objC);
		}
		for(Lead ld : Trigger.new)
		{
			if(mapCons.containsKey(ld.Email))
			{
			//Contact exist in system show error.
			ld.addError('Contact exist in System with email address '+ ld.Email);
			}else
			{
					Contact objC= new Contact();
					objC.FirstName=ld.FirstName;
					objC.LastName=ld.LastName;
					objC.RecordTypeName__c='Candidates';
					lstContact.add(objC);
			}
		}
			
			if(lstContact.size() > 0 )
			insert lstContact;
	}catch(Exception ex)
	{
		Trigger.new[0].adderror('Error ----'+ ex.getMessage());
	}	
}

 can someone help me with the test class of the above class....thanks....

trigger test1 on Lead (after insert)
{
    
     Set<ID> ls = new Set<ID> ();
     for(Lead l:Trigger.new)
    {
        ls.add(l.id);  
    }
    
    List<Lead> lis=[Select Id,Name, Status,Email,Company,fax,from Lead where id in:ls];
       List<Contact> con=[Select Id,Name ,Email_2__c,fax from Contact ];
       List<Contact> lstContact = new List<Contact>();

          
       
   
       for(Lead ld:lis)
       {
           for(Contact cn:con)
           {
              
                   
                   Contact objC= new Contact();    
                objC.FirstName=ld.FirstName;
                objC.LastName=ld.LastName;
                lstContact.add(objC);
 
           }    
               customobj.lookupfield=objC.Id;//Here i am getting nothing ie id is null here...can u pl help        }
           
           if(lstContact.size() > 0 )
        insert lstContact;
      
                   
}

 

i am getting nothing ie id is null here...can u pl help..i want to get the recently created id there..did you understand what i am asking for...thanks for replying....:)

 how  to reference contact id of the record which is inserted when the lead is created....

I have a picklist field Status on account.There are 3 values One,Two,Other.

IF Other is selected i need a text field to show so that user can enter some information.I know thats not possible on standard layout.

Is it possible i can make that text field non-editable if Other value is selected..?

Can someone suggest me a possible workaround for this.??

Thanks

I am inserting events and inserting multiple invitees(Lead/Contacts) to event using EventRelation.

EventRealtion er = new EventRelation(EventId = '00UD0000005zijH', 
RelationId = '003D000000Q8adV');
insert er;

problem is when i add invitees using event relation...they dont associate it with lead/contact as event in activity history..they only associate when i put whoid in that event.then it associates automatically...but we can add only 1 whoid to an event..

How can i associate lead with events...can someone provide me a solution for the same..??? any help will be appreciated..

I am getting Cross-site Scripting (XSS) while scanning in force.com scanner.if i remove javascript there is no error..what to change in javascript code..please help its quite urgent...may be encode something...

Class

 accid=ApexPages.currentPage().getParameters().get('accid');
    public meetingCtlr1(ApexPages.StandardController controller) 
    {
      conRecList=[Select id,name,email from contact where Accountid=:accid];
    }

conRecList on VF page

I have used this in javascript on VF page
<script>
    for(var i=0;i<{!conRecList.size};i++)
    var id='thePage:theform:thePB:conTable:'+i+':'+checkboxid;
    document.getElementById(id).checked=bool; 
</script>  

i want to insert an event record...but like i have more than 1 lead..i want to insert more than 1 leads as an invitee...

Like using whoid we can insert 1 record ... Using the standard interface we can click on add to inviteesbutton and add multiple invitees..How to add multiple using code so that it shows below on salesforce events...any help will be appreciated...

 

Event e= new Event();
e.Subject='Call';
e.ownerid=userinfo.getuserid();
e.StartDateTime=datetime.now().adddays(5);
e.EndDateTime=datetime.now().adddays(5);
e.WhatId=recid;
**//e.WhoId=**
insert e;
Map<String, Schema.SObjectField> fieldMap = leadSchema.getDescribe().fields.getMap();
Opportunity opp=[Select id,name,accountId from Opportunity];
 Map<String,string> valueMap=new Map<String,String>();

    for(opportunity o:opp)
           {
                for(String fieldName: fieldMap.keySet())
                {
                    **valueMap.put(fieldName,o);**
                }

           }

 I want to create a map of apiname and value pair..please help... 

i want record value...like if apiname of opportunity field is name..then i want record value..ie opportunity name...

The server (through Webhook API) makes a HTTP POST request to my URL ( I can only set the URL on server ) with POST parameters whenever an event occours on the server side. I want to insert a record on custom object, reading POST Parameters.

 

Can someone explain What I need to do..

 

-Do i need to make a Public Web Service in Salesforce

-Does Anyone have a better idea.

I have a Visualforce page with a lookup. When looked up, the result can be selected but the window does not close, forcing it to press the "Close Window"(cross window) button. I am using internet explorer 9. its working fine on IE 8 but not on IE 9.I am trying to solve this issue from last 2 days.i need urgent help.is it possible to run in compatability mode in IE9..please help...

Any suggestions?

Thanks in advance.

on button click on opportunity... i am showing opportunityline items records on a page with line number using repeat.

I have used wrapper class for showing line number.

My Problem

opportunityline items fields are editable on page..so user can update them...i am having problem updating it...how to specify id for updating...

 

in Constructor

List<OpportunityLineItem> oli;
oli=[Select Id,opportunityId From OpportunityLineItem where opportunityId=:id];
showsavedoppLineitems();

 

 wrapper class

public list<linenumberclass> wrapperopllist;//List used in repeat on page
public Class linenumberclass
{
    public integer lineNumber{get;set;}
    public OpportunityLineItem oppLineNo{get;set;}
    

   
     public linenumberclass(OpportunityLineItem oppLineNo,Integer lineNumber)
    {
        this.oppLineNo=oppLineNo;
        this.lineNumber=lineNumber;
    }

}

 method called from constructor

public void showsavedoppLineitems()
{   
    
 List<OpportunityLineItem> lOpp=[select id,Business_Type__c,pricebookentry.pricebook2id,pricebookentryid from OpportunityLineItem where id in:opplineIttems]; 
   for(OpportunityLineItem l:lOpp)
    {    
         opline = new OpportunityLineItem ();
         opline.OpportunityId=id;
         opline.pricebookentry=pre.get(l.pricebookentryid);
         opline.pricebookentryid=l.pricebookentryid;
         opline.Territory1__c=l.Territory1__c;
         wrapperopllist.add(new linenumberclass(opline,m));
          m++;
    }
}

 

i am calling this method on button click...so i have the updated record value in oplist...

 

public list<OpportunityLineItem > opllist{get;set;}

 



public void add{ for(linenumberclass ln:wrapperopllist) { opline = new OpportunityLineItem (); opline.opportunityid=id; opline.PricebookEntry=ln.oppLineNo.pricebookentry; opline.PricebookEntryid=ln.oppLineNo.pricebookentryid; opline.Line__c=ln.linenumber; opllist.add(opline); } }

i dont know how to update oplist.... 

 

 

As i am showing the records in editable mode...if any user edits them and click on them records should be updated .

i dont know how to update existing records.i dont how to pass id.

please help me out this...thanks