• vasu takasi
  • NEWBIE
  • 105 Points
  • Member since 2011

  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 37
    Questions
  • 19
    Replies

how to make input field to secrete.like password

  • March 23, 2012
  • Like
  • 0

 

 

Hi i am uisng showModalDialog to get a value from child window in the code shown below,

 

var popupstyle = "center:yes;resizable:no;dialogHeight:600px;dialogwidth:600px";
var  acc = window.showModalDialog("/apex/CustomAccountLookup",null,popupstyle);


but  its showing error like "Unterminated string constant " in IE

How to resolve it, Please guide me.

 

 

 

 

hi i am trying to get sObject records using RemoteAction .In vf page I am unable to retrive field names , in the alert i am getting as undefined. Please any one can help me.

 

page---

 Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.CustomLeadConversion.RecentMappingsRmt}',objApiName,
            function(result, event){
                if (event.status) {
                  if(result != null){
                   alert(result[0].name);
             }
          }
        });

class----

@RemoteAction
     global static list<mapping__c> RecentMappingsRmt(string objectname) {
         mapping__c[] lstmappings=new mapping__c[]{};
         
         lstmappings=[select name,Source_Field__c,Target_Field__c from mapping__c where name=:objectname];
         return lstmappings;
         
     }

 

 

hi

 i want convert a lead from apex without creation of account

how is it possible?

public class LeadClass{
    public static void doConvert(Id leadId){

        Database.LeadConvert lc = new database.LeadConvert();
        lc.setLeadId(leadId);
        lc.setDoNotCreateOpportunity(True); //**IMPORTANT METHOD HERE**

        LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
        lc.setConvertedStatus(convertStatus.MasterLabel);
        Database.LeadConvertResult lcr = Database.convertLead(lc);
    }
}

 

hi i want get a list of custom objects through ajax ,

How can i achieve this? Please guide me.

 

<script src="/soap/ajax/18.0/connection.js"></script>
    <script type="text/javascript">
        sforce.connection.sessionId = "{!$Api.Session_ID}";
        window.onload=allobjects;
        function allobjects()
        {         
            var allobjects=sforce.connection.Schema.getGlobalDescribe().Values();
            alert(allobjects);

}

}

<select id="myobjs" >
        <option value="none">--None--</option>
    </select><br/>

How render a page as PDF without effecting its styles

 

Hi , I have an if condition in my class which takes url using getUrl method, How to get in test coverage.

 

if(ApexPages.currentPage().getUrl()!=null){

 

}

 

Please somebody can guide me.

Hi,

I want to create a custom field for OpportunityLineItem from apex.

How is it Possible?

Please can any one guide me.

 

Is it possible to update a record from one Salesforce organization to another Salesforce organization using outbound messages(workflow)? If possible, Please guide me how to configure it.

string typename='account';

Schema.SObjectType targetType = Schema.getGlobalDescribe().get(typeName);

sObject obj=targetType.newSObject();

 

here i want to create an instance for account dynamically.

How is it possible.

 

the beloecode showing exception like

CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY

 

trigger acc on FeedItem (after insert)
{
FeedItem post = new FeedItem();
post.ParentId ='0019000000GuVUM';
post.Body = 'welcome';

Database.insert(post);
}

 

 

 

How to solve it.

trigger acc on FeedItem (after insert)
{
FeedItem post = new FeedItem();
post.ParentId ='0019000000GuVUM';
post.Body = 'welcome';

Database.insert(post);
}

 

the above code showing exception like

CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY

 

How to solve it.

how to put title on left side and command-link on right side of a pageblock-section header 

 

<apex:pageBlockSection title="Address Information" collapsible="false" id="pbs" >

<apex:inputField value="{!account.Billingstreet}"/>
<apex:inputField value="{!account.shippingstreet}"/>
<apex:inputField value="{!account.Billingcity}"/>
<apex:inputField value="{!account.shippingcity}"/>
<apex:inputField value="{!account.billingstate}"/>
<apex:inputField value="{!account.shippingstate}"/>
<apex:inputField value="{!account.billingpostalcode}"/>
<apex:inputField value="{!account.shippingpostalcode}"/>
<apex:inputField value="{!account.billingcountry}"/>
<apex:inputField value="{!account.shippingcountry}"/>

</apex:pageBlockSection>

Please guide me for getting full code coverage for the following class by using best practices,

 

public class sendemail_torelated_contacts
{

list<string>emailids;
public PageReference sendemail()
{
emailids=new list<string>();
for(contact c:conlst)
{
if(c.email!=null)
{
emailids.add(c.email);
}
}

system.debug('-----------------------------------------------'+emailids.size());
if(emailids.size()>0)
{
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();

mail.setToAddresses(emailids);

mail.setSubject('Test Mail');

mail.setUseSignature(false);
mail.setHtmlBody('This is a test mail');

// Send the email
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.INFO, 'Mail sent successfully');
apexpages.addmessage(myMsg);
}else
{
ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.warning, 'NO Destination found');
apexpages.addmessage(myMsg);
}

return null;
}


public PageReference find_contacts()
{
//system.debug('=================================='+accid);
conlst=new contact[]{};
if(accid!='')
{
conlst=[select id,accountid,name,email,phone from contact where accountid=:accid];
}
if(conlst.size()>0)
{
showbtn=true;
}else
{
showbtn=false;
}
return null;
}


public String accid { get; set; }
public boolean showbtn{get;set;}

account[]acclst;
public contact[]conlst{get;set;}


public account[] getaccounts()
{
acclst=new account[]{};
acclst=[select id,name,phone from account where name in('appshark','ibm','infosys')];

return acclst;

}

//Test method for code coverage-----------------------

Private static testmethod void test()
{
account a=new account(name='test',phone='09030182818');
insert a;
contact con=new contact(lastname='testcon',email='vasu.takasi@test.com',accountid=a.id);
insert con;
sendemail_torelated_contacts obj=new sendemail_torelated_contacts();
obj.showbtn=true;
obj.conlst=new contact[]{};
obj.conlst.add(con);
obj.getaccounts();
obj.find_contacts();
obj.sendemail();

}

}

hi i have getting security issues regarding

 

""returnUrl = apexpages.currentpage().getparameters().get('returnUrl');""

 

and

 

""pagereference p = new pagereference(returnUrl); 
      return p;""

 

in the following class.

Please solve this issue.

 

 

 

public with sharing class classexample {  

   public classexample()

{

         c= new contact(); 

         paramMap = apexpages.currentpage().getparameters();    

           list1 = new List<String>(paramMap.keySet());    

      for(integer i=0;i<list1.size();i++){     

          paramName = list1.get(i);

              paramValue = paramMap.get(paramName);      

         if(paramName != 'returnUrl' && paramName !='core.apexpages.devmode.url')

{

              c.put(paramName,paramValue);       

        }       

 

              }  

         returnUrl = apexpages.currentpage().getparameters().get('returnUrl'); 

    }

public contact c;

public string lastname{get;set;}

public string firstname{get;set;}

public string paramName{get;set;}

public string paramValue{get;set;}

public List<String> list1{get;set;}

public  map<string,string> paramMap{get;set;}

public  string returnUrl;      

    public pagereference autorun()

{            

      if(c.lastname!=null)

{

            insert c;    

    }     

   if(returnUrl!=null)

{

             pagereference p = new pagereference(returnUrl);

        p.setredirect(true);  

     return p;       

    }else

      {     

     return null;     

  }

             }   }

hi

i have class like

 

public class abc

{

integer a,b,c;

    public void maths()

{

     string s='add';

 

  if(s=='add')

{

   c=a+b;
}

else if(s=='sub')

{
   c=a-b;
}
}

}

 

 

here i want to cover both if and Else blocks.

Please guide me.

hi

 

i have a list like--       "list<string>options=new list<string>{'a','b','c','d','e','f','g','h'};"

 

from this list i want to remove "e" (lets assume that 'i have dont know its index')

 

 

public with sharing class myclass{

    public PageReference myclass() {
     Integrationcrm Ic = new Integrationcrm ();
      Integrationcrm .integrationservice IS = new Integrationcrm .integrationservice ();
       IS.runIntegrationService();
       string s = IS.s;
        return null;
    }
    //-----------------test method----------------
    public static testmethod void test()
    {
         myclass obj2=new myclass() ;
        obj2.myclass(); 
               
    }
}

 

in the above code 

 

 string s = IS.s;
        return null;

is not covering.

hi i have code like

public class abc

{

string s1='picklist';

string s2;

string s3;

public void m1()

{

if(s1=='picklist')

{

//some code here
}

else if(s1=='text')

{

//------------

}

}

in text method how to pass s1 value ?;

 

please help me.

hi i have a code like list var=iphidden.split(':'); var.remove(0). while i am writing test method for this , it showing exception like System.NullPointerException: Attempt to de-reference a null object. How to solve it? Please help me.

hi i have two fields in my contact object like leadsource and level.

i want to get these values using if condition like

string s='level';

 if(type==s)
            {
                Schema.DescribeFieldResult pickval  =Schema.sObjectType.contact.fields.(:s).getSObjectField().getDescribe();
            }
i have to mension field name dynamically.

please help me.         

the beloecode showing exception like

CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY

 

trigger acc on FeedItem (after insert)
{
FeedItem post = new FeedItem();
post.ParentId ='0019000000GuVUM';
post.Body = 'welcome';

Database.insert(post);
}

 

 

 

How to solve it.

trigger acc on FeedItem (after insert)
{
FeedItem post = new FeedItem();
post.ParentId ='0019000000GuVUM';
post.Body = 'welcome';

Database.insert(post);
}

 

the above code showing exception like

CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY

 

How to solve it.

how to put title on left side and command-link on right side of a pageblock-section header 

 

<apex:pageBlockSection title="Address Information" collapsible="false" id="pbs" >

<apex:inputField value="{!account.Billingstreet}"/>
<apex:inputField value="{!account.shippingstreet}"/>
<apex:inputField value="{!account.Billingcity}"/>
<apex:inputField value="{!account.shippingcity}"/>
<apex:inputField value="{!account.billingstate}"/>
<apex:inputField value="{!account.shippingstate}"/>
<apex:inputField value="{!account.billingpostalcode}"/>
<apex:inputField value="{!account.shippingpostalcode}"/>
<apex:inputField value="{!account.billingcountry}"/>
<apex:inputField value="{!account.shippingcountry}"/>

</apex:pageBlockSection>

hi

 

i have a list like--       "list<string>options=new list<string>{'a','b','c','d','e','f','g','h'};"

 

from this list i want to remove "e" (lets assume that 'i have dont know its index')

 

 

Hi,

 

Requirement is to get Tweets of my contact/Person account and store it in to salesforce.

Can this be achieved by authentication Twitter API using oauth 1.0
 and How.

 

It's Urgent and i would like the input from you people.Step to step guide if possible

 

Thanks,
Subham

 

 

  • August 05, 2012
  • Like
  • 0

hi

i have a number field called "Quantity".

if i enter 55 , After saving the record, the quantity should be appeared as "  Kg.55 ".

 "like currecy field"

please help me.............

 

Thanks.

 

 

hi

i have a controller like

 

public with sharing class assignment5
{
    public string name{get;set;}
    public assignment5(ApexPages.StandardSetController controller)
     {

      }
    
    public void selected_name()
    {
             //name.fontstyle='bold';      
            ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.info, 'you selected  '+name);
            Apexpages.addMessage(mymsg);
    }
}

 

page:-

<apex:page standardController="account" recordSetVar="acc" >
    
    <apex:form id="f1">
       <apex:sectionHeader title="Assighment 5"/>
        <apex:pageBlock >
          <apex:pageMessages ></apex:pageMessages>
            <apex:pageBlockTable value="{!acc}" var="a" >
            <apex:column headerValue="Name" id="col1">
                <apex:commandLink action="{!selected_name}" reRender="f1" >
                    {!a.name}
                    <apex:param value="{!a.name}" name="n"  assignTo="{!name}"/>
                </apex:commandlink>
            </apex:column>
            <apex:column value="{!a.BillingState}" id="col2" />
            <apex:column value="{!a.phone}" id="col3" />
            <apex:column value="{!a.website}" id="col4"/>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

in vf page the font style of   "name" should be in bold.

ex: you selected  xxxxx

hi i am trying to tranfer values between two different selectLists. but i have not getting any idea.

Please help me.

 

<apex:page >
<apex:form >
<table>
<tr>
<td>
<apex:selectList multiselect="true" SIze="1">
<apex:selectOption ItemValue="ONE" ></apex:selectOption>
<apex:selectOption ItemValue="TWO" ></apex:selectOption>
<apex:selectOption ItemValue="THREE"></apex:selectOption>
<apex:selectOption ItemValue="FOUR"></apex:selectOption>
</apex:selectList>
</td>
<td>
<apex:panelGrid >

<apex:commandButton value="Add"/>
<apex:commandButton value="Remove"/>
<apex:commandButton value="up"/>
<apex:commandButton value="Down"/>
</apex:panelGrid>
</td>
<td>
<apex:selectList multiselect="true">

</apex:selectList>
</td>
</tr>
</table>
</apex:form>
</apex:page>

hi

 

I have to search all objects in vf page using search button.

But i have no idea on retrieving object names using sosl .

please help me.

hi

i need a formula to display name of the week form a date field called date_of_birth.

Please show  me the solution.

I wrote a test method to cover code for the class shown below.

But its not covering the wrapper class .

please direct me to test wrapper class.

 

public with sharing class sno_in_table
{

public list<wrap> getRecords()

{
integer sno=1;
list<wrap>emps=new list<wrap>();
list<employee__c>emp_records=[select name,phone__c from employee__c];

for(employee__c em:emp_records)
{

emps.add(new wrap(sno,em));
sno++;

}
return emps;
}

 

//wrapper class

 

public class wrap
{
public integer sno{get;set;}
public employee__c emp{get;set;}

public wrap(integer sn, employee__c e)
{
emp=e;
sno=sn;
}

}

public static testmethod void m1()
{
sno_in_table sno=new sno_in_table();
sno.getrecords();
}
}

how to make input field to secrete.like password

  • March 23, 2012
  • Like
  • 0
hi i have a query i n my controller as DataLoadTest__c selectedRecord = [select Id,name,city__c,country__c,phone__c from DataLoadTest__c where id=:rId limit 1]; how to write test method for this query. it showing exception as System.QueryException: List has no rows for assignment to SObject

Hi

 

I had created a force.com project using Eclipse ide.

Because of security reasons i want to log out from that particular project after completion of my work.

Is it Possible.