• Prabhat Sharma 6
  • NEWBIE
  • 60 Points
  • Member since 2016


  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 9
    Replies
hi, i have a small query.. if i had  two arrays like :

 map<string, object>  mappingconcept = ' { "data": [ {"country": "usa", "value": "usa-co" },{"country": "Australia", "value": "Aus-Mo" },{"country": "Germany", "value": "Gem-flo" } ] } ';

Onclick of country name, the value should have to apper using the actionsupport, how to proceed with out using selectlist in salesforce thankss
 
Hi Peeps,
I'm new to writing Triggers but managed to make my Trigger work the way its designed to work. However, it is populating NULL alongside default values. 
The Trigger updates a Multi-select picklist with default values when a checkbox is checked. 
trigger AutoPopulateProDiscussed on Meeting_Call_Report__c (before insert, before update) {
    if(trigger.isInsert || trigger.isUpdate){
        for (Meeting_Call_Report__c mcr : Trigger.new){
        if(mcr.Benchmark_Reform__c == True && mcr.ProDiscussedTriggerHelper__c == False){
            mcr.Products_Discussed__c += ';€STR;SOFR (Secured overnight financing rate)';
            mcr.ProDiscussedTriggerHelper__c = True;
    }
        }
        
    }
}

Can someone help me remove the NULL value please?
Regards,
Nikhil 
Hi Folks,

Is there a way that we can capture the date and time when a record is pushed in Salesforce cache when using Salesforce offline feature?
We have a requirement where when a record is created offline, and when the user gets online it should show the date and time when it was pushed in the cache i.e if the record was created offline at 5:15 PM and the user goes online at 6 PM, can we capture the 5:15 PM date time on the record?
Currently, when the user goes online it shows the created date time when it syncs online. 
While validating step 3 of this project, I'm getting the below error
User-added image
Kindly help.
Hi All,
I have been working Lightnig Experience Rollout Specialist superbadge. While working on step 8 and after enabling Lightnign Knowledge, I'm not able to create any lightning app from the App Manager and I'm continuously getting this error while clicking "New LIghtning App" button.
Error while clicking on New Lightning App button

Need help. Thanks in advance.
hi, i have a small query.. if i had  two arrays like :

 map<string, object>  mappingconcept = ' { "data": [ {"country": "usa", "value": "usa-co" },{"country": "Australia", "value": "Aus-Mo" },{"country": "Germany", "value": "Gem-flo" } ] } ';

Onclick of country name, the value should have to apper using the actionsupport, how to proceed with out using selectlist in salesforce thankss
 
Dear Team ,

Thank you for your continous support !!!

We are using aura:handler in this way :

 <aura:handler name="init" value="{!this}" action="{!c.doInit}" />

value="{!this}" is used to pass information from component to controller . But i am unable to understand what kind of information it passes and on which location of function it passes the information.

Please describe this in easy way and make me understand how it works :

Thanks & Regards
Sachin Bhalerao
Hi Peeps,
I'm new to writing Triggers but managed to make my Trigger work the way its designed to work. However, it is populating NULL alongside default values. 
The Trigger updates a Multi-select picklist with default values when a checkbox is checked. 
trigger AutoPopulateProDiscussed on Meeting_Call_Report__c (before insert, before update) {
    if(trigger.isInsert || trigger.isUpdate){
        for (Meeting_Call_Report__c mcr : Trigger.new){
        if(mcr.Benchmark_Reform__c == True && mcr.ProDiscussedTriggerHelper__c == False){
            mcr.Products_Discussed__c += ';€STR;SOFR (Secured overnight financing rate)';
            mcr.ProDiscussedTriggerHelper__c = True;
    }
        }
        
    }
}

Can someone help me remove the NULL value please?
Regards,
Nikhil 
We are using Process Builder to call an InvocableMethod when the stage changes on an opportunity. The method creates a case and sends an email to its owner. When the opportunity is updated via the API, after the case is created the assignment rules run and reassign the case to a queue. This causes an error when the next block of code tries to send an email to the queue. I can update the opportunity via the UI without any issues.
...
// Create Case
        for (Opportunity opps : oppsList) {
            Case c = new Case(BusinessHoursId = '01mf20000008TQr', AccountId = opps.AccountId,
                    Case_Reason__c = 'Refer to Dentist', Description = opps.Account.Name + ' - Refer to Dentist', Destination__c = 'Support',
                    Origin = 'In-House', Status = 'Closed', Subject = opps.Account.Name + ' - Refer to Dentist', Type = 'Patient Updates',
                    OwnerId = accountMap.get(opps.AccountId).Patient_Care_Contact__c,
                    ContactId = accIdToContactMap.get(opps.AccountId).Id);
            casesToInsert.add(c);
        }

        System.debug('casesToInsert: ' + casesToInsert);
        insert casesToInsert;
        List<Case> insertedCases = [SELECT Id, AccountId, ContactId, OwnerId, Account.Patient_Care_Contact__c FROM Case WHERE Id IN :casesToInsert];
        System.debug('insertedCases: ' + insertedCases);

        // Email Pt
        EmailTemplate et = [Select Id from EmailTemplate where DeveloperName = 'Refer_to_Dentist'];
        OrgWideEmailAddress owea = [SELECT Id FROM OrgWideEmailAddress WHERE Address = 'support@email.byteme.com' LIMIT 1];
        List<Messaging.SingleEmailMessage> emailToSend = new List<Messaging.SingleEmailMessage>();
        for (Case c : insertedCases) {
            String[] recipients = new String[]{c.ContactId, c.OwnerId, 'mtamayo@byteme.com'};
            Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
            email.setTargetObjectId(c.ContactId);
            email.setWhatId(c.Id);
            email.setTemplateId(et.Id);
            email.setToAddresses(recipients);
            email.setOrgWideEmailAddressId(owea.Id);
            emailToSend.add(email);
        }
Messaging.sendEmail(emailToSend);
As I understand it, Assignment Rules should not be running here. I realize there are changes I could make to the Assignment Rules to prevent the reassignment but I would prefer for everything to work as intended rather than use a work-around. I have an open case with Salesforce but because we're not a Premier Service member they haven't given much help.

Can someone please confirm that the assignment rules should not be running here, or if they should be, tell me how I can disable them?
I have a lightning component which display contact records.
I have exposed the component has a lightning TAB in LEX.
The code is working as shown below.
 
Base.cmp
-------------

<aura:component abstract="true"
                extensible="true">
	{!v.body}
</aura:component>

BaseHelper.js
-------------
({
    callServer : function(component,method,attributeName,params) {
        var action = component.get(method);
        if (params) {
            action.setParams(params);
        }
       
        action.setCallback(this,function(response){
            var state = response.getState();
        	console.log('State log '+state);
            if(state === 'SUCCESS'){
                component.set(attributeName,response.getReturnValue());
            }
            else if(state === 'ERROR'){
		         console.log('Error '+response.getError());
	}
        });
        $A.enqueueAction(action);
    }
})


CallApexClassComponentBase.cmp
------------------------------
<aura:component implements="flexipage:availableForAllPageTypes,
                            force:appHostable"
                            extends="c:Base"
                            controller="ContactController">

        <!--Declare Attributes-->
    <aura:attribute name="wrapperList" 
                    type="Object"/>
    
    <lightning:card title="Bring Contact data">
        
        <aura:set attribute="actions">
            
            <lightning:button label="Contact Data" 
                              onclick="{!c.Condata}" />
        </aura:set> 
        
    </lightning:card>
    
    <!-- Here I need an header to display the number of contacts-->
    <div class="slds-p-around--large">
     
        <p style="color:red">Total Contacts = {!v.wrapperList.CountContacts}</p>
      
    <table class="slds-table slds-table--bordered slds-table--cell-buffer">
        <thead>
            <tr class="slds-text-title--caps">
                <th scope="col">
                    <div class="slds-truncate" title="First Name">First Name</div>
                </th>
                <th scope="col">
                    <div class="slds-truncate" title="First Name">Last Name</div>
                </th>
                
                <th scope="col">
                    <div class="slds-truncate" title="First Name">Email</div>
                </th>
                <th scope="col">
                    <div class="slds-truncate" title="LeadSource">LeadSource</div>
                </th>
                
            </tr>
        </thead>
        <!--table body start, 
        Iterate contact list as a <tr> 
        -->
        <tbody>
            <aura:iteration items="{!v.wrapperList.lstContact}" 
                            var="con">
                
                <tr>
                    <th scope="row">
                        <div class="slds-truncate" title="{!con.FirstName}">{!con.FirstName}</div>
                    </th>
                    <th scope="row">
                        <div class="slds-truncate" title="{!con.LastName}">{!con.LastName}</div>
                    </th>
                    <th scope="row">
                        <div class="slds-truncate" title="{!con.Email}">{!con.Email}</div>
                    </th>
                    <th scope="row">
                        <div class="slds-truncate" title="{!con.LeadSource}">{!con.LeadSource}</div>
                    </th>
                    
                </tr>
            </aura:iteration>
            
        </tbody>
        
    </table>
    </div>
</aura:component>


CallApexClassComponentBaseController.js
---------------------------------------
({
 Condata : function(component,event,helper) {
 helper.callServer(
            component, //component
            "c.getContacts", //method
            "v.wrapperList"   //attribute , this goes into helper
        );
    }
})


ContactController.apxc
----------------------
public with sharing class ContactController {
    @AuraEnabled
    public static wrapperClass getContacts() {
        //create an object of wrapper class
        wrapperClass wrapClass = new wrapperClass();
        
        wrapClass.lstContact=[select Id, FirstName,LastName,Email,LeadSource FROM Contact 
                              where Email != NULL
                              AND Account.Name != NULL 
                              AND LeadSource != NULL
                              ORDER BY NAME];
        
        //now size of the list
        wrapClass.CountContacts=wrapClass.lstContact.size();
        
        return wrapClass;
    }
      public class wrapperClass{
        @AuraEnabled public List<contact> lstContact{get;set;}
        @AuraEnabled public Integer CountContacts{get;set;}
       
    }
 }

My requirement is I want to display the output in mobile devices say IPhone 6s , galaxy s9.

Please le tme know how to proceed on this? Is there a way where we can make the lightning URL available in sites?

smita

 
Hi,
I am new to Lightning please help me with this. I am getting the following error:
Uncaught Action failed: c:LinkToAttachment$controller$preview [action.SetCallback is not a function]
when I try to run my lightning component on button click. Please Help
Here is my Code:
LinkToAttachment.cmp
<aura:component controller = "LinkToAttachment" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global" >
   <aura:attribute name="contentId" type="String" default="0691h0000001LU8AAM"/>
<lightning:button variant="brand" label="Quick Reference Guide" onclick="{!c.preview }" />
</aura:component>
LinkToAttachmentController.js
({
   preview : function(component, event, helper) {
       var action = cmp.get("c.openfile1");
       action.SetCallback(this, function(response){
       var state = response.getState();
           if(state == "SUCCESS"){
               alert("From server: " + response.getReturnValue());
       var Cdid = response.getReturnValue();
       cmp.set("v.contentId", Cdid);
       $A.get('e.lightning:openFiles').fire({
        recordIds: ["v.contentId"]
    });
           }
});
       $A.enqueueAction(action);
   }
})

LinkToAttachment.apxc
public with sharing class LinkToAttachment {
    
    @AuraEnabled
    Public static List<ContentDocument> openfile1(){
        List<ContentDocument> Cdid=[SELECT id FROM ContentDocument 
                             where Title=' Test Document'];
        return Cdid;
    } 

}

Thanks
 
Hi Guys,

I am getting the error System.QueryException when executing below code can some one help:
Apex class:
public class SOQL_1 {
    public String name {set;get;}
    public String industry {set;get;}
    public list<Account> accounts {set;get;}
    public string query {set;get;}
    
    public void getdata()
        
    {
        query='select name,industry from Account';
        if(name!=''&&industry!=''){
        query= query + 'where name=\''+name+'\' and industry=\''+industry+'\'';
        }else{
            if(name!=''){
                query=query+'where name=\''+name+'\'';
            }else{
                if(industry!=''){
                    query=query +'where industry=\''+industry+'\'';
                }
            }
        }
        accounts = Database.query(query);
    }

VF page:
<apex:page controller="SOQL_1">
    <apex:form>
        <apex:pageblock title="dynamic soql">
            <apex:pageblockbuttons location ="bottom">
                <apex:commandButton value="search" action ="{!getdata}" />
            </apex:pageblockbuttons>
            
            <apex:pageblocksection>
                <apex:pageBlockSectionItem>
                    <apex:outputLabel value="name"/>
                    <apex:inputText value="{!name}"/>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem>
                   <apex:outputLabel value="industry"/>
                    <apex:inputText value="{!industry}"/>
                </apex:pageBlockSectionItem>
            </apex:pageblocksection>
        </apex:pageblock>
        <apex:pageblock >
            <apex:pageblocktable rendered ="{!!ISNULL(accounts)}" value="{!accounts}" var= "a">
                       <apex:column value="{!a.name}"/>   
                       <apex:column value="{!a.industry}"/>  
            </apex:pageblocktable>
        </apex:pageblock>
    </apex:form>
    
</apex:page>

Thanks in advance