• osaman
  • NEWBIE
  • 351 Points
  • Member since 2009
  • Salesforce Certified Technical Architect


  • Chatter
    Feed
  • 13
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 15
    Questions
  • 157
    Replies

Hi ,

 

I am writing a test class fo rthe follwing integration class and my code covers 90%.

 

But I want to know if this is the right test class or not.

 

CODE:

 

public with sharing class OpportunityUpdateIntegration {

@future (callout=true)

public static void runjob(String username, String password, String jobName, String jobType) {
system.debug('inside ');
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();

req.setEndpoint('https://app.informaticaondemand.com/saas/api/1/runjob?username='+EncodingUtil.urlEncode(username, 'UTF-8')+
'&password='+EncodingUtil.urlEncode(password, 'UTF-8')+
'&jobName='+EncodingUtil.urlEncode(jobName, 'UTF-8')+
'&jobType='+EncodingUtil.urlEncode(jobType, 'UTF-8'));
req.setMethod('POST');

try
{
res = http.send(req);
}
catch(System.CalloutException e)
{
System.debug('Job Error: '+ e);
System.debug(res.toString());
}
}
}

 

TEST CLASS:

@istest
public class OpportunityUpdateIntegration_test{
static TestMethod void OpportunityUpdateIntegration_test(){
//data preparation
//insert opportunity test records
opportunity opy = new opportunity(Name = 'test opp',stagename = 'closed won',closedate=date.parse('1/1/2020'));
insert opy;
//Assert the inserted test record
system.assertequals(opy.name,'test opp');
OpportunityUpdateIntegration oui = new OpportunityUpdateIntegration();
}
}

 

Please comment on the test class if it is correct or not.

 

Thanks

JL

 

Hi

Tell me how to create a Lookup field in a VF page.

I have an object name contact. I want to create a lookup for it.

Thanks

Anuraj

  • September 01, 2011
  • Like
  • 0

 hey guyz

 

i want to add some custom fields to opportunity. The fields are of piclkist type n they get their value at run time through web servicecall...... how can i add such firelds to opportunity... any suggestions...plz help 

  • September 01, 2011
  • Like
  • 0

Though I have set the color as White for active tab and black for inactive tab, the Font Color on tab is always black. Any thoughts why? I tested it in IE as well as Firefox.

 <style>
      .activeTab {background-color: #919191; color:white; font-size: 9pt; background-image:none}
      .inactiveTab {background-color: #B3B3B3; color:black; font-size: 9pt; background-image:none}
   </style>


<apex:tabPanel switchType="client" selectedTab="tpMain" id="tpMain" tabClass="activeTab" inactiveTabClass="inactiveTab">


Hai to Salesforce,

 

 I want to send an email alert to user when the task is overdue, unfortunately we don't have option to send  overdue email through workflows, so the only option is Apex code and Visualforce email template,but i have searched enire to get about Vfemail templates, but i didn't get needed information forme,

 

 please help me , I am creating Vfemail template sucessfully,and in verify test and getting merge fields also,

 

 Now i am having doubt like, how we can send that Email template to User through Trigger and how i can pass record ID to that template in trigger. please help me

 

Regards,

Haribabu

On a custom visual foce page I would like one input field to appear under another kind of like a login screen. Does anyone know how one would go about doing that?

I am having some trouble understanding the ability to Read Opportunities with the Authenticated Website License.

 

Overview:

We track the lifecycle and stages of our consumer customers with the Opportunity object.  I want to create a secure portal where they can simply view the information related to their Opportunities.  In order to do this they need to be authenticated. 

 

What I've Done:

I have a site which requires login and we are using the Authenticated Website license.  This profile does not have the option to grant Read access to Opportunities.  I have created a User with the Authenticated Website license and profile.  When logged in as this User I cannot display the Opportunities on a custom VF page. 

 

However, I wanted to test the ability to create an Opportunity when logged in as this user, so I created a button on the VF page that would create an Opportunity when clicked.  It worked and I was able to create an Opportunity when logged in as this User with the Authenticated Website License.  The Public Access Setting for this Site does grant Read and Create access on Opportunities but I don't know if that has anything to do with it.

 

This leaves me confused and having some questions:

1. I've been told that only the Partner Portal license has access to Opportunities.  If that's the case, why am I able to create Opportunities with the Authenticated Website license?

2. Do the Public Access Settings for the Site have any effect on access even when not using that particular license?

3. If I can create an Opportunity, why can I not view Opportunities when logged in with the Authenticated Website license?

 

Sharing settings for Opportunities are set to Public Read/Write.

 

Thanks in advance for any insight!

 

~ Clint

I have a multi-part form, which cycles from page to page, collecting info, and then on the last page saves the SObjects that have been created along the way.

 

This includes a Person Account, and severl custom objects. I have enabled read/create perms on Accounts, Contacts, and the relevant custom objs in the Site Public Access Settings.

 

When I do this inside SFDC it works fine, however when I try from the public site it navigates from page to page, but when I try to save I get a 401 - Authorization Required page. I know its not the Confirmation page that is supposed to appear after the save as I tried by-passing the save and going directly to the confirm page, and it worked.

 

I assume this is something to do with perms on doing DML. I am only inserting. I am currently running in a sandbox.

  • March 16, 2011
  • Like
  • 0

How can I read a URL value from a List button and it is  on on the standardview page not a custom VF page.
I am using this button as List Type and content source=URL and in the value= .../apex/opppty

 

can I pass the current URL to the button click  (like:.../apex/opppty?returl=https://cs4.salesforce.com/006?fcf=00BP0000000TbV4)

 

I just need to keep URL of  the original SF standard page  after loading my custom Visualforce page and when user wanted to go back to the page they can navigate there easily.

  • March 14, 2011
  • Like
  • 0

Am new to Apex and just  starting to learn it, so I would appreciate any help here.

 

I was informed that I should include a few Contact creations (with Ing user id field populated), and deletions of Contacts that are created by this class

 

Can anyone help me write a Test Class for this simple Apex trigger? The trigger restricts all profiles (except the Sys Admin one), from deleting Contacts IF the record contains an integer > 0 in the Ing User ID custom field.

 

trigger CheckFieldValues on Contact (before delete) 
{
        if(UserInfo.getProfileId()=='00e50000000sCkdAAE')
        {
            System.debug('User Profile Id--'+UserInfo.getProfileId());
        }
         else
         {
             for (Contact c : Trigger.old)
             {
 
                if (c.ING_USER_ID__c > 0 )
                {
                    c.addError('**This Contact record contains a unique Ingenuity User ID and cannot be deleted. Deletion would have a detrimental impact on data integration processes**');
                }
             }
            
         }
        
}
  • February 23, 2011
  • Like
  • 0

Hi All

 

I have found some problem about SOQL query.

I have set private record.

Each user can see the own record. But I need to use APEX code to query all data. Not only find in their record.

 

Do you have any idea?

Hello.

 

On a page, I have an inputtext field called "giftItemCost". In the custom controller, I'm referencing that value directly in a SOQL query.

 

When I use the following, it works fine:

 

 

public decimal giftItemCost {get; set;}

 

However, in order to do unit testing (and thus assign a value to the inputtext during testing), I need an explicit getter and setter. So, when I switch it to the following, it doesn't work:

 

 

public decimal giftItemCost;
public decimal getGiftItemCost() { return giftItemCost; }
public void setGiftItemCost(Decimal d) { giftItemCost = d; }

Not only does it not work, but the button on the VF page stops working entirely. Oddly, my VF page has a series of other inputtext fields, and all of them are working properly using the latter explicit get/set version of the code.

 

Any explanation would be very appreciated. Thank you.

 

-Greg

 

 

 

Hi

Can we hide the from address for an email?

My scenario is.

When the Site guest users fill the online application form, they get a confirmation mail 

In this mail , the from Address shows as " No reply on behalf of Salesforce.com[site contact Email id here].

I managed to remove the " no reply on behalf os salesforce.com" but I still get the Site contact Email id in brackets.

Can we hide that address?

 

I also used setsenderdisplayname method. but only the display name changes and still I get the Site contact Email Address.

How can we have that removed.?

  • August 17, 2010
  • Like
  • 0

Hi,

 

I have registered a custom domain on a force.com site. I am using Ajax using actionFunction on the main page to do some DML. However, when I access the page with the custom web address I am getting 

 

 

SCRIPT5: Access is denied.

3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript?rel=1350937585000, line 90 character 338

 

It works with the website secure address. Seems to be a cross domain scripting issue. Any workarounds for that?

 

Thanks

  • October 24, 2012
  • Like
  • 0

Hi,

 

I have two force.com sites and both have separate login/signup pages. What I intend to do is to merge the singup pages into one site and based on the selection, creates the customer portal user etc and login to the respective site. 

 

What I was thinking is if I can create an apex form using dynamic visualforce components and post it to the other site with encrypted credentials as apex parameters. The other site can read those parameters and allow login.

 

Any best practices or recommendation?

  • October 04, 2012
  • Like
  • 0

Hi,

 

We had our application built in .NET which was calling in a force.com site authenticated page through an iframe. It was working fine until this morning. But since then the page is being opened separately and not in the frame. On debuggiing I checked there is some SF javascript which is changing the URL using window.location.href.

 

Any workarounds?

 

Any help is highly appreciated.

 

Thanks

  • October 28, 2011
  • Like
  • 0

Hi,

 

I have ran into a weird situation. I have developed a visualforce email template which pulls account, contact, opportunity and quote information. The email is sent on a field update using a time based workflow.

 

The problem is the email is getting sent if I manually update the quote within salesforce but the email is not getting sent when a portal user updates the quote using customer portal. The controller has "without sharing" token. 

 

The SingleEmailMessage documentation says that WhatId cannot have QuoteId in it but it works if it is executed within salesforce but doesnt work for the portal user.

 

Can some one provide me with the correct information?

 

Thanks in advance.

  • August 19, 2011
  • Like
  • 0

Hi

 

I am sure this is a very common business need but what are the best possible ways to schedule and email a report as CSV? I know about scheduling data loader. Can we do this using Report metadata API? Any recommendations shall be highly appreciated.

 

Thanks

  • August 04, 2011
  • Like
  • 0

Hi,

 

I was wondering if we can pass in an array as a parameter and extract it on some other page. I know we can do that with a string as ApexPages.CurrentPage().getParameters().put('myVar', value) but what if we want to pass a list?

 

Does anyone have any workaround for this other than individually passing each value?

 

Thanks

I have created an opportunity big deal alert which is not executing upon the successfull evaluation of amount and probablity critieria. It is active and opportunity does meet the criteria.

 

Also when a portal user updates an opportunity and meets criteria, it throws and exception "An unknown error occured while processing your request", other wise it doesn't.

 

Where am I going wrong?

 

Thanks

I am using Salesforce for Social Media and I am not sure how does bit.ly works in it. I have entered API key and password but when I post something the URL doesn't get shortened.

 

Any help would be highly appreciated.

 

Thanks

Hi

 

Whenever I send an email using a HTML email template through apex, the email is not logged in HTML Email Status related list in COntacts and Leads. The email template I am using is HTML one.

 

Am I missing something small?

 

Thanks

Hi

 

I am trying to geenrate an apex class from WSDL. The class had external schema referred in it. I included the schema in the main WSDL. When I try to parse the WSDL it gives an error:

 

Unsupported Schema element found http://www.w3.org/2001/XMLSchema:attribute

 

According to this, salesforce does support "attribute", "xsd:attribute

, in Apex code saved using API version 15.0 and later"

 

Can any one tell me where am I going wrong?

 

Thanks in advance.

  • April 01, 2011
  • Like
  • 0

I am trying to use URL rewriter feature for force.com site. I have written the code but it doesnt seem to work.

 

What is the point of using Page__c? Do we really need to use this?

 

 

  • March 30, 2011
  • Like
  • 0

Hi

 

My visualforce page was working fine on IE8 with ajax being used. But on IE9 it gives an error

 

 

SCRIPT16386: No such interface supported
 
3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript, line 122 character 41

 

SCRIPT16386: No such interface supported 3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript, line 122 character 41

 

Any idea how it can be solved? 

  • March 21, 2011
  • Like
  • 0

I want to read a particular value from XML using the XmlStreamReader class.

 

for (Integer i = 0; i < reader.getAttributeCount(); i ++) {
     if (reader.getAttributeLocalName(i).equals('chapter')) {
         value = reader.getAttributeValueAt(i);
     }     
}

 

 

does this code work? any can who has done this before guide me??

 

Thanks 

  • October 06, 2009
  • Like
  • 0

Hi,

 

I am trying to generate apex class from fedex RATE webservice but finding an error

 

Failed to generate apex code, operation 'getRates' has more than one outout element

 

 

download wsdl from here

 

https://www.fedex.com/wpor/web/jsp/drclinks.jsp?links=downloads/wsdl/Aug09/Standard/RateService_v7.zip

 

 

 

  

  • August 28, 2009
  • Like
  • 0

Hi,

 

I am new to php integration with salesforce. I have downloaded phptoolkit13.0 And I am trying to implement a sample provided on the website. I am facing a problem that when I run the page an error come

 


Fatal error: Class 'SoapClient' not found in C:\phpToolKit\soapclient\SforceBaseClient.php on line 121

 

I downloaded nuSoapClient package and it contains different classes.

 

Can someone tell me how to integrate the nusoapclient package in to toolkit?

 

Thanks 

  • August 03, 2009
  • Like
  • 0

Hi ,

 

I tried to connect 2 DEV orgs, using SAML using the steps given the following link

http://wiki.developerforce.com/page/Implementing_Single_Sign-On_Across_Multiple_Organizations

 

Has anyone ever tried it ?

 

I am not able to access the Identity Provider Login URL for SP account's SSO settings..It shows "Insufficient priviledge".

So I am not able to login using my domain(https://domainname.my.salesforce.com/)...It displays the following error...

 

"

Error: Unable to resolve request into a Service Provider

"

Any Idea how can I resolve this?

Hi,

 

I have registered a custom domain on a force.com site. I am using Ajax using actionFunction on the main page to do some DML. However, when I access the page with the custom web address I am getting 

 

 

SCRIPT5: Access is denied.

3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript?rel=1350937585000, line 90 character 338

 

It works with the website secure address. Seems to be a cross domain scripting issue. Any workarounds for that?

 

Thanks

  • October 24, 2012
  • Like
  • 0

Hello.

 

I want to know how to eval visualforce tag(ex apex:commandLink) in Apex code.

 

String target = '<apex:commandLink action="{!printAAA}" target="_blank">LinkText<apex:param value="{!name}" name="company" assignTo="{!strCompany}"/></apex:commandLink>'

String result = eval(target);

 It couldn't work.

I want to get parsed HTML string by eval. Plesae give me any idea.

 

Regards

I know it's possible to search attachments from the Web UI, but can I use either SOSL or SOQL to query the  attachment object from APEX in order to return a list of records (e.g. contacts) that have an attachment which contains some text i would like to find?

Hi, 

 

I want to write a VF page that will combine Opportunity closeOpp and Opportunity keepOpp by taking all the products from closeOpp and putting them on keepOpp, then setting the stage on closeOpp to 'Closed.' 

 

I've written a class to do this quite nicely and it all works the way I like.  Now, I want to have a VF page on the front to call it.  I want to put two lookup fields:  one for the Opportunity to close and one for the opportunity to keep.

 

How do I set the respective variables in the class by using the standard Lookup functionality?

 

I thought I could put something like:

 

<apex:inputField value="{!closeOpp.Id}"/> 

<apex:inputField value="{!keepOpp.Id}"/>

 

 

public with sharing class opportunityMerge {

	public Opportunity closeOpp {get; set;}
	public Opportunity keepOpp {get; set;}
	List<OpportunityLineItem> newLines = new List<OpportunityLineItem>();


	public opportunityMerge() {
	
		 // might have to do something here depending on the suggestions
	}
	
	public void mergeOpps() { 
		// do all the heavy lifting here
		// loop the line items on closeOpp, clone them
		// add them to a list and insert them
	}

	public PageReference next() {
		// call mergeOpps from here
		return null;

	}

	public Pagereference cancel() {
		// cancel me
		return null;
	}
}

 

Thanks for any suggestions!!

 

:smileyhappy:

Hi ,

 

I am writing a test class fo rthe follwing integration class and my code covers 90%.

 

But I want to know if this is the right test class or not.

 

CODE:

 

public with sharing class OpportunityUpdateIntegration {

@future (callout=true)

public static void runjob(String username, String password, String jobName, String jobType) {
system.debug('inside ');
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();

req.setEndpoint('https://app.informaticaondemand.com/saas/api/1/runjob?username='+EncodingUtil.urlEncode(username, 'UTF-8')+
'&password='+EncodingUtil.urlEncode(password, 'UTF-8')+
'&jobName='+EncodingUtil.urlEncode(jobName, 'UTF-8')+
'&jobType='+EncodingUtil.urlEncode(jobType, 'UTF-8'));
req.setMethod('POST');

try
{
res = http.send(req);
}
catch(System.CalloutException e)
{
System.debug('Job Error: '+ e);
System.debug(res.toString());
}
}
}

 

TEST CLASS:

@istest
public class OpportunityUpdateIntegration_test{
static TestMethod void OpportunityUpdateIntegration_test(){
//data preparation
//insert opportunity test records
opportunity opy = new opportunity(Name = 'test opp',stagename = 'closed won',closedate=date.parse('1/1/2020'));
insert opy;
//Assert the inserted test record
system.assertequals(opy.name,'test opp');
OpportunityUpdateIntegration oui = new OpportunityUpdateIntegration();
}
}

 

Please comment on the test class if it is correct or not.

 

Thanks

JL

I use a dark color scheme with debian and it's made it difficult to see the eclipse IDE (force IDE). Is there no way to customize the color settings? Seems silly, as *every* other editor I use allows this.

Hi I have attached the mail controller class file, I have written a corresponding test class, I am not getting code coverage beyond 88%. The red lines are on the following lines in the main class, I would like to increase my code coverage to 100% if possible.

 

        Messaging.EmailFileAttachment attach = new Messaging.EmailFileAttachment();
        attach.setContentType('application/pdf');
        attach.setFileName('Call Report.pdf');
        attach.setInline(false);
        attach.Body = body;        
        
        mail.setFileAttachments(new Messaging.EmailFileAttachment[] { attach }); 
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

        PageReference p = new PageReference('/' + theId);
        return p;

 Main Class:

 

public class CallReportSendEmailClass {
 
    private final Call_Report_Summary__c t;
    
    public string sTo {get;set;}
    public string sSubject {get;set;}
    public string sBody {get;set;}
    public string sBehalf {get;set;}
    Public boolean Cancel {get;set;}

    List<String> NBContacts = new String[]{};
    String SelectedContacts = '';

    public List<Contact> TaskContact = new List<Contact>();

    public String accountName {get; set;}
    public Id accountId {get; set;}
    public List<Contact> contacts {get;set;}
    public String ConEmail {get;set;}
    public String cc {get;set;}
    public String sHtmlBody = '';
    
    
    public Date From_Date{get;set;}
    public Date To_Date{get;set;}
    Public String Account{get;set;}
    Public String Contact{get;set;}
    Public String User{get;set;}
    Public String Opportunity{get;set;}
    Public String DateRangeEquality{get;set;}
    Public String DateLiteral{get;set;}
    Public String EmailContactId{get;set;}
    Public String Email{get;set;}
    Public String Subject{get;set;}
    Public String EmailBody{get;set;}    
    Public String Region{get;set;}
    Public String Channel{get;set;}
    Public String SubChannel{get;set;}    
      
      
    public Call_Report_Summary__c EmailReportParams = new Call_Report_Summary__c();      
      
    public CallReportSendEmailClass(ApexPages.StandardController stdController) {
        this.t = (Call_Report_Summary__c)stdController.getRecord();
        
    }
    
    Public PageReference CancelEmail(){
        Cancel = true;
        String theId = ApexPages.currentPage().getParameters().get('id');
        PageReference p = new PageReference('/' + theId);
        return p;        
        
    }
 
    public PageReference SendEmail() {
    
    
 
        String theId = ApexPages.currentPage().getParameters().get('id');
        
        System.debug(' Call Report Template Id : ' + theId);
        
        PageReference pdf = new PageReference('/apex/CallReportDataComponentPage' + '?id=' + theId);
                
        if (accountName == null) {accountName = 'jayakumar.vadivelkarumbayiram@nb.com';}
        List<String> toaddress = accountName.split(';');                
                
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        mail.setToAddresses(toaddress);
        

        
        mail.setsubject(sSubject);
        
        sHtmlBody = '<html>';
        sHtmlBody = sHtmlBody + '<head><title>Tutorial: HelloWorld</title></head><body>';
        //sHtmlBody = sHtmlBody + '<table>';
            
        if (sBody != null ) {
            sBody = sBody.replace('\n', '<br>');
        }
        sHtmlBody = sHtmlBody + sBody;
        sHtmlBody = sHtmlBody + '</body></html>';
        mail.setHtmlBody(sHtmlBody);

                
        
        Blob body;
        body = pdf.getContent();
        Messaging.EmailFileAttachment attach = new Messaging.EmailFileAttachment();
        attach.setContentType('application/pdf');
        attach.setFileName('Call Report.pdf');
        attach.setInline(false);
        attach.Body = body;        
        
        mail.setFileAttachments(new Messaging.EmailFileAttachment[] { attach }); 
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

        PageReference p = new PageReference('/' + theId);
        return p;
    }
    
    public List<selectOption> getItems() {
        List<selectOption> options = new List<selectOption>();
        for (Contact nbcontactsall : [SELECT Email FROM Contact ORDER BY Email LIMIT 100]) {
            options.add(new selectOption(nbcontactsall.Email, nbcontactsall.Email));
        }
        return options;
    }
 
     public String getCC() {
        String cc = 'From Apex'; 
        return cc;
    }
 
     public void setCC(String s) {
        this.cc = 'From Apex'; 
    }

    public String[] getNBContacts() {
            return NBContacts;
    }
    
    public void setNBContacts(String[] NBContacts) {
            this.NBContacts = NBContacts;
    } 

    public String getSelectedContacts() {
            return SelectedContacts;
    }
    
    public PageReference findContacts()
    {
    if (null!=accountId)
    {
       contacts=[select id,FirstName, LastName from Contact where AccountId=:accountId];
    }
    
    return null;
  }
  
    //Method CheckNull: Will return true or false based on column value
    //Invoked From: InvokeCallReport
    //Return Value: Boolean
    
    //private boolean CheckNull(String ColumnValue){
    //    boolean val;
    //    if(ColumnValue == null){
    //        val = true;
    //    }else{
    //        val = false;
    //    }
    //    return val;
    //}  

}

 Test class:

 

@isTest
private class TestCallReportSendEmailClass{

    static testMethod void myUnitTest()
    {
        //Get a record from Call_Report_Summary__c object
        Call_Report_Summary__c CallReportSummaryId = new Call_Report_Summary__c();
        CallReportSummaryId = [select Id from Call_Report_Summary__c limit 1];

        System.debug(CallReportSummaryId.Id);
        PageReference ParentPage = new PageReference('/' + CallReportSummaryId.Id);
        
        //Get the Page Reference of the Call Report SendMultiple EmailPage
        PageReference pageRef = Page.CallReportSendMultipleEmailPage;
        pageRef.getParameters().put('id',CallReportSummaryId.Id);
        //Set the current Page
        Test.setCurrentPageReference(pageRef);
        
        Test.startTest();
        
        //create an instance of the standard controller
        ApexPages.StandardController sc = new ApexPages.standardController(CallReportSummaryId);
    
        //Create an instance of the Controller class
        CallReportSendEmailClass mySendEmailController = new CallReportSendEmailClass(sc);
        
        PageReference testPage1 = new PageReference('/apex/CallReportDataComponentPage' + '?id=' + CallReportSummaryId.Id);
        ApexPages.currentPage().getParameters().put('Id',CallReportSummaryId.Id);
        
        
        //validate CancelEmail Method
        PageReference pageCancelEmail = mySendEmailController.CancelEmail();
        
        //validate setCC Method
        mySendEmailController.setCC('arup.sarkar@nb.com');
        String get_cc = mySendEmailController.getCC();
        
        //validate findContacts Method
        PageReference findContacts = mySendEmailController.findContacts();        
        List<selectOption> items = mySendEmailController.getItems();
        String testContacts = mySendEmailController.getSelectedContacts();
        
        //validate setNBContacts/getNBContacts Method
        List<String> nbContacts = new String[]{'testing'};
        mySendEmailController.setNBContacts(nbContacts);
        String[] nbContacts1 = mySendEmailController.getNBContacts();            
        
        //validate sendemail Method
        mySendEmailController.sBody = 'This is a test body';
        PageReference send_email_page = mySendEmailController.SendEmail();
        System.assertEquals(send_email_page.getURL(), ParentPage.getURL());
        
        
        Test.stopTest();       
    
    }    

}

 

Help please ...

 

Working on my 3rd ever trigger and I am having a mysterious issue.  

 

I've used this code twice before with no incident to roll up counts from related objects.  When I modified this code to update Case with a count of Comments it works fine in my sandbox, but when I validate it in Production I get the following:"Failure Message: "System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, TicketRollUpCountPublicComments: execution of AfterInsert caused by: System.QueryException: Aggregate query does not support queryMore(), use LIMIT to restrict the results to a single batch Trigger..."

 

Is there an obvious error I am not seeing?  Any thoughts would be awesome! 

 

trigger TicketRollUpCountPublicComments on CaseComment (after insert, after update) {

set<Id> ParentIds = new set<Id>();


if(trigger.isInsert || trigger.isUpdate){
for(CaseComment c : trigger.new){
ParentIds.add(c.ParentId);
}
}


if(trigger.isDelete){
for(CaseComment c:trigger.old){
ParentIds.add(c.ParentId);
}
}

map<Id,Double> CaseMap = new map <Id,Double>();


for(aggregateResult q:[select count(Id), ParentID
from CaseComment where (CaseComment.IsPublished != FALSE) group by ParentId]){
CaseMap.put((Id)q.get('ParentId'),(Double)q.get('expr0'));
}

List<Case> CasesToUpdate = new List<Case>();


for(Case cs:[Select ID, Number_of_Comments__c from Case where Id IN :ParentIds]){
Double UserSum = CaseMap.get (cs.Id);
cs.Number_of_Comments__c=UserSum;
CasesToUpdate.add(cs);
}

update CasesToUpdate;
}

Good morning,

I wonder how I know how many sales were made in a given period of my negotiator for each company in a report.

 

I tried using formula field but no results.

 

Thanks to all who respond.

No more.

Hi,

 

I have set up a trigger that automatically submits a custom object for approval.

Currently this triggers on insert of new records, but I need to change this to trigger after a checkbox is updated, which can happen upon insert or afteran update. this is the only criteria for the trigger.

 

Appreciate any help.

 

here is my trigger:

 

trigger MDFSubmitForApproval on MDF__c (after insert) {

 

for

(MDF__c a : trigger.new) {

 

Approval.ProcessSubmitRequest app = newApproval.ProcessSubmitRequest();

app.setObjectId(a.id);

 

Approval.ProcessResult result = Approval.process(app);

 

}

}

}

 

 

  • September 01, 2011
  • Like
  • 0

Hello,

 

I'm a visualforce newbie and I'm trying to create a visualforce email template that will include the content of the knowledge article because our support team needs to be able to edit some of the articles on the fly before they send the answer to the end user.  An example would be some customers use 'cart' and some use 'basket'.  Currently they are able to edit the solution in an email, but we lose that functionality with articles.

 

I've got the vf email template with the recipienttype=contact and the relatedToType=Case, but I'm stuck on how to relate to the article since {!relatedTo.articletype__kav} was not the answer.

 

Thanks so much for any insight!

  • September 01, 2011
  • Like
  • 0

Hi all,

 

Help me to slove this issue....

 

My coding works fine, when i create as unmanaged pacakge, but when i create as managed pacakage and deploy into production, it shows the following error

 

"SObject row was retrieved via SOQL without querying the requested fielld:Opportunity.Account"

 

 Note:- Am getting this error when am create as managed package.





i have a pageblocktable and i have a list of custom objects Offers. I want to make a button where if u click on it. the current offer will be accepted, but the button doesnt work. Ive also tried commandLink and also it doesnt work. i have also used assignTo an that to doesnt work. can anybody help me on this.

<apex:PageBlockTable var="offer" value="{!Offers}">
  <apex:column >
       <apex:facet name="header">Accept</apex:facet>
         <apex:commandButton value ="Accept" action="{!AcceptOffer}">
<apex:param name="q" value="{!offer.Id}"/>
             </apex:commandButton>                               
    </apex:column>
/////controller

public class code{

public List<Offers__c> Offers {set;get}

public class AcceptOffer(){

String aOffer = ApexPages.currentPage().getParameters().get('Id')

}
}

 

Hi,

Has anyone used Eloqua API to send emails to Contacts through code?

If yes ,  then please share the WSDL with me. I am not able to get the

"EloquaService Clietn" method from the WSDL.

 

Thanks,

Shruti

  • December 28, 2011
  • Like
  • 0