• Sylvie Serplet 18
  • NEWBIE
  • 10 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
I am facing a challenge which is a no go to Lightning for our Support Team. 
When wanting to Enable a Customer user (or any other Customer User action) on a Contact page in the Lightning Support Console, the action button opens the Setup menu and it overrides the current console tab. As the consequence, when a Support user is on a CTI call it is dropped.
3 problems here, first the Console disappear, the Setup page open (which require more user permission) and last the phone call drop.
Currently in Classic it opens the User record page in a sub tab in the Console. 
Response from Salesforce Support is it is normal Lightning behaviour.
Doing some search on Internet I was surprised to not find other people facing the same problem.
Any idea how I can fix this?
 
Hi,
I had a javascript button that performed some validation and update via APEX in classic and when transitioning to Lightning I create a Lightning quick action (aura component) to replace it. A button opens the action on the Opportunity detail page in a Lightning console. The component opens fine but when trying to Confirm I got an error message "Uncaught Error in $A.getCallback() [Cannot read property 'setParams' of undefined].Callback failed:apex...".
Aura component:
<aura:component implements="flexipage:availableForAllPageTypes,force:lightningQuickActionWithoutHeader,force:hasRecordId" access="global" controller="ConvertAPEX">             

    <aura:attribute name="recordId" type="String" /> 
    <aura:attribute name="opportunity" type="Opportunity"  /> 

    <div class="slds-hide">
    <lightning:recordEditForm aura:id="editform"
                                  recordId="{!v.recordId}"
                                  objectApiName="Opportunity">        
           <lightning:outputField fieldName="Account_Status__c" aura:id="status"/> 
           <lightning:outputField fieldName="IsClosed_text__c" aura:id="closed"/>  
    </lightning:recordEditForm>    
    </div>

    <div class="slds-modal__header">             
       <h2 class="slds-text-heading_medium slds-hyphenate">Convert</h2>        
    </div>

    <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
         <p>You are about to convert this record.</p>
            <br/>
         <p>Are you sure you want to continue?</p>      
    </div>

    <div class="slds-modal__footer">
        <lightning:button class="slds-button_brand" onclick="{!c.convertRegistration}" label="Confirm" />
        <lightning:button class="slds-button_neutral" onclick="{!c.cancel}" label="Cancel"/>
    </div>

Javascript Controller:
({
    convertRegistration : function(component) {        

        var opp = component.get("v.opportunity");     

        var action = component.get("c.ConvertRegistrationData");
        action.setParams({             
            OppId: component.get("v.recordId")
            });        

        action.setCallback(this, 
           function(response) {           

            var state = response.getState();  
            if (state === "SUCCESS"){  

            component.set("v.opportunity", response.getReturnValue());            

            var accStatus = component.find("status").get("v.value");
            var isClosed = component.find("closed").get("v.value");    

                if (isClosed === "Yes") {
                $A.get("e.force:closeQuickAction").fire();               
                 var toastEvent = $A.get("e.force:showToast");

                toastEvent.setParams({
                    "title": "WARNING!",
                    "type": "warning",   
                    "message": "Can only convert for OPEN opportunities."
                });

                toastEvent.fire();      
                $A.get('e.force:refreshView').fire();

                    }else if(accStatus !== "Unregistered" || accStatus !== "Registered"){
                $A.get("e.force:closeQuickAction").fire();

                toastEvent.setParams({
                    "title": "WARNING!",
                    "type": "warning",   
                    "message": "Can only convert for Unregistered, Registered accounts."
                });

                toastEvent.fire();      
                $A.get('e.force:refreshView').fire();

                }else{  
                   $A.get("e.force:closeQuickAction").fire();

                     toastEvent.setParams({
                    "title" : "Success",
                    "message" : "Merchant converted.",
                    "type" : "success"
                });

                toastEvent.fire(); 
                $A.get('e.force:refreshView').fire();

                }
            }
                else if (response.state === "ERROR") {                 

                var errors = response.getError();                
                $A.get("e.force:closeQuickAction").fire();

                toastEvent.setParams({
                    "title": "Error!",
                    "type": "error",   
                    "message": errors[0].message
                });

                toastEvent.fire();      
                $A.get('e.force:refreshView').fire();
            }    

        });

        $A.enqueueAction(action);
    },   

    cancel : function(){
        $A.get("e.force:closeQuickAction").fire();
        $A.get('e.force:refreshView').fire();
    }    

})

APEX Controller:
global class ConvertAPEX {

   @AuraEnabled
   Webservice static Boolean ConvertRegistrationData(Id OppId)
    {
        boolean retVal = false;

        Savepoint sp = Database.setSavepoint();

        try {

            rego_Branch_Settings__c rbs = rego_Branch_Settings__c.getOrgDefaults();


            Opportunity opp = [select Id
                                        ,AccountId
                                        ,Name
                                        ,Rego__c
                                        ,IsClosed_text__c
                                        ,Account_Status__c 
                                        from Opportunity where Id=: OppId];

            Account acc = [select Id                
                                    ,AccountStatus__c
                                    from Account where Id =: opp.AccountId];

            Rego__c r = getRego(acc.Id);

            boolean registrationCreated = SetFacilitatorRegistration(acc, r, opp);

            r.Provisioning_Supporting_Docs_Required__c = '';                

                //a serie of if statements              

                    {
                        update acc;
                        update opp;
                        update r;

                        retVal = true;
                    }
                    else {
                        throw Exception('Product failed to add.');
                    }   
                }
                else
                {
                    throw Exception('No need to convert.');
                }
            }
        }
        catch (Exception ex)
        {
            Error.SendErrorEmail(ex, 'Unable to Convert Registration');
            retVal = false;
            Database.rollback( sp );
        }

        return retVal;
    }

Thank you in advance for your help.
Sylvie
Hi all,
I have just started in a new company with an old very customize Salesforce instance. I have just discovered that an object has 25.000 new records created each week.
My question is how can I find which process / workflow / trigger or Apex is created these records? 
Thank you for your help.
Sylvie
 
Hi all,
I have just started in a new company with an old very customize Salesforce instance. I have just discovered that an object has 25.000 new records created each week.
My question is how can I find which process / workflow / trigger or Apex is created these records? 
Thank you for your help.
Sylvie
 
I have created a calendar view in Salesforce using Full Calendar V2 in a Visualforce page. I have different types of events (standard and custom objects). All one day event works fine, but when I have multi days event it displays one day short on the calendar. I have made a lot of research without finding a solution that works for me. I do not need to works with time only date.  The code I use was done before the addition of Momentjs. I suspect this is to do about the way the date is calculated but could not figure it how. Any help will be greatly appreciate.

Please see below my controller (to limit the lenght of the code I have put only one type of event):
public class LeaveCalendar_Controller {
public list<calEvent> events {get;set;}
 String dtFormat = 'd MMM yyyy';
 public PageReference pageLoad() {
    events = new list<calEvent>();
//Get Other Leave

        for(Leave__c leav : [select Id, Name__c, Start_Date__c, End_Date__c, Leave_Type__c, Name__r.Name, Description__c, No_of_Days__c from Leave__c where Leave_Type__c = 'Other Leave'and Start_Date__c > LAST_MONTH]){
            DateTime startDT = leav.Start_Date__c;
            DateTime endDT = leav.End_Date__c;
            calEvent leavEvent = new calEvent();
            leavEvent.title = leav.Name__r.Name +'-'+ leav.Leave_Type__c ;
            leavEvent.allDay = true;
            leavEvent.startString = startDT.format(dtformat);
            leavEvent.endString = endDT.format(dtformat);
            leavEvent.url = '/' + leav.Id;
            leavEvent.className = 'OL'; 
            leavEvent.Description = leav.Description__c;
            leavEvent.duration = leav.No_of_Days__c;
            events.add(leavEvent);    }
    }
          return null;
}
//Class to hold calendar event data

  public class calEvent{
        public String title {get;set;}
        public String type {get;set;}
        public Boolean allDay {get;set;}
        public String startString {get;private set;}
        public String endString {get;private set;}
        public String url {get;set;}
        public String className {get;set;}
        public String Description {get;set;}
        public Double duration {get;set;}
                    }
}
And my apex page:
<apex:page controller="CalendarExample_Controller" action="{!pageLoad}">
    <link href="{!$Resource.fullCalendarCSS}" rel="stylesheet" />
    <link href="{!$Resource.fullCalendarPrintCSS}" rel="stylesheet" media="print" />
    <script src="{!$Resource.jqueryminjs}"></script>
    <script src="{!$Resource.jqueryuicustomminjs}"></script>
    <script src="{!$Resource.momentminjs}"></script>
    <script src="{!$Resource.fullCalendarMinJS}"></script>
<script>
    $(document).ready(function()
          {   
                  $('#calendar').fullCalendar({
            header: {
                left: 'prev,next today',
                center: 'title',
                right: 'month,agendaWeek,agendaDay'
            },
            editable: false,
            events:
            [
                <apex:repeat value="{!events}" var="e">
                    {
                        title: "{!e.title}",
                        type: "{!e.type}",
                        start: '{!e.startString}',
                        end: '{!e.endString}',
                        url: '{!e.url}',
                        allDay: {!e.allDay},
                        className: '{!e.className}'
                    },
                </apex:repeat>
            ]
        });

    });                           
</script>
    <style>
    #cal-options {float:left;}
    #cal-legend { float:right;}
    #cal-legend ul {margin:0;padding:0;list-style:none;}
    #cal-legend ul li {margin:0;padding:5px;float:left;}
    #cal-legend ul li span {display:block; height:16px; width:16px; margin-right:4px; float:left; border-radius:4px;}
    #calendar {margin-top:16px;}
    #calendar a:hover {color:#fff !important;}
    .fc-event-inner {padding:3px;}
    .OL {background:#C10FD1;border-color:#C10FD1;}

</style>
   <apex:outputText style="font-size: large; font-weight: bold" value="Leave Calendar" />
      <apex:outputPanel id="calPanel">
    <apex:form >
        <div id="cal-legend">
            <ul>
                <li><span class="OL"></span>Other Leave</li>
            </ul>
            <div style="clear:both;"><!--fix floats--></div>
        </div>
        <div style="clear:both;"><!--fix floats--></div>
        <div id="calendar"></div>
   </apex:form>
</apex:outputPanel>         
      </apex:page>

Thank you in advance.