• Skip K
  • NEWBIE
  • 35 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 7
    Questions
  • 12
    Replies
I have an embedded VF page on a pagelayout. I have a button on that VF page that calls javascript that invokes jQuery confirm.
            var $g = jQuery.noConflict();
			$g('head').append('<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/2.5.1/jquery-confirm.min.css" type="text/css"/>');
			
			var html = '<select style="width: 100%" . . . 
			$g.confirm({
			    title: 'Title',
			    content: html,
			    confirm: function() {
The popup modal comes up very ugly in the section of the pagelayout. I want it to popup outside of the pagelayout section and behave like a normal popup modal does for the entire page.

Any suggestions are much appreciated.
 
  • December 19, 2017
  • Like
  • 0
I'm using addError in a trigger to show an error when a user tries to enter a weekend day into a date field. When I test this negative condition the test fails. How do I test it so that running the test actually passes?
if (dt.format('E').equals('Sun')||dt.format('E').equals('Sat')) {
                try {
                    t.Close_Date__c.addError('Close Date must occur on a weekday.');
                } catch (Exception e) {
                    Boolean expectedExceptionThrown =  e.getMessage().contains('Close Date must occur on a weekday.') ? true : false;
                    System.AssertEquals(expectedExceptionThrown, true);
                }
            }

 
  • December 12, 2017
  • Like
  • 0
I created a button on the Contact object that calls a method on an apex class. It creates a custom object and forwards the user to a VF page and returns the custom object. Upon insert there is an exception thrown due to a validation rule failure. The exception is caught in a try/catch block. I want to show an error message on the Contact page displaying why the insert failed. Can someone share how to do this?
  • December 03, 2017
  • Like
  • 0
I'm redirecting to an edit page for an Opportunity. I had called the apex class from a view state of an Opportunity using a custom clone button. So I create a new Opportunity in the class and then want to forward to the new Opportunity's edit page. It looks like this:
​PageReference oppPage = new PageReference('/' + newOpp.Id+'/e');
return oppPage;
It takes me to the new Opportunity's edit page. The problem I'm having is that from the edit page the save button goes to the home page instead of the view state for the new Opportunity.

Is there any way that I can have the save button from the new Opportunity's edit page go to the view page instead of the home page? Possibly overriding the save functionality? I'm hoping to not have to create a new VF page. . . but I think that may be what I have to do. 

Thanks in advance.

 
  • February 10, 2015
  • Like
  • 0
I'm having trouble getting field.addError to work the way I think it should. I'm using the following to try and add an error to an opportunity field. It makes it through the the addError part, but nothing happens on my VF page.

public void saveOpportunity() {
//OpportunityWrapper is an inner class containg an Opportunity
  for (OpportunityWrapper oWrapper : opportunityList) {
   System.debug('--------------------');
   if (oWrapper.opp.Id == saveOppId) { //SaveOppId is passed from the VF page
    try {
     Database.SaveResult oppUpdateResult = Database.update(oWrapper.opp, false);
     String errorMessage = '';
     if(oppUpdateResult.isSuccess()) {
      saveButtonDisabledMap.put(saveOppId, true);
     } else if(!oppUpdateResult.isSuccess()) {
      saveButtonDisabledMap.put(saveOppId, false);
     
      for (Database.Error error : oppUpdateResult.getErrors()) {
       //Database.Error error = oliUpdateResults.get(i).getErrors().get(0);
       for (String s : error.getFields()) {
        System.debug('Status__c error: '+error.getMessage());
        if (s == 'Status__c') {
         System.debug('before STATUS ADDERROR');
         oWrapper.o.Status__c.addError(error.getMessage());
         System.debug('after STATUS ADDERROR');
        }
       }
      }
     }
    } catch(Exception e) {
     system.debug('Bad exception: ' + e.getMessage());   
    }
   }
  }
}


In my pageblocktable I have expand/collapse functionality that mostly works. The one issue I'm having is that it doesn't make the call to setExpandCollapse when I have one expanded and try to expand another (I don't see my debug messages in the consoleUser-added image). Any help would be greatly appreciated.

<apex:column style="vertical-align:top">
             <apex:outputpanel id="outputpanel">
                       <apex:commandLink action="{!setExpandCollapse}" rerender="outputpanel, inlinetablesec" rendered="{!!expandCollapse}" immediate="true">
                        <apex:outputtext value="{!opp.oppList.size} Product(s)"/>
                        <apex:param assignTo="{!expandCollapseTF}" value="true" name="expandCollapseTF"/>
                        <apex:param assignTo="{!expandCollapseOppId}" value="{!opp.o.Id}" name="expandCollapseOppId"/>
                           <apex:image url="{!$Resource.Plus_Image}"  title="Expand - Product List"/>
                       </apex:commandLink>

                       <apex:commandLink action="{!setExpandCollapse}" rerender="outputpanel, inlinetablesec" rendered="{!expandCollapse}" immediate="true">
                        <apex:outputtext value="{!opp.oppList.size} Product(s)"/>
                        <apex:param assignTo="{!expandCollapseTF}" value="false" name="expandCollapseTF"/>
                        <apex:param assignTo="{!expandCollapseOppId}" value="{!opp.o.Id}" name="expandCollapseOppId"/>
                           <apex:image url="{!$Resource.Minus_Image}"  title="Collapse - Product List"/>
                       </apex:commandLink>
            </apex:outputpanel>
                    </apex:column>

public void setExpandCollapse() {
  System.debug('++++++++++++++++++++++++++++++++++++++++++++++');
  expandCollapseOppId = ApexPages.currentPage().getParameters().get('expandCollapseOppId');
  expandCollapseTF = boolean.valueOf(ApexPages.currentPage().getParameters().get('expandCollapseTF'));
  System.debug('++++++++++++++++expandCollapseOppId++++++++++++++++++++++++++++++'+expandCollapseOppId);
  System.debug('++++++++++++++++expandCollapseTF++++++++++++++++++++++++++++++'+expandCollapseTF);
  expandCollapseMap.put(expandCollapseOppId, expandCollapseTF);
  System.debug('expandCollapseMap------'+expandCollapseMap);
}
  • April 25, 2014
  • Like
  • 0

I'm new to salesforce and ruby. Is there a helloworld tutorial that someone could point me to? I'm having trouble with the configuration in rails to make the connection to salesforce

 

I have installed:

ruby 1.9.3p125 (2012-02-16) [i386-mingw32]

Rails 3.2.1

 

Thanks!


Skip

I'm using addError in a trigger to show an error when a user tries to enter a weekend day into a date field. When I test this negative condition the test fails. How do I test it so that running the test actually passes?
if (dt.format('E').equals('Sun')||dt.format('E').equals('Sat')) {
                try {
                    t.Close_Date__c.addError('Close Date must occur on a weekday.');
                } catch (Exception e) {
                    Boolean expectedExceptionThrown =  e.getMessage().contains('Close Date must occur on a weekday.') ? true : false;
                    System.AssertEquals(expectedExceptionThrown, true);
                }
            }

 
  • December 12, 2017
  • Like
  • 0
I am new to Visualforce and I am doing the Trailhead: Visualforce Basics Module - Use Standard Controllers.  The instructions state:
To preview your page in the context of Lightning Experience, open your browser’s developer console and enter:
$A.get("e.force:navigateToURL").setParams(
    {"url": "/apex/pageName"}).fire();
I am not sure where to enter this.  When I enter it in the Visualforce page the text just show up on the Visualforce page preview.  I must be missing something.  Any help will be greatly appreciated.
 
I'm redirecting to an edit page for an Opportunity. I had called the apex class from a view state of an Opportunity using a custom clone button. So I create a new Opportunity in the class and then want to forward to the new Opportunity's edit page. It looks like this:
​PageReference oppPage = new PageReference('/' + newOpp.Id+'/e');
return oppPage;
It takes me to the new Opportunity's edit page. The problem I'm having is that from the edit page the save button goes to the home page instead of the view state for the new Opportunity.

Is there any way that I can have the save button from the new Opportunity's edit page go to the view page instead of the home page? Possibly overriding the save functionality? I'm hoping to not have to create a new VF page. . . but I think that may be what I have to do. 

Thanks in advance.

 
  • February 10, 2015
  • Like
  • 0
I'm having trouble getting field.addError to work the way I think it should. I'm using the following to try and add an error to an opportunity field. It makes it through the the addError part, but nothing happens on my VF page.

public void saveOpportunity() {
//OpportunityWrapper is an inner class containg an Opportunity
  for (OpportunityWrapper oWrapper : opportunityList) {
   System.debug('--------------------');
   if (oWrapper.opp.Id == saveOppId) { //SaveOppId is passed from the VF page
    try {
     Database.SaveResult oppUpdateResult = Database.update(oWrapper.opp, false);
     String errorMessage = '';
     if(oppUpdateResult.isSuccess()) {
      saveButtonDisabledMap.put(saveOppId, true);
     } else if(!oppUpdateResult.isSuccess()) {
      saveButtonDisabledMap.put(saveOppId, false);
     
      for (Database.Error error : oppUpdateResult.getErrors()) {
       //Database.Error error = oliUpdateResults.get(i).getErrors().get(0);
       for (String s : error.getFields()) {
        System.debug('Status__c error: '+error.getMessage());
        if (s == 'Status__c') {
         System.debug('before STATUS ADDERROR');
         oWrapper.o.Status__c.addError(error.getMessage());
         System.debug('after STATUS ADDERROR');
        }
       }
      }
     }
    } catch(Exception e) {
     system.debug('Bad exception: ' + e.getMessage());   
    }
   }
  }
}


In my pageblocktable I have expand/collapse functionality that mostly works. The one issue I'm having is that it doesn't make the call to setExpandCollapse when I have one expanded and try to expand another (I don't see my debug messages in the consoleUser-added image). Any help would be greatly appreciated.

<apex:column style="vertical-align:top">
             <apex:outputpanel id="outputpanel">
                       <apex:commandLink action="{!setExpandCollapse}" rerender="outputpanel, inlinetablesec" rendered="{!!expandCollapse}" immediate="true">
                        <apex:outputtext value="{!opp.oppList.size} Product(s)"/>
                        <apex:param assignTo="{!expandCollapseTF}" value="true" name="expandCollapseTF"/>
                        <apex:param assignTo="{!expandCollapseOppId}" value="{!opp.o.Id}" name="expandCollapseOppId"/>
                           <apex:image url="{!$Resource.Plus_Image}"  title="Expand - Product List"/>
                       </apex:commandLink>

                       <apex:commandLink action="{!setExpandCollapse}" rerender="outputpanel, inlinetablesec" rendered="{!expandCollapse}" immediate="true">
                        <apex:outputtext value="{!opp.oppList.size} Product(s)"/>
                        <apex:param assignTo="{!expandCollapseTF}" value="false" name="expandCollapseTF"/>
                        <apex:param assignTo="{!expandCollapseOppId}" value="{!opp.o.Id}" name="expandCollapseOppId"/>
                           <apex:image url="{!$Resource.Minus_Image}"  title="Collapse - Product List"/>
                       </apex:commandLink>
            </apex:outputpanel>
                    </apex:column>

public void setExpandCollapse() {
  System.debug('++++++++++++++++++++++++++++++++++++++++++++++');
  expandCollapseOppId = ApexPages.currentPage().getParameters().get('expandCollapseOppId');
  expandCollapseTF = boolean.valueOf(ApexPages.currentPage().getParameters().get('expandCollapseTF'));
  System.debug('++++++++++++++++expandCollapseOppId++++++++++++++++++++++++++++++'+expandCollapseOppId);
  System.debug('++++++++++++++++expandCollapseTF++++++++++++++++++++++++++++++'+expandCollapseTF);
  expandCollapseMap.put(expandCollapseOppId, expandCollapseTF);
  System.debug('expandCollapseMap------'+expandCollapseMap);
}
  • April 25, 2014
  • Like
  • 0

I have created an apex:chart and added a chartLabel to the barSeries; however, the labels are not centered over the bars.  Does anyone know how to fix this?  I can't seem to add a styleClass or use any sort of css.  Thanks!  

 

chart

 

<apex:pageBlockSection title="Future Tasks">
    <apex:chart height="250" width="800" data="{!
<apex:axis type="Category" position="bottom" fields="ActivityDate" title="Day of Month"> <apex:chartLabel orientation="vertical"/> </apex:axis> <apex:axis type="Numeric" position="left" fields="Total" title="Open Tasks"/> <apex:barSeries axis="bottom" orientation="vertical" xField="ActivityDate" yField="Total"> <apex:chartLabel display="outside" /> </apex:barSeries> </apex:chart> </apex:pageblocksection>

 

I'm new to salesforce and ruby. Is there a helloworld tutorial that someone could point me to? I'm having trouble with the configuration in rails to make the connection to salesforce

 

I have installed:

ruby 1.9.3p125 (2012-02-16) [i386-mingw32]

Rails 3.2.1

 

Thanks!


Skip

Best Practice : When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.

User-added image


      That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it. 

Thanks #Copy_Steve Molis