• EranV
  • NEWBIE
  • 15 Points
  • Member since 2018
  • Salesforce Architect
  • Carbonite

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 6
    Replies
Hi,

In a lightning controller, I'm trying to get which quick action on the page this component was fired from (trying to reuse the same component for multiple action buttons on the same object).

After a long research I came across the quickActionAPI and its getSelectedAction() method which appears to be exactly what I need.

component.find("quickActionAPI").getSelectedActions().then( function(result){
alert(result.actions[0].actionName);

} ).catch(function(e){
if(e.errors){ alert (e.errors);
}
});

However, whenever clicking the action button, I always get an error result of "There’s no action selected in the page. Select an action to continue.". 

Using other methods such as getAvailableActions does get the available actions on the page, so obviously the page context exists. What am I missing here?

Thank you!
  • April 23, 2019
  • Like
  • 0
It seems like Apex code of Lightning Component server controllers aren't getting captured in the standard debug logs. Can anyone confirm and/or suggest a way to debug those controllers?

Thanks!
  • December 12, 2018
  • Like
  • 0
This trigger creates an opposing relationship between contacts in a juntion object when an initial one is created.  eg. i create a link from Bob to Jon, and the trigger creates the link Jon to Bob.  It also creates a comma separated string of the contact ids on each of the respective contacts each time a junction record is created or deleted. I cant seem to get past 41% coverage and not having any luck with the string concatenation part in the test class.  
trigger teamLinkUpdate on TeamMemberLink__c (before insert, after insert, after delete) {
    
    if(Trigger.isAfter){
        if(Trigger.isInsert){
                try {
                    for (TeamMemberLink__c t : Trigger.new){
                        Contact c = [SELECT Id, TeamMemberLinks_List__c  FROM Contact WHERE Id = :t.ContactLink1__c];
                        
                        List<TeamMemberLink__c> l_co = [SELECT ContactLink2__c FROM TeamMemberLink__c WHERE ContactLink1__c = :c.Id];
                        String[] stringList = new String[0];
                        for(TeamMemberLink__c lstr : l_co) {
                            String strId = String.valueOf(lstr.ContactLink2__c);
                            stringList.add(strId);  
                        }
                       String result = String.join(stringList, ', ');                   
                       c.TeamMemberLinks_List__c  = result;
    
                        update c;
                    }
                } catch (Exception e) {
                    System.debug(e);
                }
            for (TeamMemberLink__c t : Trigger.new){
                        List<TeamMemberLink__c> tchk = [Select Id from TeamMemberLink__c where ContactLink2__c = :t.ContactLink1__c];
                        if(tchk.isEmpty()){
                        
                            List<TeamMemberLink__c> rel = new List<TeamMemberLink__c>();
                                TeamMemberLink__c tnew = new TeamMemberLink__c(ContactLink1__c = t.ContactLink2__c, ContactLink2__c = t.ContactLink1__c);
                            rel.add(tnew);
                            insert rel;
                           
                        }
                }
            }
        if(Trigger.isDelete){
                try {
                    for (TeamMemberLink__c t : Trigger.old){
                        Contact c = [SELECT Id, TeamMemberLinks_List__c  FROM Contact WHERE Id = :t.ContactLink1__c];
                        
                        List<TeamMemberLink__c> l_co = [SELECT ContactLink2__c FROM TeamMemberLink__c WHERE ContactLink1__c = :c.Id];
                        String[] stringList = new String[0];
                        for(TeamMemberLink__c lstr : l_co) {
                            String strId = String.valueOf(lstr.ContactLink2__c);
                            stringList.add(strId);  
                        }
                       String result = String.join(stringList, ', ');                   
                       c.TeamMemberLinks_List__c  = result;
    
                        update c;
                    }
                } catch (Exception e) {
                    System.debug(e);
                }
            
            }
    }
}
test class
@isTest
public class teamLinkUpdateTest {
	static testMethod void testUpdate()
    {	
              
        TeamMemberLink__c tm = new TeamMemberLink__c();
        tm.ContactLink1__c = '0034A00002lPY13QAG';
        tm.ContactLink2__c = '003G000002DpiytIAB';
        insert tm;           
              
             }
}


 
i am trying to write a basica Apex code for updating user profile and role id base off  two text fields on user , last profile Id and last role Id.its a part of approval process process where a user submits request to get temprory admin access.after end time passes the user profile reverts back

tried to user Flow with process builder but its thrwing error.so I thought because updates involve two different objects, calling apex from process builder can makes updates easy.
Hi guys, 
I want to convert and REST API web-service synchronous to queable-
Here is the code which is perfectly worked for upload attachment upto 5.5 MB 64 encoded file. And I see in the document we can upload upto 12MB if this is in asynchronous in nature. 
 
@RestResource(urlMapping='/insertCaseWithAttachmentRestService/*')
global with sharing class insertCaseWithAttachmentRestAPI {
    //In this method we insert case with multiple attached files
   @httpPost
    global static Id insertCase(caseRequest req){
        Case caseObj = new Case();
        caseObj.Product__c = req.pdt;
        caseObj.Type = req.type;
        caseObj.Status = req.status;
        caseObj.Origin = req.origin;
        caseObj.Subject = req.subject;
        insert caseObj;
        system.debug('CaseId->>>>'+caseObj.Id);
        
        List<Attachment> attList = new List<Attachment>();
      
        for(attachmentRequest att : req.attList){
            attList.add(new Attachment(Name=att.attachmentName, 
                                      Body=EncodingUtil.base64Decode(att.blobString),
                                      ParentId=caseObj.Id
                                      ));
        }
        insert attList;
        
        return caseObj.Id;  
    }
    //Wrapper class
    global class caseRequest{
        String pdt {get; set;}
        String type {get; set;}
        String status {get; set;}
        String origin {get; set;}
        String subject {get; set;}
        
        List<attachmentRequest> attList {get; set;}
    }
    global class attachmentRequest{
        String attachmentName {get; set;}
        String blobString {get; set;}
    }
}

Any help to convert this into queueable interface?

Thanks in advance
Hi, 

I am creating a class that would call a rest API for some data, store in a custom object and display as a related lists in a case. However, need to figure out when the API call would be made. 

One of the solutions I thought was to create a lightning web component and embed that into case's record screen. When user opens the case and lwc loads, call the API to refersh the data. 

However, i am new to lwc, so thinking in terms of time to market. Question for this group, is it possible to call the API when a user clicks on the case id and case's record screen opens. if yes, then how should that be implmented. 

I dont have any code to share, as this is very much in my head for now!

Thanks,
Navin
 
It seems like Apex code of Lightning Component server controllers aren't getting captured in the standard debug logs. Can anyone confirm and/or suggest a way to debug those controllers?

Thanks!
  • December 12, 2018
  • Like
  • 0