• SMARTIE
  • 542 Points
  • Member since 

  • Chatter
    Feed
  • 16
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 286
    Replies
The requirement that I have been given is to display a Popup Window when user presses the New button to create an Opportunity. Then depending on the answer redirect to a different page.

I tried to do create a "new" New Opportunity button but can not replace on the Home Opportunity List View. What is the best approach for this?

We are using Salesforce Classic.

Thanks in advance,

Robert
Hi All

I need to connect and external app to SalesForce. In the documentation it says
--------------
Use the following steps to create a new connected app.
From Setup, enter Apps in the Quick Find box, then select Apps and click New in the Connected Apps section of the page to start defining a connected app.
--------

Can somebody please tell me how to get to "New" in the Connected Apps section because I only have
 Connected Apps OAuth Usage (and)
 Manage Connected Apps
and none of them has a "New" button

Thanks
I want to know if this is possible in salesforce.Lets say i have an formula field and validation rule in account object. 
I want to know if based on certain condition i can modify another field inside the formula field or validation rule.
Like if (name=='drug')
 isValidRecord=false;
If user enters name as drug on account object,then on insertion the isValidRecord checkbox should be checked using validation rule or formula field.Is it possible using these?
Thanks and Regards,
Shiva RV
 
Hi All,
In my org I have 1L Accounts in account I have custom field account__c every day I need to display total amount for all account when my batch job runs (For exam  I am working in banking domino every day amount (amount__c) is updating when my batch job runs for all accounts .
Thanks In Advance 
Regards,
Rajesh
 
Hello -

In this module it tells me to:

When you signed up for Trailhead, a TP was automatically created for you. Scroll to the bottom of this page and click Launch your hands-on org to open your TP.

When I scroll to the bottom of the page, I don't see an option to Launch Your Hands-On Org.  I also don't see it anywhere else on the page.  How do I launch it so I can continue with the module?
 

Hello,

I am trying to send a pdf version of webpage to an email address.
but i always receive a blank page as attachment.
How can i resolve it.
 
<apex:page docType="html-5.0" showHeader="false" controller="TestWebPageToPdfToDelete" sidebar="false">
<apex:form>
<apex:commandButton action="{!SendThisEmail}" value="send" />
<apex:iframe src="https://google.com" scrolling="true"/> 
</apex:form>
</apex:page>


 
public class TestWebPageToPdfToDelete {

     public void SendThisEmail()
    {
        
        List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
        Messaging.EmailFileAttachment attach = new Messaging.EmailFileAttachment();
        attach.setContentType('application/pdf');
        attach.setFileName('Report.pdf');
        pagereference Pg = Page.TestWebPageToPdfToDelete;
        Blob body = pg.getcontentAsPdf();
        System.debug('$$'+body.size());
        System.debug('$$'+body);
        attach.Body = body;
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        mail.setToAddresses(new String[] { 'test@gmail.com' });
        mail.setSubject('PDF Generation');
        mail.setHtmlBody('PFA');
        mail.setFileAttachments(new Messaging.EmailFileAttachment[] { attach });    
        mails.add(mail); 
       
        if(!mails.isEmpty()) {
            Messaging.SendEmail(mails);
        }
    }
}

It is not necessary for me to send email but i just want to attach it as attachment somewhere and i should see as Pdf.

thanks for suggestion
Hi,
I would like to connect an external client using REST API.
For this I need to setup oauth for the my App.
But somehow I dont see the 'new' button within 'manage connected apps'

In my profile I have enabled
- Manage Connected Apps
- Modify all Data

But still I dont see this button.
User-added image
Manage Connected Apps view looks like:
User-added image

I am working on a cloned sandbox environment - does that make a difference ? Or do I miss permissions ?

Thanks for your help.
Detlef
Hello,
I am making a callout to an external API and am getting limit exception as the response seesm to be greater than 6 MB limit.
I already knew the Governor Limits but due to certain constraints we couldn't chunk out the response from database side.
Now SFDC needs to process the reponse correctly.

Does any one have an idea how can I divide the response into groups  so as to be able to process them correctly, without getting limit exception??

The callout is being made via Batch Job.
Since I am still writing the batch job, I tested the response with Anonymous Block and the exception occurred.
Will the batch job be able to divide and handle the response ??

Any help is appreciated.
Thanks!
I am trying to deploy a class but the deployment process has stuck in between from last one hour.
How to resolve this problem?

Thanks in advance!
I may be stupid or something, I have created a TP for the first Trailhead Admin Challenge - And I can't find the "Add App" button to start building an app?  Please advise?  I have looked EVERYWHERE :( 
Hi Friends,

My task is copy / assign 2 field values in one object (ex. Opp ) to another object (ex. Faculty ) 2 fields . How can i do this ? Means Is there any chance in customization like workflows, process builder or is it possible only developing mode ? Plz help me to fullfill this issue ?
Hello,

I have long text, stored in varialble XYZ, like below
012345678901234567890123456789012345678901234567890123456789
I want to display on VF page
01234
56789
01234
56789
01234
Hence i am looking for cuntion that can store in a string the fixed size length of string ?

thanks for suggestion !
 

I want to create an popup alert on team members birthday/anniversary(birthday and anniversary are fields from user object). How to create such popup when we login. 

Thanks in Advance

Hi,
Below is the link for web service,
Can anyone please help me how to intergate with VF page.

https://services.boatwizard.com/bridge/events/42b56bbe-d60d-46bd-b4db-3042b9b36428/boats

Thanks,
Prallavi
Hi Guys 
How to create  multi records selection from lookup in salesforce using apex 

Just Like https://www.youtube.com/watch?v=F7zeu5U-BNg
 
Trying to do the curl bulk steps in python. I can do the login via postman which returns the Session ID but when i try to run the code in python, it keeps executing without finnishing nor giving any error.  However, i am able to create a job using the session id from the postman post.
Here is the code. Any suggestion?
import requests  as r
url1='https://login.salesforce.com/services/Soap/u/39.0'
header1={'Content-Type':'text/xml; charset=UTF-8','SOAPAction':'login'}
body1=open('login.txt','r')
resp1=r.post(url1,headers=header1,data=body1)
print resp1.status_code

 
Hello Experts,
I want to learn new in salesforce like Custom setting, Field Set or the thing which is dynamically and frequently used in salesforce project.
Actuclly my team manager is on busy in some work, and i have one week time so please suggest me some topics which will be useful in my project.
Thanks.

Here is my task controller:
newTaskController
and here is my test class:

@isTest
private class newTaskTest{

    static testMethod void createTask() 
    {
        Lead lead = new Lead(LastName='febrian',company='febrian test');
        insert lead;
        Account acc = new Account(Name='test');
        insert acc;
        Opportunity opp = new Opportunity(AccountId=acc.Id,Name='test opp',StageName = 'Prospecting',CloseDate = date.today());
        insert opp;
        
        PageReference pR = Page.newTaskContactLayout;
        Test.setCurrentPage(pR);
        
        ApexPages.Standardcontroller sc = new ApexPages.Standardcontroller(lead);
        ApexPages.currentPage().getParameters().put('Id',lead.id);
        
        newTaskController ntc = new newTaskController(sc);
        
        Task tsk = new Task(Status='Completed',Subject='Reached Call',Type='Reached Call',Description='test',ActivityDate=System.today(),whoId =lead.id);
        insert tsk;
        ntc.saveTask();
        
        ApexPages.Standardcontroller sc2 = new ApexPages.Standardcontroller(opp);
        ApexPages.currentPage().getParameters().put('Id',opp.id);
        
        newTaskController ntc2 = new newTaskController(sc2);
        
        Task tsk2 = new Task(Status='Completed',Subject='Reached Call',Type='Reached Call',Description='test',ActivityDate=System.today(),whatId =lead.id);
        insert tsk2;
        ntc2.saveTask();
        
        system.assertEquals(null, pR);
    }  
    static testMethod void updateTimestamp(){
        //PageReference pr = Page.newTaskContactLayout;
        //Test.setCurrentPage(pr);
        Account acc = new Account();
        acc.Name = 'Test Account';
        insert acc;
        
        Contact cont = new Contact();
        cont.AccountId = acc.Id;
        cont.FirstName = 'FirstName';
        cont.LastName = 'LastName';
        cont.Email='flname@email.com';
        insert cont;
        
        Opportunity opp = new Opportunity(AccountId = acc.Id,Name='test opp',StageName = 'Prospecting',CloseDate = date.today());
        insert opp;
        
        test.startTest();
        //Test.setCurrentPageReference(pr);
        test.setCurrentPage(Page.newTaskContactLayout);
        
        ApexPages.StandardController sc2 = new ApexPages.StandardController(opp);
        //ApexPages.StandardSetController sc2 = new ApexPages.StandardSetController(opp);
        //sc2.setSelected(opp);
        ApexPages.currentPage().getParameters().put('Id',opp.id);
        
        newTaskController ntc2 = new newTaskController(sc2);
        cont.Follow_Up_Timestamp__c = System.NOW();
        update cont;
        ntc2.callQueue();
        
        ApexPages.StandardController sc3 = new ApexPages.StandardController(cont);
        ApexPages.currentPage().getParameters().put('Id',cont.id);
        
        newTaskController ntc3 = new newTaskController(sc3);
        cont.Follow_Up_Timestamp__c = System.now();
        update cont;
        ntc3.callQueue();
        //system.assertEquals(null, pR);  
    }
}

after run test, I got code coverage 80%. Could anybody give me solutions to resolve this? I need 100% coverage asap. Thank you.

Hello,

I wrote a trigger which is working fine in development. I am able to update accounts and peform account update dataloads without any issues. I deployed to production where I'm able to mannualy update accounts however I'm receiving the below error when I attempt an account update dataload.

System.LimitException: Too many SOQL queries: 101

I belive my trigger is offending the following trigger best pratice. Please suggest to me how to fix this issue.
5) Avoid SOQL Queries or DML statements inside FOR Loops
An individual Apex request gets a maximum of 100 SOQL queries before exceeding that governor limit. So if this trigger is invoked by a batch of more than 100 Account records, the governor limit will throw a runtime exception
 
trigger trgAccount_CustomNAICS on Account (before insert, before update) {

    for(Account acc:trigger.new)
    {        
        IF (String.isBlank(acc.NAICS_Code__c) && String.IsNotBlank(acc.NaicsCode))
        {
            try {
            System.debug('IF###AccountID: ' + acc.id);
            
            list <NAICS__c> listNaics=[select id from NAICS__c where name =:acc.NaicsCode LIMIT 1];
            
            System.debug('NAICS__c Name: ' + listNaics[0].id);
            
            acc.NAICS_Code__c = listNaics[0].id;
            }
        catch(System.Exception e){ System.debug('Exception occured: ' + e); }     
        }
        Else
        {
        System.debug('ELSE###AccountID: ' + acc.id);
        System.debug('NAICS_Code__c: ' + acc.NAICS_Code__c);
        System.debug('NaicsCode: ' + acc.NaicsCode);
        }
    }
    
}

 
Hi guys,

I got two great triggers in my sandbox (1- makes sure there is an attachment in the opportunity, 2- makes sure there is a contact role assigned in the opportunity), but which I can't deploy to production because of the test code coverage.

As I do not have any coding skills and understanding of this area, can I have one test for all the triggers? how can I do this so I can deploy my triggers?
HI,
I have Used Proces Builder to Update Lookup field, Actually lookup field is updating with Duplicate and Iam not able to get output

Ex: Input on Billingzip code as 4000
Zipcode(Lookup) is 4000
But actually Zipcode lookup need to show City as Sydeny when i update lookup manually it is updating as Sydeny

What is issue  ?
Hi,

Can we deploy only vf component to production,
if this component is using in other vf pages in production.

Thanks.
Regards
LinThaw
 
Hi Expert,

I want to create a API in salesforce with  parameter name is "Address"   this will manage by external API. Means External API will send the Address parameter to the salesforce API. How i can integrate to External API to Salesforce API.

Please suggest.

Thanks
mukesh   
I created a Lightning component. It's appearing only in the middle part of the page. And I want to extend the width of the lightning component. How can i do it? 

User-added image
 
How to change password in Rest Api in APex?
Hello,

I am trying to insert a profile called "Vendor Partner Portal" for a user in my test class. When I run the tests I am getting an error message saying  System.DmlException: Insert failed. First exception on row 0; first error: MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): User, original object: Product_Line__c: []

Stack Trace: Class.Test_salesQuotes.runasPartner: line 230, column 1
Below is my code. Can someone help me find what the issue is
 
@isTest()
public class Test_salesQuotes{
public static testmethod void method1(){

//Method 1
      // To begin, the sample application first creates the necessary records
      // to test OpportunityLineItems: Pricebook2, Product2, and PricebookEntry
      // First it creates a product with a standard price
      Product2 p = new product2(name='gack',isActive=true);
      insert p;
      Id pricebookId = Test.getStandardPricebookId();
      
      try{
        insert new PricebookEntry(pricebook2id = pricebookId, product2id = p.id, 
                                unitprice=1.0, isActive=true);
      }catch(System.DMLException e){
        //Swallow exception.. Trigger should have already created the Standard PB entry for this product.
      }
      
      // Next, it creates a new pricebook with an entry for this product
      Pricebook2 pb = new pricebook2(name='test', Ext_Ref_Id__c='asldfjlakjsdf234234');
      insert pb;
      PricebookEntry pbe = new PricebookEntry(pricebook2id=pb.id, product2id=p.id, 
                                              unitprice=1.0, isActive=true);
      insert pbe;
      // To test the first example from the sample application, the test
      // method creates an opportunity line item using the pricebook entry,
      // and then asserts that the Color field was correctly copied from the
      // product after record insertion.
      Opportunity o = new Opportunity(name='test', pricebook2id=pb.id,
      stageName='Open', CloseDate=Date.newInstance(2006,10,10));
      insert o;
      OpportunityLineItem oli = new OpportunityLineItem(opportunityid=o.id, 
                                pricebookentryid=pbe.id, unitprice=1.5, quantity=2);
      insert oli;
    
      // To test the fifth example from the sample application, the test method
      // creates a primary quote and then asserts that its Primary field cannot
      // be deselected. The code uses the try...catch testing idiom to assert
      // that the error message is correct.
      SFDC_520_Quote__c q = new SFDC_520_Quote__c(opportunity__c = o.id, primary__c = true);
      insert q;    
}

//Method2
  
  static testmethod void t1() {
    SFDC_520_Quote__c q = new SFDC_520_Quote__c(); 
    insert q; 
    salesQuotes s = new salesQuotes( new ApexPages.StandardController(q ) );
          
  }

//Method3
   public static  testMethod  void test1() {
      Product_Line__c pl = new Product_Line__c(name = 'myPL');
      insert pl;     

     Product2 p = new product2(name='gack',family='gack',productcode='gack',Product_Line__c=pl.Id,isActive=true);
      insert p;
       
       Product2 p3 = new product2(name='gack',family='gack',productcode='gack',Product_Line__c=pl.Id,isActive=true);
       p3.Loanable__c=true;
      insert p3;
      
      Id pricebookId = Test.getStandardPricebookId();
      
      try{
          insert new PricebookEntry(pricebook2id = pricebookId, product2id = p.id, 
                                unitprice=1.0, isActive=true);
      }catch(System.DMLException e){
        //Swallow exception - creating the product2 should have created a standard 
        //PricebookEntry already.
      }    
        // Next, it creates a new pricebook with an entry for this product
        Pricebook2 pb = new pricebook2(name='test', Ext_Ref_Id__c='asldfjlakjsdf234234');
        insert pb;
        PricebookEntry pbe = new PricebookEntry(pricebook2id=pb.id, product2id=p.id, 
                                              unitprice=1.0, isActive=true);
        insert pbe;
               
        Opportunity o = new Opportunity(name='test', pricebook2id=pb.id,
        stageName='Open', CloseDate=Date.newInstance(2006,10,10));
        insert o;
        OpportunityLineItem oli = new OpportunityLineItem(opportunityid=o.id, 
                                pricebookentryid=pbe.id, unitprice=1.5, quantity=2);
        insert oli;
        
    SFDC_520_Quote__c q = new SFDC_520_Quote__c(Opportunity__c = o.id); 
    insert q;
     
     id VendorPQRecordType = [select Id FROM RecordType where Name = 'Primary Cells Request'].Id;
       
      SFDC_520_Quote__c q1 = new SFDC_520_Quote__c(Opportunity__c = o.id); 
      q1.recordtypeid=VendorPQRecordType;
     insert q1; 
    
    PageReference pageRef = Page.AddQuoteLines;
        Test.setCurrentPage(pageRef);
      system.debug( 'quote id is '+q.id);
      
      ApexPages.currentPage().getParameters().put('id', q.id);
      
     salesQuotes s = new salesQuotes();
     ApexPages.currentPage().getParameters().put('reloadQuote','1');
       
     ApexPages.currentPage().getParameters().put('id', q1.id);
      
     salesQuotes s1 = new salesQuotes();
     ApexPages.currentPage().getParameters().put('reloadQuote','1');
       
     ApexPages.currentPage().getParameters().put('userTypeName', null);
       
     system.assertEquals('Standard',s1.UserTypeName);
     
     s1.CopyOperation(); 
     s.CopyOperation();
     
     s.save(  ) ;
     system.debug ( s.total );
     
     ApexPages.currentPage().getParameters().put('pid', p.id);
     s.enableAddProducts();
     s.searchStr='g';
     s.doSearch(); 
     Id [] fixedSearchResults= new Id[1];
         fixedSearchResults[0] = p.id;
         Test.setFixedSearchResults(fixedSearchResults);
     
     s.searchStr = 'gac';
     s.sortField = 'Product_Line__c';
     s.doSearch();
     
     try { s.addProd();
       // search does not find products inserted by test?
     } catch( System.NullPointerException npe) {
     }
     
     s.copyAndEdit();
 //  s.queryQuoteLines( s.quote.id); 
     s.recalc();
     
     s1.copyLineItemsFromQuoteToOppty();
       
     Account acct = test_standardobjectutil.createAccount('Test Account', false);
    // acct.IsPartner=true;
     insert acct;
       
     Contact c = test_standardobjectutil.createContact('John','Doe2', false);
     c.accountid = acct.Id;
     insert c;                  
   }

    /* Method 4*/
    
    public static  testMethod  void runasPartner() {
         
         Product_Line__c pl = new Product_Line__c(name = 'myPL');
      insert pl;     

     Product2 p = new product2(name='gack',family='gack',productcode='gack',Product_Line__c=pl.Id,isActive=true);
      insert p;
       
       Product2 p3 = new product2(name='gack',family='gack',productcode='gack',Product_Line__c=pl.Id,isActive=true);
       p3.Loanable__c=true;
      insert p3;
  Id pricebookId = Test.getStandardPricebookId();     
      try{
          insert new PricebookEntry(pricebook2id = pricebookId , product2id = p.id, 
                                unitprice=1.0, isActive=true);
      }catch(System.DMLException e){
        //Swallow exception - creating the product2 should have created a standard 
        //PricebookEntry already.
      }
      
        Pricebook2 pb = new pricebook2(name='test', Ext_Ref_Id__c='asldfjlakjsdf234234');
        insert pb;
        PricebookEntry pbe = new PricebookEntry(pricebook2id=pb.id, product2id=p.id, 
                                              unitprice=1.0, isActive=true);
        insert pbe;
     
       Opportunity o = new Opportunity(name='test', pricebook2id=pb.id,
        stageName='Open', CloseDate=Date.newInstance(2006,10,10));
        insert o;
        OpportunityLineItem oli = new OpportunityLineItem(opportunityid=o.id, 
                                pricebookentryid=pbe.id, unitprice=1.5, quantity=2);
        insert oli;
        
     SFDC_520_Quote__c q = new SFDC_520_Quote__c(Opportunity__c = o.id); 
    insert q;
   
      id VendorPQRecordType = [select Id FROM RecordType where Name = 'Primary Cells Request'].Id;
        
       SFDC_520_Quote__c q1 = new SFDC_520_Quote__c(Opportunity__c = o.id); 
         q1.recordtypeid=VendorPQRecordType;
     insert q1;
     
    PageReference pageRef = Page.AddQuoteLines;
        Test.setCurrentPage(pageRef);
      system.debug( 'quote id is '+q.id);
      
      ApexPages.currentPage().getParameters().put('id', q.id);
      
     salesQuotes s = new salesQuotes();
     ApexPages.currentPage().getParameters().put('reloadQuote','1');
       
     ApexPages.currentPage().getParameters().put('id', q1.id);
      
     salesQuotes s1 = new salesQuotes();
     ApexPages.currentPage().getParameters().put('reloadQuote','1');
       
     ApexPages.currentPage().getParameters().put('userTypeName', null);
       
     system.assertEquals('Standard',s1.UserTypeName);
     
        Account acct = test_standardobjectutil.createAccount('Test Account', false);
    // acct.IsPartner=true;
     insert acct;
       
     Contact c = test_standardobjectutil.createContact('John','Doe2', false);
     c.accountid = acct.Id;
     insert c;  
     
     Profile userProfile = [SELECT Id FROM Profile WHERE Name='Vendor Partner Portal']; 
     User u = new User(Alias = 't23', Email='teststandarduser@stemcell.com', 
     EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US', 
     LocaleSidKey='en_US', ProfileId = userProfile.Id,
     ContactId = c.id,
     TimeZoneSidKey='America/Los_Angeles', UserName='teststandarduser@stemcell.com');
     insert u;
        system.runAs(u){
            
            ApexPages.currentPage().getParameters().put('pid', p.id);
             s.enableAddProducts();
             s.searchStr='g';
            system.debug('Test exact user:'+ u); 
            s.doSearch(); 
        }
   }
   }

 
The quick question:  how do I display a chart from my SF org on a public website without allowing the site visitor to drill down into the data?   Is there a way to do this through VisualForce pages or do I need make some API calls to get the chart?  Ideally I'd like the chart to literally be just a picture so there's no risk of a user attempting to drill down into the data.   If someone could provide at least a high-level process for how to accomplish this, I'd appreciate it.   The different API options available are making my head swim.

 
Hi,

I am struggling to get single sing on to work within the full copy sandbox environment. Has anyone got it working on lightmning? All is fine in our production and dev environmnet but when we did a refesh to sandbox and i go to login it simply doesnt revert to our adfs server although i have all teh same seeting for both prod and dev environments. Any help would be welcome.