• Akash Deb Nath
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 14
    Replies
I currently have apex class in lightning component that is getting a specific Queue Id to assign as owner of the record the component is launched from.

This is the current  way I'm getting the id, but I'm guessing there is a better way to do this, any ideas?
Group marketingQueue = [SELECT id,Name FROM Group WHERE Type = 'Queue' and DeveloperNAME = 'MarketingProspectLeads'];
         	ID marketingQueueId = marketingQueue.id;
            //l.OwnerId = UserInfo.getUserId();
            system.debug('marketingQueue');
            l.OwnerId = marketingQueueId;

I just need to make sure this can't break so I'm assuming I should add some error checking or be doing this a different way.  Thanks in advance.  
Hello All,
I'm extremely new to lightning components and trying to replace some of our custom javascript buttons with lightning compatible options.  One button takes ownership of a lead.  I found a post that does something similar for cases and tried to modify it for my purpose: https://learnownlightning.blogspot.com/2018/01/change-owner-update-record-using.html

It seems to be doing the record update based on apex code, but it launches a quickaction screen with a cancel button that doens't go away.  I've seen it posted that you can use 
$A.get("e.force:closeQuickAction").fire();
It is not working for me.  I'm not sure if I'm not puting that code in the right place but I'm hoping someone can help me figure out a way to click the quick action button, have the lead change ownership, and that's it.

Here is my code so far:
Component:
<aura:component implements="force:lightningQuickAction,force:hasRecordId" controller="LightningComponent_MoveToMarketing" access="global" >
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>    
</aura:component>
Controller:
({
 doInit : function(component, event, helper) {
        var leadId = component.get("v.recordId");
        var action = component.get("c.changeOwnerMethod");
        action.setParams({
            leadId : leadId
        });
        action.setCallback(this, function(response) {
            if(response.getState() === "SUCCESS") {
                console.log("Lead Owner Changed To Current login User");
             var rec = response.getReturnValue();
             console.log(rec.OwnerId);
            }
        });
        $A.enqueueAction(action);
$A.get("e.force:closeQuickAction").fire();
        $A.get('e.force:refreshView').fire();
 }
})

Apex Class:
public class LightningComponent_MoveToMarketing {

    @AuraEnabled
    public static Lead changeOwnerMethod(Id leadId) {
        if(leadId != null) {
            Lead l = [SELECT OwnerId FROM Lead WHERE Id = :leadId];
         l.OwnerId = UserInfo.getUserId();
//update case Ownerid with loggedin userid.
            update l;
            return l;
        }
        return null;
    }

}

Any ideas?
 
I am getting this error when trying to do the "Lightning Experience Rollout Specialist"

The AccountTab Visualforce page does not include one or both of the following: the apex:slds tag in the page, or the slds-table value in the table.


My code is as follows:
 
<apex:page standardStylesheets="false" standardController="Account" recordSetVar="accounts" tabStyle="account" applyHtmlTag="false" applyBodyTag="false" showHeader="false">
   <head>
       <apex:slds />
    </head> 
	<body>
    <div class="slds-scope">     
        <table class="slds-table">
  			<thead>
    			<tr class="slds-text-title_caps">
      				<th scope="col">
        				<div class="slds-truncate" title="{!$ObjectType.Account.Fields.Name.Label}">{!$ObjectType.Account.Fields.Name.Label}</div>
      				</th>
    			</tr>
  			</thead>
  			<tbody>
    			<apex:repeat value="{!accounts}" var="a">
                <tr>
                  <td data-label="Account Name">
                    <div class="slds-truncate" ><apex:outputLink value="{!URLFOR($Action.Account.View, a.id)}">{!a.name}</apex:outputLink></div>
                  </td>
      
    			</tr>
                </apex:repeat>
            </tbody>
        </table>
     <!--   
     <div class="slds-scope">
        <apex:pageBlock >
            <apex:pageBlockTable value="{!accounts}" var="a" styleClass="slds">
                <apex:column headerValue="{!$ObjectType.Account.Fields.Name.Label}">
                    <apex:outputLink value="{!URLFOR($Action.Account.View, a.id)}">{!a.name}</apex:outputLink>
                </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlock>-->
    </div>
        </body>
</apex:page>

 
Hi Team...  
         am trying to develop a "Online Movie Ticket Booking App". Do you guys have any previous developed app for this type of application. If so, can you share it with me, I can use as reference or give me suggestions.  

​Thanks,Lucky

I must be missing something..

 

The date is always 1 day behind when formating like so:

 

datetime xDate = o.campaign_start_date__c;
			
String xxDate = xDate.format('yyyy-dd-MM');
system.debug('sdate :' +xxDate);

 

I set the above field to 8/16/2011

 

and in debug it shows up as: 2011-15-08

 

Everytime I change it the debug value is shown as 1 day behind.. Im sure I could to +1, but could someone help me understand why this is happening?

 

Thanks!
Jacob Davis

  • August 18, 2011
  • Like
  • 1