• Pramodh Kumar
  • SMARTIE
  • 670 Points
  • Member since 2014
  • Developer
  • Salesforce.com


  • Chatter
    Feed
  • 18
    Best Answers
  • 1
    Likes Received
  • 43
    Likes Given
  • 16
    Questions
  • 214
    Replies
Hi, i want to display the custom setting values in in aura component. 
this is my controller,
@AuraEnabled
    public static  shop__c  details()
    {
       shop__c adv= shop__c .getOrgDefaults();
     
        return adv;
    }

and in aura client controller,
getaddvalues: function(component) {
   
   var address=component.get('c.details');
   
    var self = this;
    address.setCallback(this, function(actionResult) {
    
      component.set("v.addressdetails", actionResult.getReturnValue());
      
    });
        
    $A.enqueueAction(address);
     },

amd my component:
 <aura:iteration items="{!v.addressdetails}" var="list">
                         <ui:outputText value="{!list.To_mail}" />

But with the above code iam not getting the custom setting values.
Please suggest me whther i am following the corrcet way or i have to implment  in other way......?



Regards,
Ram.
Hi,
using the ui:inputRadio control, I find the difference between selected and not selected far too subtle - all that changes is the colour of the font from a light shade of blue to a darker shade.
Is there a way of changing this?
The one proviso is that I need to use ui:inputRadio - switching to a different control is not an option.
My code so far is:
<fieldset class="slds-form-element">
          <div class="slds-form-element__control">
              <div class="slds-radio_button-group">
                <aura:iteration items="{!v.statuses}" var="statusValue">
                      <span class="slds-button slds-radio_button">
                        <ui:inputRadio change="{!c.onStatusRadio}" aura:id="status" name="radio" label="{!statusValue}" labelClass="slds-radio_button__label slds-radio_faux"/>
                      </span>
                </aura:iteration>
            </div>
        </div>
    </fieldset>

 
I have field on the opporutnity that gives the $ amount of the opportunity for the current fiscal quarter. The reason is for this is because we have opportunities that are on-going over the course of several quarters.  However not every deal is a 'on-going' opportunity. Therefore on the report the 'Total Amount for Current FQ' field displays $0.00 for some of the opportunities.

I want to create a custom formula in the report that will display the value of the 'Total Amount for Current FQ' field and if the value = $0.00, then display the Amount value instead. 

How would I write this formula?
  • Total_Amount_for_Current_FQ__c:SUM
  • AMOUNT:SUM
I appreciate the help!

 
Hi All,
I recently tried to save a case in our sandbox to test a new case object field and an error message popped up. I have been working in this sandbox since October and never had an error before. Recently I refreshed our sandbox for the Summer 16 release and I'm not sure if that possibly had an effect. Below is a screen shot of the error that mentioned "line 66" and a screenshot of the casebefore line 66. I'm at a lose of how to handle this because i dont have apex code experience. Thanks for the help, I really appreciate it!
User-added image
User-added image
Hello, 

I would like to create a hyperlink on one of my VF pages where upon click a new window opens that is 500px X 500px.  This will be for a "Help topic" - but I can not seem to figure out how to force the hyperlink to open in a new window and not a new tab.  

I tried using something like this: 
<b><apex:outputLink onclick="window.open(URL,'/apex/Probability_Guide','width=500,height=500')">Prob%</apex:outputLink></b>

And the new window is opening properly, but the page displayed in the new window is just a repeat of the page where the link resides.  How do I direct the new window to open /apex/Probability_Guide?

Thanks in advance!

John
 
Hi Team,
I have written a controller which will redirect to opportunity defaultpage and displaying opportunity default name using pagerefernce methods.I am rying to write a test class for the same.but unable to succeed.
public with sharing class MyController123{

    public MyController123(ApexPages.StandardController controller) {

    }

    public PageReference redirect() {
           PageReference pr = new PageReference('/006/e');
           
            pr.getParameters().put('retURL',ApexPages.currentPage().getparameters().get('retURL'));    
            pr.getParameters().put('ent',ApexPages.currentPage().getparameters().get('ent'));  
            pr.getParameters().put('nooverride','1');  
            pr.getParameters().put('opp3', 'DO NOT OVERRIDE');
           
            
           return pr;
      
    }
}



@isTest

public class MyControllerTest{

    static testMethod void testDefault()
    {     
    
        Opportunity opp = new(Name='Test');
        insert opp;

        PageReference pref = Page.Oppdefaultname;       
        pref.getParameters().put('id',opp.name);
        Test.setCurrentPage(pref);
        Test.startTest();
        
        ApexPages.StandardController con = new ApexPages.StandardController(opp);
        MyController123 myc = new MyController123(con);
        
        Test.stopTest();
    }

}

Thanks,
Krishna
Can I replace a custom object record "detail" page with my custom page? I created the VF page already
  • April 07, 2016
  • Like
  • 0
Hello,

The below code should show the Marketing_Request__c.Other_Channel__c inputField when a Marketing_Request__c.Channel__c of "Other" is selected, however it appears the page is not rerendering correctly. When a choice of "Other" is selected, the Other Channel inputField is never diplayed.

Any assistance resolving this is much appreciated.
<apex:page standardController="Marketing_Request__c">
    <apex:sectionHeader title="Edit Marketing Request" subtitle="{!Marketing_Request__c.Name}"/>
    <apex:form>
        <apex:pageBlock title="Edit Marketing Request" id="thePageBlock" mode="edit">
            
            <apex:pageMessages />
            
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>
            </apex:pageBlockButtons>
            
            <apex:pageBlockSection title="Branding and Channel" columns="1">
                <apex:inputField value="{!Marketing_Request__c.Branding_Type__c}" required="true"/>
                <apex:inputField value="{!Marketing_Request__c.Channel__c}" required="true">
                    <apex:actionSupport event="onchange" rerender="thePageBlock" immediate="true" status="channelStatus"/>
                </apex:inputField>
                <apex:actionStatus startText="applying change..." id="channelStatus"/>
                <apex:inputField value="{!Marketing_Request__c.Other_Channel__c}" required="true" rendered="{!Marketing_Request__c.Channel__c == 'Other'}"/>
            </apex:pageBlockSection>
            
        </apex:pageBlock>
    </apex:form>
</apex:page>
User-added image
 
I'm facing an issue while working with Visualforce remoting and angularjs. Whenever I'm putting my controller code in separate js Static resource, my code doesn't work. Please help me in figuring out this. ( Below code works if i include controller script in same VF page)

My Visualforce page
   
<apex:page controller="ApexRemoteActionPageController" docType="html-5.0">
<html>
<body>
 <div class="bootstrap" ng-app="ngApp" ng-controller="ContactCtrl" >

 <h1 align="center">Click The Button</h1>
 <button ng-click="getContacts()" class="btn btn-lg btn-default btn-block">Get Contacts</button> 

 <p>
 <ul>
 <li id="{{current.Id}}" ng-repeat="current in contacts" ng-class-even="'rowEven'">{{current.Name}}</li>
 </ul>
 </p>
</div>
<apex:stylesheet value="//cdn.jsdelivr.net/webjars/bootstrap-sf1/0.1.0-beta.6/css/bootstrap-namespaced.css"/>
 <apex:includeScript value="//ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.11/angular.min.js"/>
 <apex:includeScript value="{!$Resource.ContactCtrl}" />
</body>
</html>
</apex:page>

My Controller Static Resource
 
<script>
var ngApp= angular.module("ngApp", []); 
 ngApp.controller("ContactCtrl", ["$scope", function($scope) 
                                 {
                                  $scope.contacts = [];
                                  $scope.getContacts = function() {
               ApexRemoteActionPageController.myContacts(function(result, event) {
               $scope.contacts = result;
               $scope.$apply();
});
}
}]);
</script>

My Apex Controller
 
global class ApexRemoteActionPageController {
@RemoteAction
global static List<Contact> myContacts() 
{
   return [select id, name, email from Contact Order By LastModifiedDate DESC LIMIT 30];
}

 
The Challenge offers the following criteria, 
To complete this challenge, add a validation rule which will block the insertion of a contact if the contact is related to an account and has a mailing postal code (which has the API Name MailingPostalCode) different from the account's shipping postal code (which has the API Name ShippingPostalCode).Name the validation rule 'Contact must be in Account ZIP Code'.
A contact with a MailingPostalCode that has an account and does not match the associated Account ShippingPostalCode should return with a validation error and not be inserted.
The validation rule should ONLY apply to contact records with an associated account. Contact records with no associated parent account can be added with any MailingPostalCode value. (Hint: you can use the ISBLANK function for this check)


I have completed with the following validation rule, which I have tested and works exactly as intended: 

AND(NOT(ISBLANK( AccountId )),NOT(ISBLANK( MailingPostalCode )),MailingPostalCode <> Account.ShippingPostalCode )

I'm not sure why it doesn't complete the challenge. What am I missing? 
 
I am trying to write a custom formula field. I am trying

IF(
NOT(
ISPICKVAL( Picklist_Item__r.Type  = "Individual"),
Desired_Output__c,
Else_Desired_Output__c
))

The error I'm getting is that a ) is missing but it highlights a ,

Thanks!
I can center pageBlockTable headers no problem, but I can't get pageBlock headers to center. 

Can anybody help me with this? Thanks.
I have a visualforce page that used a custom controller to pull a list from an object and offers inline editing.  I was trying to do a quicksave button like with standard controller but i am unable to.  How can add a quicksave to a custom controller

<apex:page controller="Scllist1">
<apex:form >
 <apex:pageblock title="Open Service Call Logs">
 <apex:pageblocksection >
 <apex:pageblockTable value="{!acts}" var="s">
 <apex:column value="{!s.name}"/>
 <apex:column headerValue="Status">
 <apex:inputfield value="{!s.Status__c}"/>
 </apex:column>
 </apex:pageblockTable>
 </apex:pageblocksection>
 </apex:pageblock> 
 </apex:form>
</apex:page>

here is the controller

public class Scllist1 {
    List<Service_call_log__C> acts =[Select Name, subject__c, status__C From Service_call_log__c where status__C<>'Closed'];
    
    public List<Service_Call_log__C> getacts() 
    {
    return acts;
     }
}
Hey Developer.
I want to create one validation rule please help me...
i have three object 1.Mobile module type(field type : text and value which i entered is pc789)
2. active start mode which has (picklis-tfield type) value --- disabled,derated,normal operation
3. tamper level which has (picklist -field type) value --- tamperlevel1, tamperlevel2
 so i want to create one validate rule for if mobile module type value is pc789,
                          active start mode value is derated and tamperlevel value is tamperlevel2
it did not allow to add data in system or throw some error 
please help me???
thank you 
  • October 08, 2015
  • Like
  • 0
I have a form with a radio button and based on the selection of the button I would like to toggle divs. The id of the radio buttons are ending with :0 and :1, so I cannot use partial selector. What is the work around for this and what is the best way in general? I am a jquery user but very new to SF. Thanks.

<script type="text/javascript">
        var j$ = jQuery.noConflict();
        j$(document).ready(function(){
            j$('input[id$=contactMethod:0]').change(function(){
                   //do something
            });
        });
        
     </script>
<apex:form>
        <apex:selectRadio layout="pageDirection"  id="contactMethod" >
            <apex:selectOption itemLabel="Address" itemValue="a"/>
            <apex:selectOption itemLabel="Phone Number" itemValue="f"/>           
        </apex:selectRadio>  
        <div id="phone">
            Phone: <input type="text"/>
        </div>
        <div id="address">
            Address: <input type="text"/>
        </div>
    </apex:form>
  • October 07, 2015
  • Like
  • 0
Hi everyone,

I am trying to create a button for the case object that checks a custom checkbox when you click on it (not on the edit page but on the details page).

I have tried using this piece of code but I get an error message saying: "Unexpected token ILLEGAL"

{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/20.0/apex.js")}

var myCase = new sforce.SObject("Case.Id);
myCase.Id = "{!Case.Id}";
myCase.Initial_Interaction_Completed__c = "true";
var result = sforce.connection.update([myCase]);
window.location.reload();
 
hi guys ,

i have to implement a functionality in which i have to select a value in the picklist (inputfield), when i select the field then the  value  automatically got stored in object by calling a update method of controller , how to implement this .. 
Not sure if this is the correct forum, but lets give it a shot, I'm using the standard object, Account, which has a related custom object, JTA. 

Trying to create a custom button to show on the Account's related list properties Butons.  

I first created a List Button (see image 1) with settings shown and with no syntax errors. This is the syntax used:
 
/00U/e?who_id={!JTA__c.Id}&retURL=/{!JTA__c.Id}&cancelURL=/{!JTA__c.Id}&ent=JTA

I then placed the custom button onto the Account's Related List Properties - JTAs (screenshot #2).

When accessint the New Action Setup button, it produces a pop up window with the following error (screenshot #3): 

A problem with the OnClick JavaScript for this button or link was encountered: 
Unexpected token &

I haven't created any other content (e.g., visual force page, or apex controllers) that I may be missing in all this? 

Custom Object Name: JTA
Custom Button Name: New Action Setup


Screenshot #1

Screenshot #2

Screenshot #3
@AuraEnabled
public static void APIUserPasswordReset(){
        System.setPassword('005300000000000000','some generic password');
        }

If I run this method I am getting some weird message System.UnexpectedException: INVALID_SESSION_ID: This session is not valid for use with the API.
The same method if I ran from vf page it is working fine.

If anyone has the same issue and has a solution please let me know.


Thanks
Pramodh

 
/{!Case.Id}/s?cas7=Closed&save=1&notifyContact=0 is there anyway to replicate same function in lightning.

I tried to create quickaction, Lightning Data Service and I didnt find the notifyContact value which is used in the URL.

If you any solution or ideas to replicate please let me know

Thanks
Pramodh
allaboutlightning.com
I am getting this error message for the API 41.0 on my lightning component. If I change the API version to 38.0 it works as expected.
e.Pc is not a function

I am using Doug Ayers code for the infinite scroll functionlity with some changes
I know this issue happening because of locker service.
IIf any one has solution for this please let me know.

Thanks
Pramodh
https://allaboutlightning.com
I am having trouble using lightning:container when i want to use my react application. I am using the the react-trivia app which is presented in the dreamforce session.

this is the error i am getting container.lightning.com’s server DNS address could not be found.


Thanks
Pramodh
force:hasRecordId for the case quick action is not working. any ideas please
force:navigateToURL is not working in lightning out application. Is there any workaround? Please let me know if anyone has any solution. 

Thanks
Pramodh
Is there any way to differentiate Lightning App and Lightning Console App in terms of coding? just like sforce in classic.


Thanks
Pramodh
I having a problem invoking the lightning event in the init method...

Here is my code please look into it
<!--c:aeNotifier-->
<aura:component>
    <aura:registerEvent name="appEvent" type="c:aeEvent"/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>

    <h1>Simple Application Event Sample</h1>
    <p>
    </p>
</aura:component>

/* aeNotifierController.js */
{
    doInit : function(cmp, event) {
        // Get the application event by using the
        // e.<namespace>.<event> syntax
        var appEvent = $A.get("e.c:aeEvent");
        appEvent.setParams({
            "message" : "An application event fired me. " +
            "It all happened so fast. Now, I'm everywhere!" });
        appEvent.fire();
    }
}

<!--c:aeHandler-->
<aura:component>
    <aura:attribute name="messageFromEvent" type="String"/>
    <aura:attribute name="numEvents" type="Integer" default="0"/>

    <aura:handler event="c:aeEvent" action="{!c.handleApplicationEvent}"/>

    <p>{!v.messageFromEvent}</p>
    <p>Number of events: {!v.numEvents}</p>
</aura:component>

/* aeHandlerController.js */
{
    handleApplicationEvent : function(cmp, event) {
        var message = event.getParam("message");

        // set the handler attributes based on event data
        console.log(message)
        cmp.set("v.messageFromEvent", message);
        var numEventsHandled = parseInt(cmp.get("v.numEvents")) + 1;
        cmp.set("v.numEvents", numEventsHandled);
    }
}

<aura:application >
    
    <c:aeNotifier/>
    <c:aeHandler/>
	
</aura:application>

Thanks,
​pRAMODH.

 
I want to fire escape event trigger in lightning
var esc = $.Event("keydown", { keyCode: 27 });
$("body").trigger(esc);
just like above trigger code. I used the event methods to fire the escape 
({
    doInit : function(cmp, event, helper) {
        var divId = cmp.find("error");
        var recordId = cmp.get("v.recordId");
        var action = cmp.get("c.InviteAction");
        var errorMsg = '';
        action.setParams({"meetingId" : recordId});
        action.setCallback(this,function(res){
            var state = res.getState();
            console.log(state);
            if(state === 'SUCCESS'){
                var result = res.getReturnValue();
                console.log('result   '+result);
                if (result != null || result !='' || result != undefined) {
                    event.fire('escape');
                    var urlEvent = $A.get("e.force:navigateToURL");
                    urlEvent.setParams({
                      "url": result
                    });
                    urlEvent.fire();
                }
                else{
                    cmp.set("v.errorMsg", result);
                }
            }
            else
                cmp.set("v.errorMsg", 'There was an error please contact system administrator');
        });
        $A.enqueueAction(action);
    }
})
event, unfortunately I am getting error "Uncaught Assertion Failed!: Event.fire(): Unable to fire event. Event has already been fired. : false"

please let me know how to 
 
I have a requirement in the lightning quick actions. When I click on the action it should open in a new window, 
 
The Problem is for the first time it is working absolutely fine. but for the next time if want to use the same action again. I could not able to do.

The lightning component I used here is 

Here is Code.
({
    doInit : function(component) {
        var recordId =component.get("v.recordId")
         urlEvent.setParams({
          "url": '/'+url
        });
        urlEvent.fire();
	}
})


Thanks
 
I completed the challenge Asynchronous Apex Using Future Methods trailhead but it is not recognizing the fields I created because of the namespace. If anyone has the same issue and resolved this problem, please suggest me what to do with this scenario.



Thanks
Pramodh
Hi,

Can anyone help with the SOQL to represent data in tree structure like, 
+Industry
     +Program
         + Market Product
                 +Taxonomy Concept
                         +Concept Terms
                          term1
                          term2

and here is my schema diagram
User-added image

Thanks,
Pramodh
I have a use case to post all the child object fields to the parent object chatter box when ever the child records are edited.
Can anyone explain how nodejs is useful in salesforce development. Please explain with an example and where this nodejs modules is installed in salesforce prospective. 
I have requirement to edit parent and child on same page, I have four level deep on one page, like grand parent, parent, child and grand child.


Please help with any suggestions
Is there any way to open all the subtabs in salesforce console when you click edit button on the primary tab?

Please any suggestions.
I am having trouble using lightning:container when i want to use my react application. I am using the the react-trivia app which is presented in the dreamforce session.

this is the error i am getting container.lightning.com’s server DNS address could not be found.


Thanks
Pramodh
Hi 
I am capturing Last Name and Email on the parent component and then passing on the search results on to an embedded child Lightning Card component. Though it fetches the contact record(s) it does not display Lightning Card component (c:DisplayMembers) on the Lightning Tab. Below are the markup, controller and helper code.

Component Markup:
<aura:component implements="force:appHostable" controller="SearchDevoteeMember" >
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
   <aura:attribute name="contact" type="Contact" default="{ 'sobjectType': 'Contact' }"/>
   <aura:attribute name="contacts" type="Contact[]"/>
    <aura:attribute name="contactList" type="Contact[]"/>
   <aura:attribute name="hasErrors" type="Boolean" description="Indicate whether there were failures or not" />
    <aura:attribute name="isVisible" type="boolean" default="false"/>

  

  <div class="slds-page-header" role="banner">
      <p class="slds-text-heading--label">Search Member</p>
   </div>
   <br/>

   <aura:if isTrue="{!v.hasErrors}">
      <!-- Load error -->
      <div class="userCreateError">
         <ui:message title="Error" severity="error" closable="true">
            Please review the error messages.
         </ui:message>
      </div>
   </aura:if>

   <div class="slds-form--stacked">

      <div class="slds-form-element">
         <label class="slds-form-element__label" for="lastName">Enter last name: </label>
         <div class="slds-form-element__control">
            <ui:inputText class="slds-input" aura:id="lastName" value="{!v.contact.lastname}" required="true" />
         </div>
      </div>

      <div class="slds-form-element">
         <label class="slds-form-element__label" for="userEmail">Enter email:</label>
         <div class="slds-form-element__control">
            <ui:inputEmail class="slds-input" aura:id="userEmail" value="{!v.contact.Email}" required="true"/>
         </div>
      </div>

      <div class="slds-form-element">
         <ui:button class="slds-button slds-button--neutral" press="{!c.cancel}" label="Cancel" />
         <ui:button class="slds-button slds-button--brand" press="{!c.searchContacts}" label="Search Member" />
      </div>
   </div>
    <div>
   <!-- Iterate over the list of contacts and display them -->
   <aura:iteration var="contact" items="{!v.contactList}">
    <c:DisplayMembers contact="{!contact}"/>
</aura:iteration>
   </div>
</aura:component>

Controller JS:
({    
   doInit : function(component) {
    

   },
    
 
   searchContacts : function(component, event, helper) {
      var last = component.get("v.contact.lastname");
      var email = component.get("v.contact.Email");

         helper.searchContacts(component,last,email); 
        
       
   },
    
   cancel : function(component, event, helper) {
      $A.get("e.force:closeQuickAction").fire();
   }
})

Helper JS:
({
   searchContacts: function(component, last, email) {
      //Save the user and close the panel
      var action = component.get("c.getContacts");
         action.setParams({
            "LastName": last,
            "Email": email
         });

      action.setCallback(this, function(response) {
        // var response = a.getReturnValue();
         var state = response.getState();
         if(component.isValid() && state == "SUCCESS"){
            component.set("v.contacts", response.getReturnValue());
            component.set("v.contactList", response.getReturnValue());
            $A.get("e.force:closeQuickAction").fire();
            var toastEvent = $A.get("e.force:showToast");
            toastEvent.setParams({
                  "title": "Success!",
               "message": "Member Record(s) found!!"
            });
            toastEvent.fire();
            $A.get('e.force:refreshView').fire();
         } else if (state == "ERROR") {
            console.log('There was a problem and the state is: '+ action.getState());
         }
      });
      $A.enqueueAction(action);
      },

})

 
I am using a lightning:datatable to display various fields, including a URL field which links to a printable PDF.

In the Spring 18 release, the URL field in the datatable now points to "javascript:void(0)" in the href attribute and the title attribute now contains the url which I am trying to set in the href field. 

Can someone please provide me a code example on how to get the href refrecne to work correctly?
Good Morning, Smart Folks!

It seems that our Lightning Out app which is embedded in a Sitecore site has completely stopped working after the application of Spring 18.  Everything worked GREAT(ish) on Friday the 5th Before the update was applied.  Now, I'm getting two Javascript errors when trying to render the app.  (It doesn't even hit our custom code...so, its not our app, and a simple "Hello World" lightning app does the same thing. 

Here's the Chrome dev tools output:

aura_prod.js:formatted:23327 Uncaught TypeError: Cannot read property 'create' of undefined
at a (aura_prod.js:formatted:23327)
at new A.ea.tq (aura_prod.js:formatted:23371)
at new $ (aura_prod.js:formatted:23425)
at new (aura_prod.js:formatted:24285)
at aura_prod.js:formatted:7279
a @ aura_prod.js:formatted:23327
A.ea.tq @ aura_prod.js:formatted:23371
$ @ aura_prod.js:formatted:23425
(anonymous) @ aura_prod.js:formatted:24285
(anonymous) @ aura_prod.js:formatted:7279


lightning.out.delegate.js?v=psg1JKA5EjWqfg8XQIV7lw:133 Uncaught TypeError: Cannot read property 'isEmpty' of undefined
at HTMLScriptElement. (lightning.out.delegate.js?v=psg1JKA5EjWqfg8XQIV7lw:133)


 
We have a custom button with the following link 
/006/e?RecordType=012400000009nyy&CF00NG0000008WbYM={!User.Name}&opp3={!Account.Name}&opp4={!Account.Name}&00NG0000009jhg1={!Account.Account_Geo__c}&00NG0000008WbOg={!Account.Account_Region__c}&opp16={!Account.CurrencyIsoCode}&ForecastCategoryName=Pipeline&00NG0000009i7KH=Sales&opp9={!TODAY()+180}&opp11="Prospecting/Qualification"&opp7=5000
I am trying to convert it as follows such that the links are valid in Lightning. However, except for the Account, it still prompts to select the record type and the various values are not populated 
{!URLFOR($Action.Opportunity.New, Account.Id,[Amount="5000",Name="New Opp for {!Account.Name}", CurrencyIsoCode=TEXT(Account.CurrencyIsoCode), RecordType="012400000009nyv",Stage="Prospecting/Qualification",CloseDate=TODAY()+180])}
Can someone tell what is missing? 

Thank you in advance 

Regards,
Yogesh
 
I am calling a server side action from a Lightning Component. When an error occurs I am trying to log them in a custom object using an @future method and then throwing an AuraHandledException so the component can display the message. It seems like this won't work with AuraHandledException since it causes a Script-thrown execption in the logs which causes the @future method not to execute. Am I doing something wrong or is there another way to accomplish it?

Here is documentation I am referencing:

Error Handling Best Practices for Lightning and Apex:
https://developer.salesforce.com/blogs/2017/09/error-handling-best-practices-lightning-apex.html

An Introduction to Exception Handling:
https://developer.salesforce.com/page/An_Introduction_to_Exception_Handling
 
@auraEnabled
public static void getSomething(){
    
    try{
        //Do Something here 
        
    }catch(exception e){
        
        //@future - log error in custom object
        futureCreateErrorLog.createErrorRecord(e.getMessage());
        
        throw new AuraHandledException('Error message to display in component');
    }
    
}

User-added image
I have a requirement to prepopulate some fields (Address Fields) when standard "New" button is clicked from the related list (Contact) of Account. This was being achieved using an intermediate VF page in classic.
Now in lightning, I am able to create a component with a quick action to achieve the same - but the problem here is that the override has to be either a vf page or a lightning component.
Is there any way to have both on a single button - like when in classic, follow the old approach by redirecting to an intermediate vf and prepopulating the values and when in lightning, use the newly created lightning component?
Hi, i want to display the custom setting values in in aura component. 
this is my controller,
@AuraEnabled
    public static  shop__c  details()
    {
       shop__c adv= shop__c .getOrgDefaults();
     
        return adv;
    }

and in aura client controller,
getaddvalues: function(component) {
   
   var address=component.get('c.details');
   
    var self = this;
    address.setCallback(this, function(actionResult) {
    
      component.set("v.addressdetails", actionResult.getReturnValue());
      
    });
        
    $A.enqueueAction(address);
     },

amd my component:
 <aura:iteration items="{!v.addressdetails}" var="list">
                         <ui:outputText value="{!list.To_mail}" />

But with the above code iam not getting the custom setting values.
Please suggest me whther i am following the corrcet way or i have to implment  in other way......?



Regards,
Ram.
The structure of code is as follows:

1. Component A has 3 picklist fields and a button
2. On click of button event is fired and control goes on Application controller
3. I want to have these 3 picklist field values which user has selected above in application controller

Can someone please help.

Thanks

Yashita Goyal
Hi,

I wanted to make event work in Lightning out when Lightning component is embedded into a Visualforce page. When I include <aura:dependency resource="markup://force:*" type="Event"/> in the Lightning dependency app I get the following error

An internal server error has occurred
Error ID: 268240336-7606 (1856451655)

org.auraframework.throwable.quickfix.InvalidDefinitionException: No enum constant org.auraframework.def.DefDescriptor.DefType.Event
at .(0AdA00000004Q0n:3)
at .(0AdA00000004Q0n:3)
at org.auraframework.impl.root.DependencyDefImpl.<init>(DependencyDefImpl.java:55)
at org.auraframework.impl.root.DependencyDefImpl$Builder.build(DependencyDefImpl.java:151)
at org.auraframework.impl.root.parser.handler.DependencyDefHandler.createDefinition(DependencyDefHandler.java:93)....

Following is the code I am using for the dependency app 

<aura:application access="GLOBAL" extends="ltng:outApp">
    <aura:dependency resource="ui:button"/>
    <aura:dependency resource="markup://force:*" type="EVENT"/>
</aura:application>  


Following is the Visualforce page code 

<apex:page >
    <apex:includeLightning />

    <div id="lightning" />

    <script>
       $Lightning.use("c:lcvTest", function() {
          $Lightning.createComponent("c:spotlightAccountSetting",
          { headingLabel : "Press Me!" , headingText : "Press Me!" },
          "lightning",
          function(cmp) {
              
             ///
          
          });
        });
    </script>
</apex:page>

help would be appreciated 

Thanks
  • August 18, 2017
  • Like
  • 0
Hi all, 

I need to get some values from SLDS table while clicking on rows both single and multiple (Ctrl+mouse click) mouse clicks. How can I achieve this? 

Thanks,
  • August 16, 2017
  • Like
  • 0
Hi guys,
I'm having the error below and cannot move forward in Trailhead. 
Can someone help me to find out what is the issue?

User-added image

Thank you,
Anastasiya 
Hi exprt, 

I have a standard plicklist name is  status on case object. Now i want to use same picklist on customer portal, but only few status picklist option not all. Means in salesforce csae status plicklist have 4 option, but in customer portal same picklist will have only 2 options

Please suggest 
Here is my VF page:
<apex:page standardStylesheets="false" controller="RadioButtonTestController" showHeader="false" sidebar="false">
    <apex:form >
    	<div align="center">
          
        	<apex:selectRadio value="{!Country}" > 
               India <apex:selectOption itemValue="true"></apex:selectOption>&nbsp;&nbsp;
    		  China &nbsp;&nbsp;<apex:selectOption itemValue="false"></apex:selectOption>

    			<apex:actionSupport event="onchange" 
                        action="{!checkSelectedValue}" 
                        reRender="none"/>
        		</apex:selectRadio>
            
            <apex:commandButton value="Show country" action="{!showCountry}"/>
    	</div>
    </apex:form>
</apex:page>

Here is my Controller
public class RadioButtonTestController 
{
    public Boolean Country{get; set;}
    public void checkSelectedValue()
    {
        
        system.debug('Selected value is: '+ Country);
    }
    
    public void showCountry()
    {
        String caseId = ApexPages.currentPage().getParameters().get('CaseID');
        list<Storing_Location__c> str = [Select Country__c from Storing_Location__c where CaseNumID__c=: caseId];
        Storing_Location__c obj = new Storing_Location__c();
        if(str.size()>0)
        {
            obj.Id = str[0].Id;
        }
        
        obj.Country__c = Country;
        system.debug('Selected value is:***********************:::'+Country);
        
    }
}

 
  • August 13, 2017
  • Like
  • 0
As we all know for production deployment , Test classes will be automatically running , right !!! . We have issue with that . Half of our test classes are failing because of access issues .

Items to note :
  • 1)in Our test classes it is not using any database data .ie SeeAllData =false
  • 2)First deployment to Production . No recordtypes available
  • 3) we are pushing admin profile in the package which have access to all the records types present .
Issue: Test class is using below statement for creating dummy record with specific record type Schema.SObjectType.Contact.getRecordTypeInfosByName().get('XXXXX').getRecordTypeId();

Actual Issue : As our production doesnt have any recordtype test class is failing saying it unable to find the record type .

Now million dollar question : How we can over come this issue . it is really blocking our production deployment
I am trying to create a custom Toast event for the response.getError() list of errors, and tried to pass in the response and response.getError() as parameter to event but, it is getting passed as unformatted object instead of a list.
Hi, I am trying to a field from the active user in a component and use it in an if statement.

 <aura:if isTrue="{!$User.IsActive}">
    <td class="button"><a href="#" target="_blank">
               <lightning:button label="Join"/></a></td>
    <aura:set attribute="else">
        <td class="button"><a href="#" target="_blank">
               <lightning:button label="Renew Membership"/></a></td>
    </aura:set>
</aura:if>


I assume I am using the wrong syntax for {!$User.IsActive} as it always throws up the else and IsActive is definitely TRUE for the current user.

Thanks for any help

I am having a custom community login page.
The login function is working properly but when i try to reset the password using System.resetPassword(userId , true). I am getting following exception.
System.UnexpectedException: INVALID_SESSION_ID: This session is not valid for use with the API
The context user is the Site guest user.

This is working in Developer Sandbox orgs. But not in full copy sandbox.
What i have done so far: a lightning component that accesses data (accounts, custom objects) through an apex controller. The component in the end creates a custom object record and makes an insert. The lightning component is accessed as an action button on the account or from a tab in the navigation of the salesforce1 app.

So what i want to accomplish now is the following - be able to do all this when the user who is using the Salesforce1 app when he is OFFLINE. I understand that accounts e.g are when cashed (as recently viewed) available to read and be able to be created and later synced when going online.

I need a clear YES/ NO from you salesforce experts - when working OFFLINE - is the lightning component able to access the apex controller (or an alternative like GWT does) which gets the data from the cached accounts ? If not - are their any workarounds other than using other apps on the market. Thanks.
 
  • August 15, 2017
  • Like
  • 1
As we all know for production deployment , Test classes will be automatically running , right !!! . We have issue with that . Half of our test classes are failing because of access issues .

Items to note :
  • 1)in Our test classes it is not using any database data .ie SeeAllData =false
  • 2)First deployment to Production . No recordtypes available
  • 3) we are pushing admin profile in the package which have access to all the records types present .
Issue: Test class is using below statement for creating dummy record with specific record type Schema.SObjectType.Contact.getRecordTypeInfosByName().get('XXXXX').getRecordTypeId();

Actual Issue : As our production doesnt have any recordtype test class is failing saying it unable to find the record type .

Now million dollar question : How we can over come this issue . it is really blocking our production deployment
Hi there,

I have a trigger to keep Opportunity and Quote Line Items custom field synced. In this process I compare some of the fields of QuoteLineItem and OpportunityLineItem (to find out which ones are corresponding). So I query the items and check for some fields, including UnitPrice. When the user's profile currency is different from the related records currency, the UnitPrice is being converted in one of the objects (QuoteLineItem), but not in the other (OpportunityLineItem), so my mapping fails and my trigger does nothing because it couldn't find a matching item to sync fields. These are the queries my trigger does:
 
String qliQuery = 'select Id, QuoteId, PricebookEntryId, UnitPrice, Quantity, SortOrder, CurrencyIsoCode' + qliFields + ' from QuoteLineItem where Id in (' + qliIds + ') order by QuoteId, SortOrder ASC';
List<QuoteLineItem> qlis = Database.query(qliQuery);

String oliQuery = 'select Id, OpportunityId, PricebookEntryId, UnitPrice, Quantity, SortOrder, CurrencyIsoCode' + oliFields + ' from OpportunityLineItem where OpportunityId in (' + oppIds + ') order by OpportunityId, SortOrder ASC';
List<OpportunityLineItem> olis = Database.query(oliQuery);
Where qliFields and oliFields define which custom fields will be synced, qliIds contains the new QuoteLineItems being created, and oppIds are the IDs of the Opportunities related to the entries that fired this trigger.

These queries are done in an after insert context in the QuoteLineItem object. The result of the both queries is below (I ommited some of the irrelevant fields):
 
[Debug] COMPARING: QuoteLineItem:{Id=0QLc0000002mkaVGAQ, QuoteId=0Q0c0000000acKFCAY, PricebookEntryId=01u0B00000rRLZmQAO, UnitPrice=2855.60, Quantity=1.00, CurrencyIsoCode=USD, ...}

[Debug] COMPARING: OpportunityLineItem:{Id=00kc000000AREWCAA5, OpportunityId=006c000000GFc4SAAT, PricebookEntryId=01u0B00000rRLZmQAO, UnitPrice=1298.00, Quantity=1.00, CurrencyIsoCode=USD, ...}
Note that UnitPrice is returning 2855.60 in this query (which is 1298.00 * 2.20, our default currency conversion rate). Although, both records are registered with CurrencyIsoCode as USD (as they should be). All other records (Opportunity, Quote, PricebookEntry) are registered as USD.

So, when comparing by UnitPrice, those two records never match and my trigger fails its goal. I will remove this comparison and use other criteria for matching, so my problem will be solved for now, but I would like very much to understand this behavior.

​Any help? Thanks in advance.
Is there anyway to change the Case tab title to the SUBJECT instead of the CASE NUMBER?

Please see below snapshot. 
User-added image

Your help will be highly appreciated.

Thanks in advance!
Prashant Raiyani
When we install our package in a Summer '17 sandbox org we get an error stating our main component is not found:

org.auraframework.throwable.quickfix.DefinitionNotFoundException: No COMPONENT named markup://ascendix_search:Search found

Is this a known issue with Summer '17 or has there been a change in how components should be defined?
I've searched high and low for an example of a Validation button(javascript) for my custom object. What I need the Validate Button to do is to validate what fields should be required based on a picklist selection. I was really hoping not to do any apex. The reason for using the button on the custom object instead of standard required fields is so the Sales reps can save as they go before validating required fields.
I have an issue where some clients send sensitive data through inbound emails. I am trying to avoid that and I am looking out for a possible solution. Is there a functionality available in Salesforce where you have the chance to modify the body of this inbound email and delete out these sensitive data before it converts to case? Is this even possible to be done? Any comments or help is appreciated? 
Hello. I'm able to add an account link using a merge field on an email alert. However, I can't locate the same Account merge field when building a post to chatter group from Process builder 'merge field' button.  
Hello,

I am trying to redirect users to a VF page after the record type is chosen when creating a new Case.  If a particular Record Type is chosen, the use should be brought to a VF page, anything else should default to the normal behavior after a Record Type is selected.  I have the VF page below overriding the New bustton on Cases, and the controller to go with it.  The users are being re-directed to the VF page, but the other part is not working as it is still remaning on the VF page re-direct.  Can anyone help me get the default behavior in the controller?  Thanks,

VF Page:
<apex:page standardcontroller="Case" extensions="VF_Controller_CasePgLayout" action="{!CaseRedirect}"/>

Controller:
//Controller to Override Case creation
public with sharing class VF_Controller_CasePgLayout{

public Case c1;

    public VF_Controller_CasePgLayout(ApexPages.StandardController myController){
        this.c1 = (Case)myController.getRecord();
    }

    public PageReference CaseRedirect() {
        if(c1.RecordTypeId =='012L0000000DPwQ'){
            PageReference pageRef = new PageReference('/apex/VF_CaseDetail');
            return pageRef;
        }
        else{
            PageReference pageRef2 = new PageReference('/500/e?retURL=%2F'+c1.AccountId+'&def_account_id='+c1.AccountId+'&RecordType='+c1.RecordTypeId+'ent=Case');
            
            return pageRef2;
        }
    }
}

 
Does anyone has experience work out the Apex Class with an @RestResource annotation and this does not support transferring cookies from the proxied server to the client?

 
I would like to connect two fields, one in Accounts, and the other in Opportunity. So if I change the opportunity field, I will have the same changed value in the Account field, and vice versa. I would like to do this with two picklists. Please help.
We are trying to link documents in Sharepoint to a Documents object in Salesforce. We cannot get the Salesforce ID of the Salesforce object to prepopulate in Sharepoint, when we try to complete the process. Any ideas?
I have a class that does a callout to which returns JSON like this: 
{
	"personMatchResponse": {
		"inputParameters": {
			"parameter": {
				"name": "outputFieldOptions",
				"value": "jobFunction,managementLevel"
			}
		},
		"matchResults": {
			"personMatchResults": {
				"personMatchResult": {
					"matchPersonInput": {
						"uniqueInputId": "Zoom-1"
					},
					"personMatches": {
						"personMatch": {
							"firstName": "First",
							"lastName": "Last",
							"phone": "number",
							"currentEmployment": {
								"jobTitle": "Title",
								"jobFunction": "Function",
								"managementLevel": "C-Level",
								"company": {
									"companyId": 002400,
								}
							},
							"industry": ["Software Development & Design", "Software", "Engineering Software"]
						}
					}
				}
			}
		}
	}
}

and my code to parse is: 
//Parse JSON 
        JSONParser parser = JSON.createParser(res.getbody());
        System.JSONToken token;
        string text;

            parser.nextToken();     // 
            parser.nextToken();     // 
            parser.nextToken();     //
            parser.nextToken();     //

        while((token = parser.nextToken()) != null) {
            // Parse the object
            if ((token = parser.getCurrentToken()) != JSONToken.END_OBJECT) {
                text = parser.getText();
                if (token == JSONToken.FIELD_Name && text == 'personId' ) {
                    token=parser.nextToken();
                    thisLead.Zoom_Info_ID__c = parser.getText();
                    thisLead.zisf__zoom_id__c = parser.getText();
                    
                
                } else if (token == JSONToken.FIELD_Name && text == 'companyId') {
                    token=parser.nextToken();
                    thisLead.Zoom_Info_Company_ID__c = parser.getText();
                    
                
                }  else if (token == JSONToken.FIELD_Name && text == 'phone') {
                    token=parser.nextToken();
                    thisLead.Zoom_Info_Direct_Line__c = parser.getText();
                    
                
                }  else if (token == JSONToken.FIELD_Name && text == 'jobTitle') {
                    token=parser.nextToken();
                    thisLead.title = parser.getText();
                    
                
                } 
            } 
                                    
                // advance to next object
                //token = parser.nextToken();
                if (token == JSONToken.END_ARRAY) {             // we reached end of array 
                        break;
                }
            }


It was working fine before I added something to the request that caused the "inputParameters": { section to be returned. Is there a way to make it skip that section and just go the match results? 

Help is greatly appreciated! 

Hi All,

i need to create one validation rule..

User-added image

in each prefernce picklist field i have 3 values
primary
ok to contact
do not contact

Among all 6 fields i need to select only one field value is primary....


Any Help really Appreciate...

Thanks
varaprasad


 
Been tinkering with FullCalendar the last few weeks and am now using it to set up an opportunity calendar based on close date. I have it set up so opportunities (events) can be dragged to a different date, and I'd like that action to update the close date of the opp. I've been digging around and trying various format and date methods, but have had no luck. Below is the pertinent snippet of code and I'd appreciate any input. I know there's a ton out there regarding string to date conversions and date formatting, but after hours of research, I just can't seem to find the right mixture.

For refernece, event.id and event.start are both Strings.

On VF Page:
eventDrop: function(event) {
    updateCD(event.id,event.start);
},

In Controller:
 
public PageReference updateCD(String id, String dropDate) {
    Date newDate = date.parse(dropDate);
    
    for(Opportunity o : [select Id, CloseDate from Opportunity where Id=:id]) {
        o.CloseDate = newDate;
        update o;
    }
return null;
}
HI, I have a problem with this trigger, I am not able to update the fields contact_lago__c :(
Here's the code:
//this trigger assign an owner for each Candidatura Discover based on score.
trigger AssignOwnerDiscover on Candidatura_Tenant__c (before insert,before update) {
    //Set<ID> ids = Trigger.newMap.keySet();
    List<Candidatura_Tenant__c> c = [SELECT Id,punteggio__c,contact_lago__c,Lead__r.Country FROM Candidatura_Tenant__c WHERE Id in :Trigger.newMap.keySet()];
    if (c.size()==0)
        return;
    for(Candidatura_Tenant__c i: c){
        if(i.punteggio__c >=21){
            if(i.Lead__r.Country=='IT')
                i.contact_lago__c ='003c000000hafFz';
            else 
                i.contact_lago__c ='003a000001v34dh';
        }
        else{
                if(i.punteggio__c >14)
                    i.contact_lago__c ='00313000028crUg';
                else
                    i.contact_lago__c =i.Lead__r.Agente__c;
        }
   }
}
Thanks in advance!
I've detail page button (content source: Javascript), on Account detail page. Upon click of this button, data on Account will be sent to an inhouse application. Requirement is to show a progress bar upon the button click showing the progress of the data sent.

To summarize-

I'd like to know how can I show progress bar (animated image) with the statuses of integration completed.

For example:

Integration1 in progress..
Integration1 completed..

Integration2 in progress
Integration2 completed.

Any pointers on how to implement this is much appreciated..
I have a VisualForce page that has Two input fields with onchange actions that if I were type a currency value into a field it will update the other input field and then immediately click save will re-calculate and do the onchange event before the save of the record happens. **Mind you if I click out of the field before immediately clicking save it will calculate and save the record.
My VF page:
 
<apex:page standardController="EventPackageRevenueBreakdown__c"
	extensions="EventPackageRevenueBreakdownExt" standardStylesheets="true"
	tabstyle="EventPackageRevenueBreakdown__c" docType="html-5.0">
<apex:form >
		<apex:sectionHeader title="{!$ObjectType.EventPackageRevenueBreakdown__c.label} {!$Label.Edit}"
			subtitle="{!EventPackageRevenueBreakdown__c.Name}"
			help="{!$Label.NIBaseHelpURL}#cshid= event_package_revenue_breakdown_edit">
		</apex:sectionHeader>
		<apex:pageBlock mode="edit"
			title="{!$ObjectType.EventPackageRevenueBreakdown__c.label} {!$Label.Edit}">
			<apex:pageblockbuttons >
				<apex:commandbutton action="{!save}" value="{!$Label.Package_Save}"></apex:commandbutton>
				<apex:commandbutton action="{!SaveAndNew}"
					value="{!$Label.Package_SaveAndNew}"></apex:commandbutton>
				<apex:commandbutton action="{!cancel}"
					value="{!$Label.Package_Cancel}"></apex:commandbutton>
			</apex:pageblockbuttons>
			<apex:pagemessages ></apex:pagemessages>
			<apex:pageblocksection title="{!$Label.Package_Information}"
				id="block123">
				<apex:actionFunction name="UpdateInclusivePrice"
					action="{!UpdateInclusivePrice}" rerender="block123"></apex:actionFunction>
				<apex:actionFunction name="UpdateUnitPrice"
					action="{!UpdateUnitPrice}" rerender="block123"></apex:actionFunction>
				<apex:actionFunction name="CalculateInclusive"
					action="{!CalculateInclusive}" rerender="block123"></apex:actionFunction>
				<apex:outputpanel layout="block" styleClass="requiredBlock"></apex:outputpanel>
				<apex:inputField required="false" value="{!EventPackageRevenueBreakdown__c.UnitPrice__c}"
					label="{!IF(showInclusivePrices, $Label.ExclPrice, $ObjectType.EventPackageRevenueBreakdown__c.fields.UnitPrice__c.label)}"
					 onchange="UpdateInclusivePrice()" onkeypress="enterPress(event, 'inclusive')">
				</apex:inputField>
				<apex:inputfield required="false"
					value="{!EventPackageRevenueBreakdown__c.Location__c}"></apex:inputfield>
				<apex:pageBlockSectionItem rendered="{!NOT(showInclusivePrices)}">
				</apex:pageBlockSectionItem>
				<apex:pageBlockSectionItem rendered="{!showInclusivePrices}">
					<apex:outputLabel value="{!$Label.InclPrice}"></apex:outputLabel>
					<apex:inputField required="false" styleClass="test" value="{!EventPackageRevenueBreakdown__c.InclusiveUnitPrice__c}"
						onChange="UpdateUnitPrice()" onkeypress="enterPress(event, 'exclusive')"></apex:inputField>
				</apex:pageBlockSectionItem>
				<apex:outputfield value="{!EventPackageRevenueBreakdown__c.BookingPackageEvent__c}" />
			<apex:pageblocksectionitem >
					<apex:outputlabel >{!$ObjectType.EventPackageRevenueBreakdown__c.fields.RevenueClassification__c.label}</apex:outputlabel>
					<apex:outputpanel layout="block" styleClass="requiredInput">
						<apex:outputpanel layout="block" styleClass="requiredBlock"></apex:outputpanel>
						<apex:inputfield value="{!EventPackageRevenueBreakdown__c.RevenueClassification__c}"
							onChange="CalculateInclusive()">
						</apex:inputfield>
					</apex:outputpanel>
				</apex:pageblocksectionitem>
			</apex:pageblocksection>
			<apex:pageblocksection title="{!$Label.AdminChargeAndGratuity}">
				<apex:inputfield required="false"
					value="{!EventPackageRevenueBreakdown__c.AdminCharge__c}"
					onChange="CalculateInclusive()"></apex:inputfield>
				<apex:inputfield required="false"
					value="{!EventPackageRevenueBreakdown__c.Gratuity__c}"
					onChange="CalculateInclusive()"></apex:inputfield>
			</apex:pageblocksection>
			<apex:pageblocksection title="{!$Label.InclusivePrice}"
				rendered="{!showInclusivePrices}" collapsible="true">
				<apex:inputcheckbox value="{!EventPackageRevenueBreakdown__c.AdminIsIncludedInInclusivePrice__c}"
					onChange="CalculateInclusive()"></apex:inputcheckbox>
				<apex:inputcheckbox value="{!EventPackageRevenueBreakdown__c.GratuityIsIncludedInInclusivePrice__c}"
					onChange="CalculateInclusive()"></apex:inputcheckbox>
			</apex:pageblocksection>
		</apex:pageBlock>
		<apex:actionFunction name="saveInclusive" action="{!saveFromEnterInclusive}"></apex:actionFunction>
		<apex:actionFunction name="saveUnit" action="{!saveFromEnterUnit}"></apex:actionFunction>
	</apex:form>
	<script>
	function enterPress(e, fields)
	{
		if(e.keyCode==13)
		{
			if(e.preventDefault)
			{ 
            	e.preventDefault();
            }
            if(fields == 'inclusive')
            {
            	saveInclusive();
           }
           else
           {
           		saveUnit();
           }
        }        
    }</script>
</apex:page>

My standard Controller
 
public with sharing class EventPackageRevenueBreakdownExt {
    public boolean showInclusivePrices { get; set; }
    
    private ApexPages.standardController sController;
    private decimal price;
    private decimal inclusivePrice;
    private Id taxGroupId;
    private EventPackageRevenueBreakdown__c eprb;
    private QueryTaxGroupSchedule qtgs;
    public EventPackageRevenueBreakdownExt(ApexPages.standardController stdController) {

            //Set showInclusivePrices based on feature toggle
            if (Test.isRunningTest()) {
                showInclusivePrices = true;
            } else {
                NiPublic__c niSettings = NiPublic__c.getOrgDefaults();
                if (niSettings != null) {
                    showInclusivePrices = niSettings.EnableInclusivePrices__c;
                } else {
                    showInclusivePrices = false;
                }
                stdController.addFields(new list<string>{'UnitPrice__c'});
            }
            
            sController = stdController;
            eprb = (EventPackageRevenueBreakdown__c) sController.getRecord();
            
            if(eprb.UnitPrice__c == null){ 	
			eprb.UnitPrice__c = 0.00;}
			
			price = eprb.UnitPrice__c;			
			
            if (ApexPages.currentPage().getParameters().get('BookingPackageEventId') != null) {
                eprb.BookingPackageEvent__c = ApexPages.currentPage().getParameters().get('BookingPackageEventId');
            }

            if (eprb.BookingPackageEvent__c != null) {
            	BookingPackageEvent__c bookingPackageEvent = [Select Location__c, BookingEvent__r.TaxGroup__c From BookingPackageEvent__c Where Id = :eprb.BookingPackageEvent__c Limit 1];
                eprb.Location__c = bookingPackageEvent.Location__c;
                taxGroupId = bookingPackageEvent.BookingEvent__r.TaxGroup__c;
                qtgs = new QueryTaxGroupSchedule(taxGroupId, false);          
            }

            if (eprb.Name == null) {
                eprb.Name = '{AUTO}';
            }
           
            CalculateInclusive();           
    }

    public Pagereference SaveAndNew() {
    	
    	if(this.save() == null){
    		return null;
    	}
    	
        PageReference pageRef = page.NewEventPackageRevenueBreakdown;
        pageRef.getParameters().put('BookingPackageEventId', eprb.BookingPackageEvent__c);
        pageRef.setRedirect(true);
        return pageRef;
    }
    
    public pageReference save() {
    	
    	//throw new ni.niException(string.valueOf(eprb.UnitPrice__c));
    	
        // if the recipient revenue classification is null, add an error to the field
        // and return null to remain on the current page...
        if(eprb.RevenueClassification__c == null) {
            eprb.RevenueClassification__c.addError(label.MustEnterValue);
            return null;
        }
        else {
        	eprb.InclusiveUnitPrice__c = null;
        	eprb.UnitPrice__c = price;
            return sController.save();
        }
    }

    public Pagereference DeleteRecord() {
        string bkgPkgEventId = eprb.BookingPackageEvent__c;
        delete(eprb);
        if (bkgPkgEventId != null) {
            return(new PageReference('/' + bkgPkgEventId));
        } else {
            return(new PageReference('/'));
        }
    }

    public decimal getTotalRate() {       
        decimal totalRate = qtgs.GetInclusiveBaseRate(taxGroupId, eprb.RevenueClassification__c);
        if(eprb.AdminIsIncludedInInclusivePrice__c)
            totalRate += (eprb.AdminCharge__c==null?0: eprb.AdminCharge__c / 100)*(qtgs.GetInclusiveAdminRate(taxGroupId, eprb.RevenueClassification__c));
        if(eprb.GratuityIsIncludedInInclusivePrice__c)
            totalRate += (eprb.Gratuity__c==null?0: eprb.Gratuity__c / 100)*(qtgs.GetInclusiveGratuityRate(taxGroupId, eprb.RevenueClassification__c));
        return totalRate==null?1:totalRate;
    }
 
    public void UpdateInclusivePrice() {
    	price = eprb.UnitPrice__c;	 	 
        CalculateInclusive();
    }
    
    public void UpdateUnitPrice() {   
    	inclusivePrice = eprb.InclusiveUnitPrice__c;	
    	CalculateExclusive();      
    }
    
    public pagereference SaveFromEnterInclusive() {
		UpdateInclusivePrice(); 
		return save();
	}
	
	public pagereference SaveFromEnterUnit() {
		UpdateUnitPrice();
		return save();
	}
    
    public void CalculateInclusive() {
    	inclusivePrice = (price==null?0:price)*(getTotalRate());
    	eprb.UnitPrice__c = (price==null?0:price.setScale(2, RoundingMode.HALF_UP));
    	eprb.InclusiveUnitPrice__c = (inclusivePrice==null?0:inclusivePrice.setScale(2, RoundingMode.HALF_UP));
    }
    
    public void CalculateExclusive() {
    	price = (inclusivePrice==null?0:inclusivePrice)/(getTotalRate());
        eprb.UnitPrice__c = (price==null?0:price.setScale(2, RoundingMode.HALF_UP));
        eprb.InclusiveUnitPrice__c = (inclusivePrice==null?0:inclusivePrice.setScale(2, RoundingMode.HALF_UP));        
    }

}

Any help would greatly be appreciated. I've tried actionsupport immediate false for the save, sending an onclick event to js when save clicked an attempted to prevent the click event, and using onblur as well.
Hi All,

I have created one custom button with Content Source as URL. So whenever i click on that button the client URL will hit. Now i created one trigger(it will execute whenever a contact is updated).

My issue is, i want to fetch that custom button funcationality in trigger. How can i do that.