• Ritika J
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 23
    Questions
  • 12
    Replies

Hi All,

 

I have a requirement , where i need to get a record approved or rejected  by contact. But in standard approval process approver can only be users.

 

How could I take advantage of the Approval Process included in salesforce?

 

Or is there any other way to implement this.

 

 

Thnaks in advance,

 

Ritika

Hi

 

I have to increase the coverage for below class:

public with sharing class ContactPortalUserController
{
    List<User>luser  = new List<User>();
    List<contact>selectedCon = new List<contact>();
    ID profileID = [select id from profile where name = 'High Volume Customer Portal'].id;
    private ApexPages.StandardSetController standardController;
   // ApexPages.Message myMsg = new ApexPages.Message('info', summary);
    public ContactPortalUserController(ApexPages.StandardSetController standardController)
    {
        this.standardController = standardController;
          }

     public PageReference selectedContact(){
     List<Contact>selectedContact = (List<Contact>) standardController.getSelected();
    system.debug('****1***'+selectedContact );
     selectedCon = [select id , name , firstname, email ,EmailEncoding__c,LanguageLocaleKey__c,TimeZoneSidKey__c,LocaleSidKey__c, lastname from contact where id in:selectedContact];
     system.debug('***21***'+selectedCon );
     for(contact con:selectedCon)
     {
      User us = new User();
      us.alias  =   con.Firstname.substring(0,3) +'cus';
      us.email  =  con.email;
      us.emailencodingkey= con.EmailEncoding__c;
      us.lastname = con.lastname;
      us.languagelocalekey = con.LanguageLocaleKey__c;
      us.localesidkey =con.LocaleSidKey__c;
      us.profileid = profileID;
      us.contactId = con.id;
       us.timezonesidkey = con.TimeZoneSidKey__c;
       us.username =  con.email +'cus';
       luser.add(us);
     
     }
    
    try{
     
     insert luser;
     ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.Info, 'Users have been inserted successfully.');
    ApexPages.addmessage(myMsg);
     
     // myMsg = ;
                  //ApexPages.addMessage(myMsg);   
     
     }
     catch(exception e)
     {
       e.getmessage();
        ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Error Occured while inserting users,' + e.getmessage());
                  ApexPages.addMessage(myMsg);   
     }
   
     return null;
     }

    
}

 

Highlighted lines are not getting covered.

 

Test class:

 

public class  ContactPortalUserControllerTest{

    public static testMethod void testContactPortalUserController() {
      Profile p = [SELECT Id FROM Profile WHERE Name='System Administrator'];
      User u = new User(Alias = 'standt', Email='standarduser@testorg.com',
      EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US',
      LocaleSidKey='en_US', ProfileId = p.Id,
      TimeZoneSidKey='America/Los_Angeles', UserName='standarduser1112@testorg.com');


      System.runAs(u) {
    ID profileID = [select id from profile where name = 'High Volume Customer Portal'].id;

    List<contact> lcontact = new List<contact>();
    Contact con = new contact();
    con.lastname = 'test';
    con.email = 'Test@accenture.com';
    con.LanguageLocaleKey__c =  'en_US';
    con.LocaleSidKey__c = 'en_US';
    con.EmailEncoding__c = 'UTF-8';
    con.TimeZoneSidKey__c = 'America/Los_Angeles';
    insert con;
     Contact con1 = new contact();
    con1.lastname = 'test1';
    con1.email = 'Test@accenture.com';
    con1.LanguageLocaleKey__c =  'en_US';
    con1.LocaleSidKey__c = 'en_US';
    con1.EmailEncoding__c = 'UTF-8';
    con1.TimeZoneSidKey__c = 'America/Los_Angeles';
    insert con1;

    lcontact.add(con);
    lcontact.add(con1);

       PageReference pageRef = Page.ContactPortalUser;
        Test.setCurrentPage(pageRef);
          system.debug('*****1****' +  lcontact);     
     ApexPages.StandardSetController sc = new ApexPages.StandardSetController(Database.getQueryLocator([SELECT Id,Name FROM contact where id =:lcontact]));
ContactPortalUserController controller = new  ContactPortalUserController(sc);
  controller.selectedContact();
System.assert
      (ApexPages.getMessages().size() == 1);
      }
                    }
}

Hi ,

 

I have written this class for custom list button :

public with sharing class ContactPortalUserController
{
    List<User>luser  = new List<User>();
    List<contact>selectedCon = new List<contact>();
    ID profileID = [select id from profile where name = 'High Volume Customer Portal'].id;
    private ApexPages.StandardSetController standardController;
   // ApexPages.Message myMsg = new ApexPages.Message('info', summary);
    public ContactPortalUserController(ApexPages.StandardSetController standardController)
    {
        this.standardController = standardController;
      
    }

     public PageReference selectedContact(){
     List<Contact>selectedContact = (List<Contact>) standardController.getSelected();
   
     selectedCon = [select id , name , firstname, email ,EmailEncoding__c,LanguageLocaleKey__c,TimeZoneSidKey__c,LocaleSidKey__c, lastname from contact where id in:selectedContact];
   
     for(contact con:selectedCon)
     {
      User us = new User();
      us.alias  =   con.Firstname.substring(0,3) +'cus';
      us.email  =  con.email;
      us.emailencodingkey= con.EmailEncoding__c;
      us.lastname = con.lastname;
      us.languagelocalekey = con.LanguageLocaleKey__c;
      us.localesidkey =con.LocaleSidKey__c;
      us.profileid = profileID;
      us.contactId = con.id;
       us.timezonesidkey = con.TimeZoneSidKey__c;
       us.username =  con.email +'cus';
       luser.add(us);
     
     }
    
    try{
     
     insert luser;
     ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.Info, 'Users have been inserted successfully.');
    ApexPages.addmessage(myMsg);
     
     // myMsg = ;
                  //ApexPages.addMessage(myMsg);   
     
     }
     catch(exception e)
     {
       e.getmessage();
        ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Error Occured while inserting users,' + e.getmessage());
                  ApexPages.addMessage(myMsg);   
     }
   
     return null;
     }

    
}

 

I am writing test class for above controller:

 

public class  ContactPortalUserControllerTest{

    public static testMethod void testContactPortalUserController() {
    
    List<contact> lcontact = new List<contact>();
    Contact con = new contact();
    con.lastname = 'test';
    con.email = 'Test@accenture.com';
    insert con;
    lcontact.add(con);
    
       PageReference pageRef = Page.ContactPortalUser;
        Test.setCurrentPage(pageRef);
    //  ContactPortalUserController controller = new  ContactPortalUserController (null);
     // controller.selectedContact = lcontact;
           // controller.selectedContact();
            
            
           
ApexPages.StandardController sc = new ApexPages.StandardController(con);
 ContactPortalUserController controller = new  ContactPortalUserController (null);
 controller.selectedContact();

                    }
}

 

 

 

I am not sure how to set values for selected contact, can anybody help me with this.

 

 

Thanks

Ritika

 

Hi ,

 

I have addded <apex:inputfile > to my page , which is also using rerendering attribute.I am getting this error. Can anybody help me with this.

apex:inputFile can not be used in conjunction with an action component, apex:commandButton or apex:commandLink that specifies a rerender or oncomplete attribute.

 

 

Regards,

Ritika

Hi ,

 

I want to add live agent chat button on my customer portal.I am adding deployment and chat button code to my footer. But i am not getting the chat button.

 

Please help ,me on this.

 

Regards,

Ritika

Hi ,

 

I want to show live agent chat button for portal users , please suggest me how to do this.

 

 

Thanks in advance

Ritika

hi ,

I have refreshed and activated my sandbox. I am not able to login into sandbox now.

I am using username as my prod username +'.sandboxname'

pwd as my prod pwd.

 

Please let me know how can i solve this issue.

 

 

Thanks in advance

Ritika

Hi ,

 

I have created escelation rules  for cases .When i am creating records matching the escelation criteria , i am able to see the  cases in escelation queue under monitoring but Flag 'Escelated' is not getting checked once the SLA is achieved.

 

plesae help me in solving this issue.

 

Regards,

Ritika

Hi,

 

How can i send generate password email when i am creating new users through apex.

 

Thanks

Ritika

Hi ,

I am using a html email template (in english ) for workflow email notification., email template has some merge fields.

If the values for these fields in any other language like japenese  it doesnt display properly .

I dont have translation workbench enabled,

 

How can we solve this issue.

 

Thanks

ritika

Hi ,

 

I have a requirement where i  am routing user from a vf page to standard case creation page , i need to prepopulate some fields on case while routing.

 

Any idea how to do this .

 

Thanks

Ritika

Hi ,

 

I have enabled email2case functionality, cases are getting created.I have to assign these cases to different queues(80 different queues) on basis of two custom fields  which are getting populated by before insert trigger.

 

Please tell me the best approach to do this .I created workflows but  we cannot have more then 50 workflows.

 

Regards,

Ritika

 

Hi ,

 

I am using email2case on demand, i want to stamp some custom fields on case object by picking the values from the email.

I can give the client an email template that he can use. I just need to pick values of 5-7 fields and stamp it on case object.

Can anbybody help me with this.

 

Thanks

Ritika

Hi,

 

Can anybody tell me how to stamp fields on cases from emails.I am using email2case on demand.

 

thanks in advance,

Ritika

HI,

 

I have a commandlink on vf page , on click of this vf page i am calling a new vf page.

I want to pass some parameters from vf1 to vf2 .

 

Any suggestion how can i do this.

 

 

Thanks

Ritika

Hi ,

 

I have to display a vf page in new window  on click of a command link  . right now it is opening in same window.

Please help me with this.

 

Thanks

ritika

Hi

I want to display some links on extreme right at top of my vf page as images .

 

Can anybody tell me how to display links as any image.

 

thanks

Ritika

Hi

 

I have a requirement in which i have to make a dynamic picklist , such that picklist values should change as per the value selected by user in other field.

 

I have two fields one is look up and another is picklist , Whatever user selects in look up field   i have to make a query depending on that input and show picklist values.

 

My code

VF

<apex:page standardController="Account" extensions="Accountextension" >
<apex:form >
<apex:pageBlock id="thePageBlock" >
<apex:pageBlockSection >
<apex:inputField id="product" value="{!Account.Product__c}">
<apex:actionSupport event="onchange" rerender="thePageBlock"
status="status"/>
</apex:inputField>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Products available" for="Productsavailable"></apex:outputLabel>
<apex:selectList id="Productsavailable" size="1" title="Products available">
<apex:selectOptions value="{!mgrs}"></apex:selectOptions>
</apex:selectList>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

Controller

 

public class Accountextension {
    private final Account acc;
    String product;
        
    public String getProduct() {
    return acc.Product__c ;
    }
   
    public void setProduct() {
   product=acc.Product__c;

    }
           
        public Accountextension(ApexPages.StandardController stdController) {
        this.acc = (Account)stdController.getRecord();
    }
            //builds a picklist
          public List<selectOption> getMgrs() {
           System.debug ('**********************LOGIN1*********************'+acc.Product__c);

        List<selectOption> options = new List<selectOption>(); //new list for holding all of the picklist options
        options.add(new selectOption('', '- None -')); //add the first option of '- None -' in case the user doesn't want to select a value or in case no values are returned from query below
        for (Product2 prod : [Select id ,Name From Product2 where id = :product]) { //query for products
                   options.add(new selectOption(prod.id ,String.valueOf(prod.Name))); //for all records found - add them to the picklist options
        }
        return options; //return the picklist options
    }

}

 

My problem is  in the query (highlighted in bold)  it is not  recognising the id in query , though i am getting the correct id  .

 

Debug log:

 

USER_DEBUG|[20]|DEBUG|**********************LOGIN1*********************01t90000000pbhEAAQ
22:51:50.054 (54454000)|SYSTEM_METHOD_EXIT|[20]|System.debug(ANY)
22:51:50.054 (54482000)|SYSTEM_METHOD_ENTRY|[23]|LIST.add(ANY)
22:51:50.054 (54513000)|SYSTEM_METHOD_EXIT|[23]|LIST.add(ANY)
22:51:50.054 (54530000)|SOQL_EXECUTE_BEGIN|[24]|Aggregations:0|Select id ,Name From Product2 where id= :product
22:51:50.057 (57518000)|SOQL_EXECUTE_END|[24]|Rows:0

Please  help me with this problem

 

 

Hi ,

 

I want to display google map in an inline vf page in account detail page based on billing address , i have created this page and added it account page layout. But i am not getting google map instead i am getting a blank section.

 

Please help me with this.

 

My Code:

 

<apex:page standardController="Account">

<head>

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">

$(document).ready(function() {
 
  var myOptions = {
    zoom: 15,
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    mapTypeControl: false
  }
 
  var map;
  var marker;
 
  var geocoder = new google.maps.Geocoder();
  var address = "{!Account.BillingStreet}, " + "{!Account.BillingCity}, " + "{!Account.BillingPostalCode}, " + "{!Account.BillingCountry}";
 
  var infowindow = new google.maps.InfoWindow({
    content: "<b>{!Account.Name}</b><br>{!Account.BillingStreet}<br>{!Account.BillingCity}, {!Account.BillingPostalCode}<br>{!Account.BillingCountry}"
  });

  geocoder.geocode( { address: address}, function(results, status) {
    if (status == google.maps.GeocoderStatus.OK && results.length) {
      if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
     
        //create map
        map = new google.maps.Map(document.getElementById("map"), myOptions);
     
        //center map
        map.setCenter(results[0].geometry.location);
       
        //create marker
        marker = new google.maps.Marker({
            position: results[0].geometry.location,
            map: map,
            title: "{!Account.Name}"
        });
       
        //add listeners
        google.maps.event.addListener(marker, 'click', function() {
          infowindow.open(map,marker);
        });
        google.maps.event.addListener(infowindow, 'closeclick', function() {
          map.setCenter(marker.getPosition());
        });
       
      }
     
    } else {
      $('#map').css({'height' : '15px'});
      $('#map').html("Oops! {!Account.Name}'s billing address could not be found, please make sure the address is correct.");
      resizeIframe();
    }
  });
 
  function resizeIframe() {
    var me = window.name;
    if (me) {
      var iframes = parent.document.getElementsByName(me);
      if (iframes && iframes.length == 1) {
        height = document.body.offsetHeight;
        iframes[0].style.height = height + "px";
      }
    }
  }
 
});
</script>

<style>
#map {
  font-family: Arial;
  font-size:12px;
  line-height:normal !important;
  height:250px;
  background:transparent;
}
</style>

</head>

<body>
<div id="map"></div>
</body>
</apex:page>
                         

Hi,

 

I have a requirement in which i will have to display different picklist values  depending on the value selected by user in a lookup field.

 Picklist values from  lookup selceted values.

 

 

Any idea , how this can be achieved .

 

Thanks in advance

RJoshi

Hi ,

 

I have written this class for custom list button :

public with sharing class ContactPortalUserController
{
    List<User>luser  = new List<User>();
    List<contact>selectedCon = new List<contact>();
    ID profileID = [select id from profile where name = 'High Volume Customer Portal'].id;
    private ApexPages.StandardSetController standardController;
   // ApexPages.Message myMsg = new ApexPages.Message('info', summary);
    public ContactPortalUserController(ApexPages.StandardSetController standardController)
    {
        this.standardController = standardController;
      
    }

     public PageReference selectedContact(){
     List<Contact>selectedContact = (List<Contact>) standardController.getSelected();
   
     selectedCon = [select id , name , firstname, email ,EmailEncoding__c,LanguageLocaleKey__c,TimeZoneSidKey__c,LocaleSidKey__c, lastname from contact where id in:selectedContact];
   
     for(contact con:selectedCon)
     {
      User us = new User();
      us.alias  =   con.Firstname.substring(0,3) +'cus';
      us.email  =  con.email;
      us.emailencodingkey= con.EmailEncoding__c;
      us.lastname = con.lastname;
      us.languagelocalekey = con.LanguageLocaleKey__c;
      us.localesidkey =con.LocaleSidKey__c;
      us.profileid = profileID;
      us.contactId = con.id;
       us.timezonesidkey = con.TimeZoneSidKey__c;
       us.username =  con.email +'cus';
       luser.add(us);
     
     }
    
    try{
     
     insert luser;
     ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.Info, 'Users have been inserted successfully.');
    ApexPages.addmessage(myMsg);
     
     // myMsg = ;
                  //ApexPages.addMessage(myMsg);   
     
     }
     catch(exception e)
     {
       e.getmessage();
        ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Error Occured while inserting users,' + e.getmessage());
                  ApexPages.addMessage(myMsg);   
     }
   
     return null;
     }

    
}

 

I am writing test class for above controller:

 

public class  ContactPortalUserControllerTest{

    public static testMethod void testContactPortalUserController() {
    
    List<contact> lcontact = new List<contact>();
    Contact con = new contact();
    con.lastname = 'test';
    con.email = 'Test@accenture.com';
    insert con;
    lcontact.add(con);
    
       PageReference pageRef = Page.ContactPortalUser;
        Test.setCurrentPage(pageRef);
    //  ContactPortalUserController controller = new  ContactPortalUserController (null);
     // controller.selectedContact = lcontact;
           // controller.selectedContact();
            
            
           
ApexPages.StandardController sc = new ApexPages.StandardController(con);
 ContactPortalUserController controller = new  ContactPortalUserController (null);
 controller.selectedContact();

                    }
}

 

 

 

I am not sure how to set values for selected contact, can anybody help me with this.

 

 

Thanks

Ritika

 

Hi ,

 

I want to show live agent chat button for portal users , please suggest me how to do this.

 

 

Thanks in advance

Ritika

hi ,

I have refreshed and activated my sandbox. I am not able to login into sandbox now.

I am using username as my prod username +'.sandboxname'

pwd as my prod pwd.

 

Please let me know how can i solve this issue.

 

 

Thanks in advance

Ritika

Hi,

 

How can i send generate password email when i am creating new users through apex.

 

Thanks

Ritika

Hi ,

 

I have a requirement where i  am routing user from a vf page to standard case creation page , i need to prepopulate some fields on case while routing.

 

Any idea how to do this .

 

Thanks

Ritika

Hi,

 

Can anybody tell me how to stamp fields on cases from emails.I am using email2case on demand.

 

thanks in advance,

Ritika

Hi

I want to display some links on extreme right at top of my vf page as images .

 

Can anybody tell me how to display links as any image.

 

thanks

Ritika

hi,

 

I have a requirement in which if user click on the link in the related list and if user doesnt have permissions to view that record ,he will get an error message " insufficient Privelages ....".I want  instead of this message user should be taken to some other page where he can add that record to his territory.

 

 

Any idea how we can achieve this.

 

 

Thanks

RJoshi

Hi,

 

I have a requirement in which i will have to display different picklist values  depending on the value selected by user in a lookup field.

 

 

Any idea , how this can be achieved .

 

Thanks in advance

RJoshi

Hi,

 

I have a to create a  custom buston on contact object. On click of this custom button user should be taken to  standard page for creating new user , with some information prepopulated.

 

Any idea how to achieve this , please help me.

 

Thanks in advance.

RJoshi

Hi,

 

     I need to create multiple contact records from vf page.Any code plzz?

 

Thanks