• AB Test
  • NEWBIE
  • 115 Points
  • Member since 2015

  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 14
    Replies
Hi,

I have a requirement where i need to get the list of matching records returned by duplicate rule(Standard) on click of button.I am looking for the logic to call duplicate rule on click of button.
I want to add an image to a pdf I am creating and attach it to an email that I send via apex code. I am using html and Blob.toPdf() to make the pdf. I saw this post regarding Blob.toPdf()'s limitations on images: https://help.salesforce.com/apex/HTViewSolution?id=000123577&language=en_US. It says:

"To work around this Blob.toPdf()'s limitation you may resort to one of the below approaches:
1. Store the image as a static resource and then use it in code. 
2. Use a Visual Force Page and render it as pdf "

So I tried both ways, the first one throws an error: "An error occurred while parsing the input string" (which happens with <img> tag no matter what src I use). 
And the second way is not an option for me cause I have to get the page content that I'm rendering as pdf and attach it to my email BUT "Page.getContent() does not work in Triggers or Email Services".

Is there a work around this limitations?
 
Hello All,
Please give some suggestions to me,I way is solve my issue, by trigger, workflow and validation etc..
I have a requiremnet to add an error popup when creating a Event. this when account have some checkbox is true, then only I need display some error popup, why beacuse the account have some checkbox is true.


Thanks
Bheemudu Neeli
Hey Everyone,

I have a really simple controller I wrote to pass in values based on the user that's logged in, into a visual force page that loads as a home page component/layout. 

I don't have any experience with Salesforce and have no idea on how to write a TestClass that covers the code. I don't need 100%, just enough to deploy a slight change to the code.

Here's my controller class:

Public with sharing class iframeLinkController {

    Public String CurrentUserName {get;set;}
    Public String graburlnh { get; set; }    
    Public String graburl { get; set; }
    Public String grabhgt { get; set; }

Public iframeLinkController (){

    CurrentUserName = userinfo.getName();
    
    //testing tim bauer -- should be removed
    
    //salesperson individual dashboard - resin --make sure first line starts with "if" 
    if(CurrentUserName == 'Casey Taylor'){
        graburlnh = '/01Z50000000XORa?isdtp=nv';
        graburl = 'https://na3.salesforce.com/01Z50000000XORa';
        grabhgt = '2936px';
        }

    else if(CurrentUserName == 'Ryan Carter'){
        graburlnh = '/01Z50000000XORk?isdtp=nv';
        graburl = 'https://na3.salesforce.com/01Z50000000XORk';
        grabhgt = '2145px';
        }
    
    else if(CurrentUserName == 'Bryan Schutt'){
        graburlnh = '/01Z50000000XNZn?isdtp=nv';
        graburl = 'https://na3.salesforce.com/01Z50000000XNZn';
        grabhgt = '1871px';
        }
        
    else if(CurrentUserName == 'Scott Moros'){
        graburlnh = '/01Z50000000XOS4?isdtp=nv';
        graburl = 'https://na3.salesforce.com/01Z50000000XOS4';
        grabhgt = '1870px';
        }
        
    else if(CurrentUserName == 'Jonas Lee'){
        graburlnh = '/01Z50000000XOSJ?isdtp=nv';
        graburl = 'https://na3.salesforce.com/01Z50000000XOSJ';
        grabhgt = '2119px';
        }
        
    else if(CurrentUserName == 'Mark Powers'){
        graburlnh = '/01Z50000000XORu?isdtp=nv';
        graburl = 'https://na3.salesforce.com/01Z50000000XORu';
        grabhgt = '2090px';
        }
        
    //**************************************************************************************************
    //**************************************************************************************************
        
    //sales director dashboard - resin  
    else if(CurrentUserName == 'Luke Rains'){
        graburlnh = '/01Z50000000XOST?isdtp=nv';
        graburl = 'https://na3.salesforce.com/01Z50000000XOST';
        grabhgt = '3734px';
        }
        
    else if(CurrentUserName == 'Miguel Pena'){
        graburlnh = '/01Z50000000XOST?isdtp=nv';
        graburl = 'https://na3.salesforce.com/01Z50000000XOST';
        grabhgt = '3734px';
        }
        
    else if(CurrentUserName == 'Brad Phillips'){
        graburlnh = '/01Z50000000XOST?isdtp=nv';
        graburl = 'https://na3.salesforce.com/01Z50000000XOST';
        grabhgt = '3734px';
        }                

    //**************************************************************************************************
    //**************************************************************************************************
    
    //sales director dashboard - dustpro  
    else if(CurrentUserName == 'Marc McQuesten'){
        graburlnh = '/01Z50000000XOSY?isdtp=nv';
        graburl = 'https://na3.salesforce.com/01Z50000000XOSY';
        grabhgt = '2670px';
        }   

    else if(CurrentUserName == 'Chris Shaknis'){
        graburlnh = '/01Z50000000XOSY?isdtp=nv';
        graburl = 'https://na3.salesforce.com/01Z50000000XOSY';
        grabhgt = '2670px';
        } 
        
    else{
        graburlnh = '';
        graburl = '';
        grabhgt = '';
        }
    }
}

********************************************************************************************************************************************
********************************************************************************************************************************************
********************************************************************************************************************************************

Here's my test class that is garbage, most of it is commented out:

@isTest
public class iframeLinkControllerTests{
    
    public static testMethod void testMyController() {
        
        iframeLinkController controller = new iframeLinkController();
        PageReference pageRef = Page.NoClick_Page;
        Test.setCurrentPage(pageRef);
        
        //Verify that page fails without parameters
        //System.assertEquals('/apex/failure?error=noParam', nextPage);
    
        // Add parameters to page URL
        ApexPages.currentPage().getParameters().put('qp', 'yyyy');
      
        // Instantiate a new controller with all parameters in the page
        controller = new iframeLinkController(); 
        controller.CurrentUserName = 'Casey Taylor';
        controller.graburlnh = '/01Z50000000XORa?isdtp=nv';
        controller.graburl = 'https://na3.salesforce.com/01Z50000000XORa';
        controller.grabhgt = '2936px';

        // Verify that the success page displays
        //System.assertEquals('/apex/success', nextPage);
        //Lead[] leads = [select id, email from lead where Company = 'acme'];
        //System.assertEquals('firstlast@acme.com', leads[0].email);
    
    }
}

 
User-added image

How i change the -24 (negative value will be changed to positive ) how to solve the above scenario please give some ideas.
Hi,

I have a requirement where i need to get the list of matching records returned by duplicate rule(Standard) on click of button.I am looking for the logic to call duplicate rule on click of button.
Hi,

I am trying to send sms in apex trigger using smagicinteract package.its working fine after record updation but in test classes all execution goes fine and smagicinteract object also get inserted without errors as follwos
64]|DEBUG|listOfResonse(Database.SaveResult[getErrors=();getId=a11L00000079x1UIAQ;isSuccess=true;])
only am getting error at the end as follows,
13:35:41.615 (18615499664)|CODE_UNIT_FINISHED|Workflow:Lead
13:35:41.615 (18615705686)|DML_END|[31]
13:35:41.620 (18620308312)|ENTERING_MANAGED_PKG|smagicinteract
13:35:41.705 (18705643589)|FATAL_ERROR|System.SecurityException: Empty key

(System Code)




13:35:41.705 (18705665375)|FATAL_ERROR|System.SecurityException: Empty key

(System Code)
I have a senario as follow
1. Add users.
2.Having a list of contacts as owner.
3.Assign a set of contact list to perticular user and another different set to one other user.
                                                How to achieve this so that each user can see only assigned contacts not others contact.
I want to add an image to a pdf I am creating and attach it to an email that I send via apex code. I am using html and Blob.toPdf() to make the pdf. I saw this post regarding Blob.toPdf()'s limitations on images: https://help.salesforce.com/apex/HTViewSolution?id=000123577&language=en_US. It says:

"To work around this Blob.toPdf()'s limitation you may resort to one of the below approaches:
1. Store the image as a static resource and then use it in code. 
2. Use a Visual Force Page and render it as pdf "

So I tried both ways, the first one throws an error: "An error occurred while parsing the input string" (which happens with <img> tag no matter what src I use). 
And the second way is not an option for me cause I have to get the page content that I'm rendering as pdf and attach it to my email BUT "Page.getContent() does not work in Triggers or Email Services".

Is there a work around this limitations?
 
We have a lot of unresolved emails. Is there a way to set up an automatic system where SF would retry to match an unresolved email with the current SF entries to see if they could match up, rather than individually resolving each email manually?
Hello All,
Please give some suggestions to me,I way is solve my issue, by trigger, workflow and validation etc..
I have a requiremnet to add an error popup when creating a Event. this when account have some checkbox is true, then only I need display some error popup, why beacuse the account have some checkbox is true.


Thanks
Bheemudu Neeli
Hello Every one,

When ever i run the Test class i get the following Error "System.LimitException: Too many callouts: 101"
It happens only in test Class ,but when i run the job anomusly it will handle 400 records.

I am  struck badly can you please help me out


@isTest(Seealldata=true)
private class GlobalComplaintWebSvcCalloutTest {
   
    @isTest static   void testEchoString() {  
       String batchID;
       
         string ReadyForSAP= 'Ready For SAP';
        GlobalComplaintOutbound outbound= new GlobalComplaintOutbound();
       
         Test.setMock(WebServiceMock.class, new GlobalComplaintOutbountTest());
      // Test.startTest();
      hiGcsQncreateQncreateresponse.Response_element res= new  hiGcsQncreateQncreateresponse.Response_element();
       
       List<Case> scope = new List<Case>();
       List<case> caseQuery= new List<Case>();
      
       
       case CaseList= new Case();
       
      Database.BatchableContext BC;
         GLIntegrationAuthenticationSettings__c GLIntegration = GLIntegrationAuthenticationSettings__c.getAll().get('BizTalk');
      outbound.start(BC);
       outbound.execute(BC, scope);

Mock Class

global class GlobalComplaintOutbountTest implements WebServiceMock {
  
    global void doInvoke(
           Object stub,
           Object request,
           Map<String, Object> response,
           String endpoint,
           String soapAction,
           String requestName,
           String responseNS,
           String responseName,
           String responseType) {
                 wwwHollisterComGcsQncreate.BasicHttpBinding_ITwoWayAsync respElement= new wwwHollisterComGcsQncreate.BasicHttpBinding_ITwoWayAsync();
       hiGcsQncreateQncreaterequest.QN_element Request1= new hiGcsQncreateQncreaterequest.QN_element();
        GLIntegrationAuthenticationSettings__c GLIntegration = GLIntegrationAuthenticationSettings__c.getAll().get('BizTalk');
        hiGcsQncreateQncreateresponse.QNCreateResponse_element res = new hiGcsQncreateQncreateresponse.QNCreateResponse_element();
        hiGcsQncreateQncreateresponse.Response_element response_Element= new  hiGcsQncreateQncreateresponse.Response_element();
        hiGcsQncreateQncreaterequest.complainantInfo_element complainantInfo_element= new hiGcsQncreateQncreaterequest.complainantInfo_element();
        hiGcsQncreateQncreaterequest.complaintInfo_element  complaintInfo_element= new hiGcsQncreateQncreaterequest.complaintInfo_element();
        hiGcsQncreateQncreaterequest.productInfo_element productInfo_element= new hiGcsQncreateQncreaterequest.productInfo_element();
        hiGcsQncreateQncreaterequest.QN_element  QN_Element= new hiGcsQncreateQncreaterequest.QN_element();
        List<hiGcsQncreateQncreaterequest.QN_element> QN_List= new List<hiGcsQncreateQncreaterequest.QN_element>();
        hiGcsQncreateQncreaterequest.qnInfo_element qnInfo_element= new hiGcsQncreateQncreaterequest.qnInfo_element();
        hiGcsQncreateQncreaterequest.QNSet_element QNSet_element= new hiGcsQncreateQncreaterequest.QNSet_element();
        hiGcsQncreateQncreateresponse.QNCreateResponse_element c= new  hiGcsQncreateQncreateresponse.QNCreateResponse_element();
      
               
        // wwwHollisterComGcsQncreate
        wwwHollisterComGcsQncreate.BasicHttpBinding_ITwoWayAsync BasicHttpBinding_ITwoWayAsync = new wwwHollisterComGcsQncreate.BasicHttpBinding_ITwoWayAsync();
        QN_Element.qnInfo=qnInfo_element;
         QN_Element.productInfo=productInfo_element;
         QN_Element.complaintInfo=complaintInfo_element;
         QN_List.add(QN_Element);
         QNSet_element.QN=QN_List;

        //BasicHttpBinding_ITwoWayAsync.opQNCreate(QN_List);
        respElement.endpoint_x = 'https://diid.hollister.com/QNCreateWcfService/QNCreateService.svc';
        hiGcsQncreateQncreateresponse.Response_element response_x= respElement.opQNCreate(QN_List);
         
        
             if(response_x!=null)
             {
                   Database.executeBatch(new GlobalComplaintOutbound(), 1);
           response.put('response_x', response_x);
                 }
             
               
           }
               
   }
thanks for help in advance 

Regards,
Jyo

 
Hey Everyone,

I have a really simple controller I wrote to pass in values based on the user that's logged in, into a visual force page that loads as a home page component/layout. 

I don't have any experience with Salesforce and have no idea on how to write a TestClass that covers the code. I don't need 100%, just enough to deploy a slight change to the code.

Here's my controller class:

Public with sharing class iframeLinkController {

    Public String CurrentUserName {get;set;}
    Public String graburlnh { get; set; }    
    Public String graburl { get; set; }
    Public String grabhgt { get; set; }

Public iframeLinkController (){

    CurrentUserName = userinfo.getName();
    
    //testing tim bauer -- should be removed
    
    //salesperson individual dashboard - resin --make sure first line starts with "if" 
    if(CurrentUserName == 'Casey Taylor'){
        graburlnh = '/01Z50000000XORa?isdtp=nv';
        graburl = 'https://na3.salesforce.com/01Z50000000XORa';
        grabhgt = '2936px';
        }

    else if(CurrentUserName == 'Ryan Carter'){
        graburlnh = '/01Z50000000XORk?isdtp=nv';
        graburl = 'https://na3.salesforce.com/01Z50000000XORk';
        grabhgt = '2145px';
        }
    
    else if(CurrentUserName == 'Bryan Schutt'){
        graburlnh = '/01Z50000000XNZn?isdtp=nv';
        graburl = 'https://na3.salesforce.com/01Z50000000XNZn';
        grabhgt = '1871px';
        }
        
    else if(CurrentUserName == 'Scott Moros'){
        graburlnh = '/01Z50000000XOS4?isdtp=nv';
        graburl = 'https://na3.salesforce.com/01Z50000000XOS4';
        grabhgt = '1870px';
        }
        
    else if(CurrentUserName == 'Jonas Lee'){
        graburlnh = '/01Z50000000XOSJ?isdtp=nv';
        graburl = 'https://na3.salesforce.com/01Z50000000XOSJ';
        grabhgt = '2119px';
        }
        
    else if(CurrentUserName == 'Mark Powers'){
        graburlnh = '/01Z50000000XORu?isdtp=nv';
        graburl = 'https://na3.salesforce.com/01Z50000000XORu';
        grabhgt = '2090px';
        }
        
    //**************************************************************************************************
    //**************************************************************************************************
        
    //sales director dashboard - resin  
    else if(CurrentUserName == 'Luke Rains'){
        graburlnh = '/01Z50000000XOST?isdtp=nv';
        graburl = 'https://na3.salesforce.com/01Z50000000XOST';
        grabhgt = '3734px';
        }
        
    else if(CurrentUserName == 'Miguel Pena'){
        graburlnh = '/01Z50000000XOST?isdtp=nv';
        graburl = 'https://na3.salesforce.com/01Z50000000XOST';
        grabhgt = '3734px';
        }
        
    else if(CurrentUserName == 'Brad Phillips'){
        graburlnh = '/01Z50000000XOST?isdtp=nv';
        graburl = 'https://na3.salesforce.com/01Z50000000XOST';
        grabhgt = '3734px';
        }                

    //**************************************************************************************************
    //**************************************************************************************************
    
    //sales director dashboard - dustpro  
    else if(CurrentUserName == 'Marc McQuesten'){
        graburlnh = '/01Z50000000XOSY?isdtp=nv';
        graburl = 'https://na3.salesforce.com/01Z50000000XOSY';
        grabhgt = '2670px';
        }   

    else if(CurrentUserName == 'Chris Shaknis'){
        graburlnh = '/01Z50000000XOSY?isdtp=nv';
        graburl = 'https://na3.salesforce.com/01Z50000000XOSY';
        grabhgt = '2670px';
        } 
        
    else{
        graburlnh = '';
        graburl = '';
        grabhgt = '';
        }
    }
}

********************************************************************************************************************************************
********************************************************************************************************************************************
********************************************************************************************************************************************

Here's my test class that is garbage, most of it is commented out:

@isTest
public class iframeLinkControllerTests{
    
    public static testMethod void testMyController() {
        
        iframeLinkController controller = new iframeLinkController();
        PageReference pageRef = Page.NoClick_Page;
        Test.setCurrentPage(pageRef);
        
        //Verify that page fails without parameters
        //System.assertEquals('/apex/failure?error=noParam', nextPage);
    
        // Add parameters to page URL
        ApexPages.currentPage().getParameters().put('qp', 'yyyy');
      
        // Instantiate a new controller with all parameters in the page
        controller = new iframeLinkController(); 
        controller.CurrentUserName = 'Casey Taylor';
        controller.graburlnh = '/01Z50000000XORa?isdtp=nv';
        controller.graburl = 'https://na3.salesforce.com/01Z50000000XORa';
        controller.grabhgt = '2936px';

        // Verify that the success page displays
        //System.assertEquals('/apex/success', nextPage);
        //Lead[] leads = [select id, email from lead where Company = 'acme'];
        //System.assertEquals('firstlast@acme.com', leads[0].email);
    
    }
}

 
Hi,
In an object every record goes for approval steps and there are 2 approval steps. 1st approver(BU manager) and 2nd approver (national manager). 

And the question is if 1st approver(BU manager) is same sa national manager then it must not go to 2nd approver. No had code values please. Please let me know how to achieve this. All national manager have same profile
  • August 14, 2015
  • Like
  • 0
Hello,
I am trying to create an email template with data from the product accociated to the opportunity.

When i use the product varabiles i get null data returned.

I updated a trigger to write to the opportunity line item to grab the information i needed but that is also null.

It is not possible to get a trigger to update the opportunity as it is locked when triggered.

Does anyone have any suggestions to get around this?