• SamHowle
  • NEWBIE
  • 5 Points
  • Member since 2018
  • Salesforce Developer


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 16
    Replies
I have installed the Salesforce CLI package and it is working fine from the terminal window.
I have installed the Salesforce Extensions package into Visual Studio Code and all looks fine.
However when I enter Command-Shift-P and type something like SFDX: Create Package I get a notification to install the Salesforce CLI package.
All the sfdx commands work fine from with VS Code’s terminal window.

I am at a loss as to what is wrong. 
I am running on a Mac and all the help articles are for Windows are direct you towards missing or incorrect Path statements. Not much help for a Mac user.

I have tried completely removing the SFDX package (via rm statements from terminal) along with removing the Salesforce extensions from VSCode. After reinstalling all this - same problem.

Any ideas or help would be appreciated.
 
Hello,
 
i am facing an error with a lightning component since this weekend. I can't figure out why this message occures
Uncaught Uncaught error in markup://aura:valueChange [Cannot read property 'config' of undefined]
CMP
<aura:component  controller="CtrlBtnCloseCase" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction">
    <aura:attribute name="recordId" type="Id" />
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <aura:attribute name="recordTypeId" type="Id" />
    <aura:attribute name="case" type="Case" default="{ 'sobjectType': 'Case'}"/>
    <aura:attribute name="toMail" type="Boolean" default="false"/>
    <aura:attribute name="errorMessage" type="String"/>
    <aura:attribute name="listReason" type="String" default= "[]"/>
    <aura:attribute name="listSkillsOptions1" type="List" default="[]"/>
    <aura:attribute name="reason" type="String"/>
    
    <lightning:overlayLibrary aura:id="overlayLib"/>
    
    <div class="slds-form-element" aura:id="main">
        <lightning:recordEditForm aura:id="salesOpsRecordCreate"
                                  recordTypeId="{!v.recordTypeId}"
                                  objectApiName="Case">
        <div class="slds-form-element__row">
            <div class="slds-form-element">
                <ui:inputSelect label="{!$Label.c.CloseCaseModalStatus}" class="dynamic" aura:id="InputSelectDynamic" value="{!v.case.Status}" required="true"/>
            </div>
           <!--<div class="slds-form-element">
                <div class="slds-form-element__control">
                    <ui:inputSelect value="{!v.listReason}" class="dynamic" aura:id="caseReason" label="{!$Label.c.CloseCaseModalReason}" updateOn="change" />                    
                </div>
            
            </div>-->
            <div class="slds-form-element">
                <div class="slds-form-element__control">
                    <lightning:inputField fieldName="Reason" aura:id="caseReason" required="true" class="customRequired" onchange="{!c.getCaseValue}" value="{!v.reason}" selected="{!v.reason}"/>                    
                </div>
            
            </div>
            <div class="slds-form-element">
                <div class="slds-form-element__control">
                    <ui:inputText value="{!v.case.Comments}" aura:id="caseComment" label="{!$Label.c.CloseCaseModalComment}" updateOn="change"/>                    
                </div>
            </div>
            <div class="slds-form-element">
                <div class="slds-form-element__control">
                    <ui:inputCheckbox value="{!v.case.Send_Closure_Email__c}" aura:id="caseSendMail" label="{!$Label.c.CloseCaseModalSendmail}"/>                    
                </div>
            </div>
            <div class="slds-form-element">
                <br/>
                <lightning:button class="slds-button slds-button_brand" aura:id="editDataButton" label="{!$Label.c.CloseCaseModalSaveBtn}" onclick="{!c.doSaveCase}"/>
                <lightning:button class="slds-button slds-button_neutral" aura:id="cancelButton" label="{!$Label.c.CloseCaseModalCancelBtnl}" onclick="{!c.doCancel}"/>
            </div>
            <br/>
            <div class="slds-form-element">
                <div class="slds-notify slds-notify_alert slds-theme_alert-texture slds-theme_info slds-hide" role="alert" aura:id="alertContainer">
                    <ui:outputText value="{!v.errorMessage}" aura:id="caseError" class="none" />                    
                </div>
            </div>
        </div>
        </lightning:recordEditForm>
    </div>
</aura:component>

CONTROLLER
 
({
    doInit : function(component, event, helper) {
        try{
            console.log(event);
            console.log(component);
            var action = component.get("c.getStatus");
            var inputsel = component.find("InputSelectDynamic");
            var reasonSel = component.find("caseReason");
            var optsStatus=[];
            var optsReason=[];
            optsReason.push({"class": "optionClass", label: '', value: ''});
            var getCase = component.get("c.getCurrentCase");
            console.log(component.get("v.recordId"));
            getCase.setParams({CaseId : component.get("v.recordId")});
            getCase.setCallback(this, function(ab) {
                component.set("v.case", ab.getReturnValue());
                
                if(ab.getReturnValue()['Status'] == 'Closed'){
                    var modal = component.find('main');
                    $A.util.toggleClass(modal,'slds-hide');
                }
                
                else{
                    action.setCallback(this, function(a) {
                        for(var i=0;i< a.getReturnValue().length;i++){
                            
                            if(ab.getReturnValue()['RecordType']['DeveloperName'].search("AC_Engine") > -1 && (a.getReturnValue()[i].search("Approved") > -1 || a.getReturnValue()[i].search("Rejected") > -1)){
                                optsStatus.push({"class": "optionClass", label: a.getReturnValue()[i], value: a.getReturnValue()[i]});
                            }
                            else if (ab.getReturnValue()['RecordType']['DeveloperName'].search("AC_Engine") < 0 && a.getReturnValue()[i].search("Closed") > -1 && (a.getReturnValue()[i].search("Approved") < 0 && a.getReturnValue()[i].search("Rejected") < 0&& a.getReturnValue()[i].search("Pending") < 0)){
                                optsStatus.push({"class": "optionClass", label: a.getReturnValue()[i], value: a.getReturnValue()[i]});
                            }
                            
                            /*else if(ab.getReturnValue()['RecordType']['DeveloperName'].search("Support") > -1 && (a.getReturnValue()[i].search("Approved") < 0 || a.getReturnValue()[i].search("Rejected") < 0)){
                            opts.push({"class": "optionClass", label: a.getReturnValue()[i], value: a.getReturnValue()[i]});
                        }
                            else if(ab.getReturnValue()['RecordType']['DeveloperName'].search("Support") > -1 && (a.getReturnValue()[i].search("Approved") < 0 || a.getReturnValue()[i].search("Rejected") < 0)){
                                opts.push({"class": "optionClass", label: a.getReturnValue()[i], value: a.getReturnValue()[i]});
                            }*/
                            
                            inputsel.set("v.options", optsStatus);
                            
                        }
                        var reason = component.get("c.getReason");
                        console.log("22", component.get('v.recordTypeId'));
                        component.get('v.recordTypeId');
                        //reason.setParams({eId: component.get('v.recordId')});
                        reason.setCallback(this, function(reason) {
                            
                            for(var j=0;j< reason.getReturnValue().length;j++){
                                optsReason.push({"class": "optionClass", label: reason.getReturnValue()[j], value: reason.getReturnValue()[j]});
                            }
                            component.set("v.listReason", optsReason);
                            //reasonSel.set("v.options", optsReason);
                            console.log(optsReason);
                        });
                        $A.enqueueAction(reason);
                        //$A.enqueueAction(getCase);
                        console.log(optsStatus);
                    });
                    
                    $A.enqueueAction(action);
                }
                console.log(optsStatus);
            });
            $A.enqueueAction(getCase);
            
        }catch (e){
            console.log(e);
        }
    },
    doSaveCase : function(component, event, helper) {
        var reasonOk = false;
        
        var saveAction = component.get("c.saveCurrentCase");
        
        //console.log(component.get('v.case'));
        if(component.get('v.case.Comments') === undefined){
            component.set('v.case.Comments', '');
        }else{
            //console.log('comment ok', component.get('v.case.Comments'));
        }
        
        var reasonSel = component.find("caseReason");
        
        if(component.get("v.reason") === undefined || component.get("v.reason") == null || component.get("v.reason") == ''){
            $A.util.removeClass(component.find("caseError"), "none");
            var cmpTarget = component.find('alertContainer');
            $A.util.removeClass(cmpTarget, 'slds-hide');
            component.set('v.errorMessage', $A.get('$Label.c.LtngCloseCaseBtnNoReason')); 
        }else{
            reasonOk= true;
        }
        if(component.get('v.case.Send_Closure_Email__c') === undefined){
            //console.log("Send_Closure_Email__c", component.get('v.case.Send_Closure_Email__c'));
            component.set('v.case.Send_Closure_Email__c', false);
        }else{
            //console.log('Send_Closure_Email__c ok', component.get('v.case.Send_Closure_Email__c'));
        }
        
        if(reasonOk == true){
            saveAction.setParams({ CaseId : component.get("v.recordId"), comment: component.get('v.case.Comments'), status: component.find('InputSelectDynamic').get('v.value'), sendMail: component.get('v.case.Send_Closure_Email__c'), reason: reasonSel.get('v.value')});
            saveAction.setCallback(this, function(ab) {
                if(ab.getState() === "SUCCESS") {
                    //console.log("Case ", ab.getReturnValue());
                    component.find("overlayLib").notifyClose();
                    $A.get('e.force:refreshView').fire();
                    
                }
                else if(ab.getState() === "ERROR"){
                    
                    //let errorData = JSON.parse(error.message);
                    var errors = saveAction.getError();
                    var errorField = component.find('caseError');
                    //console.log(errors[0].pageErrors[0].message);
                    var cmpTarget = component.find('alertContainer');
                    $A.util.removeClass(cmpTarget, 'slds-hide');
                    component.set('v.errorMessage', errors[0].pageErrors[0].message);
                }
            });
            //console.log("click");
            $A.enqueueAction(saveAction);
        }
    },
    
    doSetStatus : function(component, event, helper){
        try{
        var getCase = component.get("c.getCase");
        getCase.setParams({ CaseId : cmp.get("v.recordId")});
        getCase.setCallback(this, function(a) {
            component.set("v.case", a.getReturnValue());
            
        });
        
        $A.enqueueAction(getCase);
        
        }catch (e){
            console.log(e);
        }
    },
    doCancel : function(component, event, helper){
        
        component.find("overlayLib").notifyClose();
        $A.get('e.force:refreshView').fire();
        $A.get("e.force:closeQuickAction").fire();
    },
    
    getCaseValue: function(component, event, helper) {
        
        console.log(event.getParam('value'));
        try{
            if(event.getParam('value') != undefined || event.getParam('value') =='' || event.getParam('value') ==null){
                component.set("v.reason", event.getParam('value'));
                component.set("v.case.Reason", event.getParam('value'));
            }
        }
        catch (e){
            console.log(e);
        }
    }
    
})

I do call this property anywhere.

Can someone help me?

thanks!
Peter


 
I'm trying to launch a custom quick action from within a Lightning Component.
According the example given, it should work:

https://developer.salesforce.com/docs/atlas.en-us.case_feed_dev.meta/case_feed_dev/quickaction_api_getCustomAction.htm

And it all does work, if I add the highlight panel on the page that include the Quick action.
If you remove it from the page, the api returns:
 
{"targetName":"Contact","actionName":"Contact.Call","success":false,"parentContext":null}
Is there a way to call them, without having them on the lightning page?

 
This week I started receiving errors that "Your Salesforce org reached the debug log generation limit"  It seems that Trace Flags are being automatically created under my name.  I've searched the help and can only find how to manually create a trace flag.   It does seem that this may be happening whenever batch processess are run.  

I'm just unsure of how to stop them if they are automatically being triggered by code.  THe other thing that is puzzling is that we have not changed anything this week.
Any help would be greatly appreciate!! thanks!!!

Fred
  • August 16, 2018
  • Like
  • 0
Just trying to display the current user info on a lightning page
If Email Deliverability is not set to All Email in my sandbox my code will error out when trying to send an email.  How can I check if Email Deliverabitlity is set to All Email in Apex so that I don't receive the NO_MASS_MAIL_PERMISSION errors?
I know in the order of operations, triggers fire before workflows, then if there are field updates, the record is updated and triggers fire again.

Most SF developers and admins are of the opinion that you should do as much declaratively via Workflows, Process Builder, etc. and not use triggers and Apex code unless the use case is such that it cannot be implemented via declarative features.

But when you do need triggers, if you have field updates, you have to be very careful that they don't interfere with each other and have to consider any bad effectst that could happen from a trigger fireing more than once.

So I'm wondering if perhaps it's best to implement with a pattern that once triggers are needed, then avoid doing field updates via declarative features and do all field assignments in the triggers.  The downside is admins can no longer define simpler features.  But the upside is that all the record assignments are then in one carefully controlled stream of code executed by the trigger.

Thoughts?
 
Hi folks,

Does any one know if it's possible to set parent id parameter in e.force:createRecord event in Lightning Component or any workaround for this?

I have two custom objects in a master (Project)-detail (Task) relationship. I want to override the OOTB New button on the Tasks related list. When I click a custom Quick Action button from the Project page to create a new Task, I do some validation first and then if success I'd like to forward the user to the create new Task page with the parent field for Project to be populated like it works with the out of the box New button on the related list. Because the parent id is not being passed, when the new Task form gets loaded, the parent field appears open in the search mode and the user has to select the parent record which is very inconvenient. 

Would anyone have a suggestion? Thankyou in advance
  • March 28, 2017
  • Like
  • 1
Hi,

Can anyone tell me is it possible to extract email signature(Salesforce Standard present in My Email Settings) in Apex. We just want to extract through apex so that we can append it in some pages.

Thanks
 
Hi,
I have some debug statements and checks that will send an email out when an Apex class fails on a DML operation (insert, update, delete). How can I create a string variable or array (whatever is most appropriate) that when the email is sent and opened in a Email Client (i.e. Outlook) there are line breaks where I want them to be?

Unsuccessful code I have tried:

try {
         insert list;
} Catch(DMLExceptiion dml) {
         String msg = '';
          for(Object ob : list){
                msg = msg + ob.Name + '\r\n';
          } 
          //at the end of the for loop, the msg variable has a list of all names of the object where there is a new line break after each name

        //structure of sendEmail method is SendEmail(Subject, Body);

        Email.SendEmail ('Test', msg);
}

------------------------------------------------------------------------
try {
         insert list;
} Catch(DMLExceptiion dml) {
         String msg = '';
          for(Object ob : list){
                msg = msg + ob.Name + BR();
          } 
          //at the end of the for loop, the msg variable has a list of all names of the object where there is a new line break after each name

        //structure of sendEmail method is SendEmail(Subject, Body);

        Email.SendEmail ('Test', msg);
}

  • August 06, 2014
  • Like
  • 0
Hi,

Setup - > Personal Setup -> Email -> My Email Settings
 
Using above path we can enter the Email Name, Email Address , BCC & Email Signature.
 
My Question:
Where the Email Signature values stored in the SFDC Objects?
 
My Requirement:
I need to show the Email Signature values in my Custom Visualforce page using Apex class or ?
 
can you please help me to get this value

Hi,

 

Can some one give an example of how to populate data in to:

 

Map<Id,List<Id>>

 

Here Id is UserRoleId and List<Id> is the List of users who belong to that role id.

 

Thanks,

JBabu.

  • May 31, 2012
  • Like
  • 0

Hi,

 

I'm trying to use Roles with Apex Managed Sharing, but I'm running in to a problem.  The documentation and example for Apex Sharing Rules implies that we can use Roles to populate the UserOrGroupId field on a sharing object, but I'm getting an error when I use an Id I derive from the UserRole object:

 

FIELD_INTEGRITY_EXCEPTION, User/Group ID: id value of incorrect type

 

In a nutshell, I've created an Apex class that is used to manage sharing on a custom object we have (Object B).  Object B is related to an Account.  I'm grabbing the account id and then using that to find any Customer Portal Roles (UserRoles object, these are created automatically when you create a portal user) associated to that account.  I then take the Id from the UserRole object and use it to populate the UserOrGroupId field on my ObjectB__Shares record.

 

Can I not use Roles with Apex Managed Sharing or am I doing something wrong?  Here's the relevant code (slightly modified to protect the innocent):

 

 

//Now that you have all the account ids, get the corresponding portal user roles
            Set<ID> allPortalRoleIDs = new Set<ID>();
            for(UserRole ur: [Select Id, Name From UserRole Where PortalAccountId in: allRelatedAcctIDs])
            {
                allPortalRoleIDs.add(ur.Id);
            }
            
            //Now that you have all the relevant Portal User Roles, populate the shares
            if(allPortalRoleIDs != null && allPortalRoleIDs.size() > 0)
            {
                for(ObjectB__c b: ForClientOnly)
                {
                    for(ID roleId : allPortalRoleIDs)
                    {
                        
                        ObjectB__Share bs = new ObjectB__Share();
                        bs.ParentID = b.id;
                        bs.UserOrGroupID = roleId;
                        bs.AccessLevel = 'read';
                        bs.RowCause = Schema.ObjectB__Share.RowCause.portal_access__c;
                        
                        allShares.add(bs);
                    }
                }
            }

            //Once you have all the Shares, insert them
            insert allShares;

 

Any thoughts?
Thanks in advance!

 

 

There are alot of example of people using the below code
Map<String, Schema.SObjectField> M = Lead.sObjectType.getDescribe().fields.getMap();


What I want to do is instead of Hard Coding the sObject in this Case Lead  pass it as a string paramater

so how would I do something like

 

GetType('MySobject__c').getDescribe().fields.getMap();

 

 

 

  • March 03, 2010
  • Like
  • 0