• Danish Hoda
  • SMARTIE
  • 1882 Points
  • Member since 2016
  • Salesforce Enthusiast|Lightning Champion
  • Cognizant


  • Chatter
    Feed
  • 62
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 478
    Replies
Hi, I've built a trigger that will update the Owner for the Account and its related contacts based on the User Lookup field in the Account. I was able to update the Owner of related contacts with an update in the Account.
If I change the Account in any of the Contact then the new Accounts owner should be added as Contacts Owner. I tried using the Trigger.OldMap. Can someone help me with what needs to be changed in my trigger...
trigger AccountOwnerUpdate on Account (before insert, before update) {
    Set<Id> accIds = new Set<Id>();
    List<Contact> updatedConList = new List<Contact>();
    Map<Id, String> newOwnerIds = new Map<Id, String>();
    
    
    List<Contact> conList = [SELECT Id, AccountId FROM Contact WHERE AccountId IN: accIds];
    for(Account acc : trigger.new) {
        accIds.add(acc.Id);
        newOwnerIds.put(acc.Id, acc.Coverage_Lead__c);
        
        if(acc.Coverage_Lead__c != NULL) {
            acc.OwnerId = acc.Coverage_Lead__c;
        }
        if(acc.Coverage_Lead__c == NULL){
            acc.OwnerId = acc.LastModifiedById;                
        }
    }
    if(trigger.isUpdate) {
        for(Account acc : trigger.new) {
            for(Contact con : conList) {
                if(con.AccountId!= NULL) {
                    if(trigger.oldMap.get(con.Id).AccountId != con.AccountId) {
                        accIds.add(con.AccountId);
                    }
                }
                accIds.add(trigger.oldMap.get(con.Id).AccountId);
            }
        }
    }

    for(Account accs : [SELECT Id, LastModifiedById, (SELECT Id, Owner.Id, AccountId FROM Contacts) FROM Account WHERE Id IN:accIds]) {
        if(newOwnerIds.get(accs.Id) != NULL) {
            for(Contact con : accs.Contacts) {
                con.OwnerId = newOwnerIds.get(accs.Id);
                updatedConList.add(con);
            }
        }
        if(newOwnerIds.get(accs.Id) == NULL) {
            for(Contact con : accs.Contacts) {
                con.OwnerId = accs.LastModifiedById;
                updatedConList.add(con);
            }   
        }
        
    }
    update updatedConList;
}
Thanks in Advance.
Hello
In my org, we already have the standard email-to-case setup. It uses our customercare@mycompany.com email address.
We also have "Case Auto Response Rule" that catches all emails coming to customercare@mycompany.com and sends a templated response with the case id.
Now, I have written a custome InboundEmailHandler to catch all incoming emails, check the subject line and do stuff in code.

Problem/Question:
Instead of creating a new email address to use for this customer handler, I would like to connect this to our main customercare@mycompany.com email address.  Any emails sent to this address should first go through my custom handler and then do email-to-case and Case Auto Response.

Any help would be greatly appreciated
I am getting null as value after desearlise of the callout response
 
List<Map<String, Object>> myMaps = new List<Map<String, Object>>();
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('https://priyesh01.github.io/SampleJson/JsonDummy.json');
request.setMethod('GET');
HttpResponse response = http.send(request);
System.debug('$$Response'+response.getBody());
// If the request is successful, parse the JSON response.
if (response.getStatusCode() == 200) {
   System.debug('I am able to hit end point');
   Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
       		myMaps = new List<Map<String, Object>>();
      List<Object> draftAlarmsRequest = (List<Object>) results.get('draftAlarmsRequest');
  system.debug('$$ draftAlarmsRequest '+draftAlarmsRequest);
}
I am geeting null in the draftAlarmsRequest.

 
I am using Flow before save to update name field of opportunity and its causing my test classes fail FATAL_ERROR System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Name]: [Name]
Hi All,
I am learning the salesforce and wanted to understand the below which in the Trigger concept.

I get the below result
Code: [SELECT Id,Name,(SELECT Id,Name FROM Opportunities) FROM Account WHERE Id IN :Trigger.New]);
output: {0012w00000CWweoAAD=Account:{Id=0012w00000CWweoAAD, Name=Grapes & Melons}}

and then I tried accessing the Opportunities by useing the below code line
Code:
System.debug('acctsWithOpps.get(a.Id).Opportunities.size()=' + acctsWithOpps.get(a.Id).Opportunities);

output:
acctsWithOpps.get(a.Id).Opportunities.size()=(Opportunity:{AccountId=0012w00000CWweoAAD, Id=0062w000004b2mCAAQ, Name=Grapes & Melons Opportunity}, Opportunity:{AccountId=0012w00000CWweoAAD, Id=0062w000004b2mMAAQ, Name=Grapes & Melons Opty}, Opportunity:{AccountId=0012w00000CWweoAAD, Id=0062w000004b44SAAQ, Name=Grapes & Melons Opportunity})

How do i need to write the code to access each opportunity field details if i wanted to access. Let say I wanted to check a particular type of opportunity is existed or not and then do an operation.

Thank you!
Hello, I have two record types: X1 and X2

Controling picklist: Type has values 1, 2, 3, 4, 5
Dependent picklist: Subtype has A, B, C, D, E

For record type X1 I need the Subtype value to equal A if Type equals value 1.
For record type X2 I need the Subtype alue to equal B if Type equals value 1.

Is this possible in any way or do I have to create twice as much values in Type field availible only for some record types?
Hello everyone!

I am using apex:commandLink for a VF list page but it is opening the wrong edit page. The edit button is currently opening the edit opportunity product details and I need it to open the Product Line Item schedules instead (this page: /related/OpportunityLineItemSchedules/view). I have tried using different actions, a custom URL, and a ton of other options but I can't get anything to work. Does anyone have an answer? 

Thanks! 

VF page with the button: 
User-added image
Current Code:
<apex:page standardController="Opportunity" action="{!getOLIS}" tabStyle="Opportunity" extensions="OpportunityScheduleExtension" lightningStylesheets="true">
 <apex:form >
     <apex:pageBlock >
     <apex:pageBlockTable value="{!lstOLIS}" var="lst" >
          <apex:column headerValue="Product" value="{!lst.OpportunityLineItem.Product2Id}"/>
          <apex:column headerValue="Date" value="{!lst.ScheduleDate}"/>
          <apex:column headerValue="Revenue" value="{!lst.Revenue}"/>
         <apex:column ><apex:commandLink action="{!edit}" value="Edit" id="EstablishOpportunityLineItemSchedules"/></apex:column>
     </apex:pageBlockTable>
     </apex:pageBlock>
 </apex:form>
</apex:page>
 
public with sharing class OpportunityScheduleExtension {
    Opportunity objOpp;
    public list<OpportunityLineItemSchedule> lstOLIS {get;set;}
    public OpportunityScheduleExtension(ApexPages.StandardController controller) {
        this.objOpp= (Opportunity)controller.getRecord();
    }
    
   
    public void getOLIS(){
        lstOLIS = new list<OpportunityLineItemSchedule >();
        system.debug('objOpp---------->'+objOpp);
        for(OpportunityLineItemSchedule objOLIS:[Select Id, ScheduleDate, Revenue,
                                                 OpportunityLineItem.Product2.Name,
                                                 Description,Product_Name2__c, NAME__c
                                                 from OpportunityLineItemSchedule 
                                                 where OpportunityLineItem.OpportunityId =:objOpp.Id] ){
            lstOLIS.add(objOLIS);                                             
        }
    }    
}

 
I tried learning Apex coding only to realize it will take a while to learn significant enough to create the triggers that I want which I can do with native declarative tools.

I want to know if Visualforce is faster to learn than Apex and if it's even possible to learn without learning Apex first? 
JS Controller :   method calling from Comp button.
 
createContact: function(component, event, helper){ //
         
         var createRecordEvent = $A.get('e.force:createRecord');
      
            createRecordEvent.setParams({
                'entityApiName': 'Contact',
                "defaultFieldValues": {
                    'Phone' : '415-240-6590'}
            });
            createRecordEvent.fire();
        
    }

Getting error : This page has an error. You might just need to refresh it. Action failed: c:getContactComp$controller$createContact [Cannot read property 'setParams' of undefined] Failing descriptor: {c:getContactComp$controller$createContact}



Requirmeent: on click of button, want to display create contact screen with default phone or any field.
Hi There,

I have created Email alerts with required informaiton(Template, sender and to Address etc.) on Work order object.
FYi, It redirected me to classic email alert page when clicked on "Creat new email alert" while I am building application in Lightning. I am using Play ground environent and with system administrator role.

Now once Email alert is created, I created a new process using process builder. Based on Criteria, I am calling a flow in action 1 and in action 2, i am trying to call a email alert. But when i select email alert, i dont see any existing email alerts coming up in drop down. I cross checked and objets referred are same for both email alert and process builder.

Am I missing anything with regards to permissions, page layout etc,.? Why my email alerts are not showing up in auto search control? Any help pls.?

Thanks,
Ravi
Hi All,
I'm little confused to choose  trigger/process builder with my scenario could you please help me with this.
I have parent and child objects with Lookup relationship. I need to auto update parent picklist field with conditions as follows
1.If parent has child records created in last 2 months from todays date update to valueA
2.If parent has child records in the past and there have not been any childs in last 2 months from todays date then ValueB
3.If parent never have any childs update to valueC

I hope we cant  use process builder for this and trigger is preferred to write on child object but which trigger context i should use.
Could any one please give me an idea how to do this.
thank you.
<apex:page controller="Task2Apex">
    <apex:form >
        <apex:pageBlock title="Account Name" >
            <apex:selectList value="{!selectedAccId}" size="1">
                <apex:selectOptions value="{!AccountNames}" />
                <apex:actionSupport event="onchange" action="{!showContacts}" reRender="op" />
            </apex:selectList><br/><br/>
            
         <apex:outputPanel id="op">
            <b><apex:outputText value="Related Contacts" rendered="{!renderPBtable}"/></b>
            <b><apex:outputText value="No Contacts on this Account" rendered="{!noContact}" style="color: red;"/></b>
            <apex:pageblockTable title="Contacts" value="{!conlist}" var="sc" id="relatedContactsBlock" rendered="{!renderPBtable}">
                <apex:column value="{!sc.name}"/>
                <apex:column value="{!sc.phone}"/>
            </apex:pageblockTable>
        </apex:outputPanel>
        </apex:pageBlock>
    </apex:form>
</apex:page>
 
public class Task2Apex {

    public Id selectedAccId{get;set;} 

    public List<Contact> conlist {get;set;}   
    
    public Boolean renderPBtable {get;set;}
    
    public Boolean noContact {get;set;}

    public List<SelectOption> getAccountNames() {
        List<SelectOption> accOptions= new List<SelectOption>();
        system.debug(selectedAccId);
        accOptions.add( new SelectOption('','--Select--'));
        for(Account acc : [select Id,name from Account ] ) {
            accOptions.add(new SelectOption(acc.Id,acc.name));
        }
        return accOptions;
    }

    public PageReference showContacts(){
        conlist=[select name,phone from Contact where Accountid=: selectedAccId];
        if(conlist.size() > 0)
        {
            renderPBtable = true; 
            noContact = false;
        }
        else
        {
            renderPBtable = false;
            noContact = true;
        }
        return null;   
    }
  
}

I want to Include edit link on each child record.
Thanks in Advance.
I have a situation where i want to display the field value which should show sub string value of field inside aura iteration eg email field is test1.user1@gmail.com i want to display value as test1.user1. ho can i achieve this?
<th data-label="Id" scope="row">
          <div class="slds-truncate" title="Cloudhub">
        <a href="{!'/one/one.app?#/sObject/'+ singleRec.Id + '/view'}" target="_blank">{!singleRec.Email}</a>                                           </div>
                                        </th>

 
Hello, I need to delete certain documents. This is the code I've been using:
    List<ContentDocumentLink > docs;
        docs = [SELECT Id, Linkedentity.name, Linkedentity.id,ContentDocument.CreatedDate  
                FROM contentDocumentLink 
                WHERE Linkedentityid 
                IN (SELECT Id FROM lead where createddate < Last_N_Days:7  ];  
            delete docs;

After I execute this, it looks like the contentDocumentLinks become deleted, however my storage usage is still the same number and percentage.Will the above code completely delete those files? 
On a visual-force page of a workorder record, I've to display list of workorders created for the same location where the createddate is within the last 30 days of the creationdate of the current record.
For ex: If the current record was created on Jan 31st for a location A, I want to display all the workorders that were created from Jan 1st to 31st for location A.

This is the query I've but it obviously displays records created in last 30 days but not the records created in last 30 days of createddate of the current record. How can I modify my query?
CWOs=[SELECT Id, Status, location.Name, createddate FROM WorkOrder WHERE location.Name = : getwo().location.Name and id != : getwo().id and recordtype.name = 'Child' and createddate = LAST_N_DAYS:30 ORDER BY CreatedDate asc];

 
  • April 13, 2020
  • Like
  • 0
<apex:page standardController="Campaign" extensions="ForSaleLookupOnCampaignController"> 
    <script type="text/javascript">
        function selectAllCheckboxes(obj,receivedInputID){
            var inputCheckBox = document.getElementsByTagName("input");                  
            for(var i=0; i<inputCheckBox.length; i++){          
                if(inputCheckBox[i].id.indexOf(receivedInputID)!=-1){                                     
                    inputCheckBox[i].checked = obj.checked;
                }
            }
        }
   
}
    </script>
    <apex:form >
        <apex:pageBlock >
             <apex:pageBlockButtons >
                <apex:commandButton value="Save" style="width: 100px; height: 30px" action="{!processSelected}" rerender="table2"/>
            </apex:pageBlockButtons>
            <p style="font-size: 15px;font-weight: bold;">Select FID :</p><apex:inputfield style="width: 200px; height: 30px" value="{!Campaign.For_Sale__c}" id="forsaleid"/><br/>
            <apex:pageblockSection title="Related Campaign Members" collapsible="false">
                <apex:pageBlockTable value="{!wrapcontactList}" var="conWrap" id="table" title="All Related Campaign Members">     
                    <apex:column >
                        <!--apex:facet name="header">
                          <apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
                         </apex:facet-->
                        <apex:inputCheckbox value="{!conWrap.selected}" id="inputId"/>
                    </apex:column>
                    <apex:column value="{!conWrap.con.Name}" />
                    <apex:column value="{!conWrap.con.Account.name}" />
                </apex:pageBlockTable>
            </apex:pageblockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>
public class ForSaleLookupOnCampaignController { 
    public List<CampaignMember> Campaignmemberlist{get;set;} 
    public Campaign cmp {get;set;} 
    public List<wrapContact> wrapcontactList {get; set;}
    public List<Contact> selectedcontacts{get;set;}
    set<id>conid=new set<ID>();
    public String ID { get; set;}
    set<id>ForSaleid=new set<id>();
    public ForSaleLookupOnCampaignController (ApexPages.StandardController standardControllerParam) {
        this.cmp = (Campaign)standardControllerParam.getRecord();
        Campaignmemberlist = [SELECT id,name,Campaignid,Company__c,type,For_Sale__c,Contact.For_Sale__c  FROM CampaignMember WHERE Campaignid = : ApexPages.currentPage().getParameters().get('id') ];
        for(CampaignMember cm:Campaignmemberlist){
            conid.add(cm.ContactId);
            ForSaleid.add(cm.For_Sale__c);
        }
        //
        if(wrapContactList == null) {
            wrapContactList = new List<wrapContact>();
            for(Contact c: [select Id,Name,Account.name,For_Sale__c from Contact where id=:conid]) {
                wrapContactList.add(new wrapContact(c));
            }
        }
        
    }
    public PageReference processSelected() {
        PageReference pr;
        selectedcontacts = new List<contact>();
        system.debug('for sale '+cmp.For_Sale__c);
        for(wrapContact wrapcontactObj : wrapcontactList) {
            if(wrapcontactObj.selected == true) {
                selectedcontacts.add(wrapcontactObj.con);
                
            }
        }
        for(contact s:selectedcontacts){
            s.For_Sale__c=cmp.For_Sale__c;
        }
            try{
                
                database.update(selectedcontacts);
                
            }catch( Exception e ){
                ApexPages.addMessages(e);
            }
            system.debug('selectedcontacts'+selectedcontacts);
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.CONFIRM,'FID Update on Contact'));
      return pr;   
    }
    public class wrapContact {
        public Contact con {get; set;}
        public string forsaleid{get;set;}
        public Boolean selected {get; set;}
        
        public wrapContact(Contact c) {
            con = c;
            forsaleid=c.For_Sale__c;
            selected = false;
        }
    }
}
How should I show success message on VF Page
& another thing is
here <apex:inputfield style="width: 200px; height: 30px" value="{!Campaign.For_Sale__c}" id="forsaleid"/> when I click on button & page is load the value is already populate on this but I want to clear this value when page populate how can I do that?


 

I have 2 array

-> The First array consists of all the values.

-> In the second array, consist of selected values  Here I need to filter the value which is already present

Hi, I am new to LWC ​​​​​​, trying dynamically add/remove rows for a table scenario. I can able to add the row by click on the + button. After added that rows I want to enter some values in text boxes and save into account object by click on save buttton. Also do the delete action as well to delete the specific row by click on delete button. 

I am facing issue with save & delete records. How I can solve this? Can anyone give me some guidence to solve.

AddDeleteRow
dynamicAddRow.html

<template>
                  
    <div class="slds-m-around--xx-large">
        <div class="slds-float_right slds-p-bottom_small">
            <h1 class="slds-page-header__title">Add Row
                <lightning-button-icon icon-name="utility:add"  size="large" variant="bare" alternative-text="Add" onclick={addRow}> </lightning-button-icon>
            </h1>
        </div>
        <div class="container-fluid">        
            <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">#</div>
                        </th>
                        <th scope="col">
                            <div class="slds-truncate" title="Account Name">Account Name</div>
                        </th>
                        <th scope="col">
                            <div class="slds-truncate" title="Account Number">Account Number</div>
                        </th>
                        <th scope="col">
                            <div class="slds-truncate" title="Phone">Phone</div>
                        </th>
                        <th scope="col">
                            <div class="slds-truncate" title="Action">Action</div>
                        </th>
                    </tr>
                </thead>   
                <tbody>      
                    
                    <template for:each={accountList} for:item="acc" for:index="index">
                        <tr key={acc.Id}> 
                            <td>{index}</td>                                                  
                            <td>
                                <lightning-input label="Name" value={acc.Name} onchange={handleNameChange}></lightning-input>                               
                            </td>
                            <td>
                                <lightning-input label="Account Number" value={acc.AccountNumber} onchange={handleAccountNumberChange}></lightning-input>                        
                            </td>
                            <td>
                                <lightning-input label="Phone" value={acc.Phone} onchange={handlePhoneChange}></lightning-input>
                            </td>
                            <td>
                                <a onclick={removeRow}> 
                                    <lightning-icon icon-name="utility:delete" size="small" style="margin-top: -4px; margin-right: 0px;" ></lightning-icon>
                                    <span class="slds-assistive-text">Delete</span>
                                </a>
                            </td> 
                        </tr>
                    </template>
                     
                </tbody>
            </table>
            <div class="slds-align_absolute-center slds-p-top_small">                
                <lightning-button name="Save" label="Save" onclick={saveRecord} ></lightning-button>
            </div>
        </div>
    </div>

</template>
 
dynamicAddRow.js

import { LightningElement, track,api } from 'lwc';
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
import NAME_FIELD from '@salesforce/schema/Account.Name';
import ACCOUNTNUMBER_FIELD from '@salesforce/schema/Account.AccountNumber';
import PHONE_FIELD from '@salesforce/schema/Account.Phone';
import saveAccounts from '@salesforce/apex/AccountController.saveAccounts';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
export default class CreateDynamicRecord extends LightningElement {
    @track accountList = []; 
    @track index = 0;
    @api recordId;
    @track name = NAME_FIELD;
    @track industry = ACCOUNTNUMBER_FIELD;
    @track phone = PHONE_FIELD;

    @api record = {
        firstName : '',
        lastName : '',
        Email : '',
        Phone : '',
        Title : ''
    }

    addRow(){

        this.index++;
   
        this.accountList.push ({
            sobjectType: 'Account',
            Name: '',
            AccountNumber : '',
            Phone: ''
        });

        console.log('Enter ',this.accountList);
        
       // this.accountList.push(this.record);
        //console.log(' After adding Record List ', this.accountList);
    }
    
    removeRow(){

        var index = this.index;
      
        if(this.accountList.length>1)
           this.accountList.splice(index, 1);

        //this.dispatchEvent(new CustomEvent('deleterow', {detail: this.index}));
        //console.log(' After adding Record List ', this.dispatchEvent);
    } 

    acc = {
        Name : this.name,
        AccountNumber : this.accNumber,
        Phone : this.phone
    }

    handleNameChange(event) {
        this.acc.Name = event.target.value;
        console.log("name", this.acc.Name);
    }
    
    handleAccountNumberChange(event) {
        this.acc.AccountNumber = event.target.value;
        console.log("AccountNumber", this.acc.AccountNumber);
    }
    
    handlePhoneChange(event) {
        this.acc.Phone = event.target.value;
        console.log("Phone", this.acc.Phone);
    }
    
    saveRecord(){        
        saveAccounts(this.acc.accountList)
            .then(result => {
                this.message = result;
                this.error = undefined;
                if(this.message !== undefined) {
                    this.acc.Name = '';
                    this.acc.AccountNumber = '';
                    this.acc.Phone = '';
                    this.dispatchEvent(
                        new ShowToastEvent({
                            title: 'Success',
                            message: 'Account created successfully',
                            variant: 'success',
                        }),
                    );
                }
                
                console.log(JSON.stringify(result));
                console.log("result", this.message);
                /*console.log(' After adding Record List ', result);
                this.accountList = result;
                console.log(' After adding Record List ', this.accountList);*/
            })
            .catch(error => {
                this.message = undefined;
                this.error = error;
                this.dispatchEvent(
                    new ShowToastEvent({
                        title: 'Error creating record',
                        message: error.body.message,
                        variant: 'error',
                    }),
                );
                console.log("error", JSON.stringify(this.error));
            });
    }
      
}
 
AccountController.apex  

public with sharing class AccountController { 
 
    @AuraEnabled( cacheable = true ) 
    public static List< Account > getAccounts() { 
      
        return [ SELECT Id, Name, Industry FROM Account LIMIT 10 ]; 
         
    } 
     
    @AuraEnabled( cacheable = true )
    public static void saveAccounts(List<Account> accList){
        Insert accList;
        /*if(accList.size()>0 && accList != null){
            insert accList;
        }*/
    } 
}
Thanks 
Siva
 

I have a LWC with a lightning-combobox whose options are populated via an apex query of records. The record list changes depending on the user accessing the LWC. There is one user for whom the query returns 400+ records, which causes the page to take a long time to render.


I'd like to refactor the LWC to not populate the options on page load, but rather allow the user to enter text into an input, have JS filter the returned records from apex based on the input and give them a autosuggest list consisting of the filtered records (similar in experience to html input type="search" (https://www.htmlquick.com/reference/tags/input-search.html)). I haven't found any great examples to pull from cursory googling. Before I go into building this from scratch, I figured I'd ask here if anyone has any helpful examples to point to?

When I try to Query 
Invoice__C[] InvoiceData =  [Select Id,Attachment_Id__c,Supporting_Attachment_Id__c from Invoice__c where Id=:InvoiceId]; 
In the debug I see Only Id and Attachment_Id__c fields, because Supporting_Attachment_Id__c is null.
But then I try to  check it using below line.
if(InvoiceData[0].Supporting_Attachment_Id__c == ''||InvoiceData[0].Supporting_Attachment_Id__c == null)
It throws System.NullPointerException: Attempt to de-reference a null object.

How to solve this issue?
Hello, 

How to stop my lightning combobox option list going outside of screen when i scroll up the screen? 

<template if:true={showalloptions}>
                                <div class="slds-dropdown slds-dropdown_length-5 slds-dropdown_fluid " >
                                    <ul class="slds-listbox slds-listbox_vertical recordListBox" >
                                        <template if:false={messages} >
                                            <template for:each={salesRepListOptions} for:item="rec">
                                                <li aria-checked="true" key={rec.value} data-key={rec.value} class="slds-listbox__item eachItem" onmousedown={selectItem}>
                                                    <div class="slds-media  slds-is-selected slds-has-focus" >
                                                        <lightning-icon icon-name="utility:user" alternative-text="icon" size="small"></lightning-icon>
                                                        <span class="verticalAlign slds-truncate" style="margin-top:15px;margin-left: 10px;">{rec.label}</span>
                                                    </div>
                                                </li>
                                            </template>
                                        </template>
                                        <template if:true={messages} >
                                            <li class="slds-listbox__item">
                                                <span class="slds-media slds-listbox__option_entity">{messages}</span>
                                            </li>
                                        </template>
                                    </ul>
                                </div>
                            </template>
 
I have custom object "Dealer__c" which has only loopup relatedship with Account object.
Now I have to add the "Dealer__c" as a releated list under account page layout? 
Is it possible or is there way to do?

TIA
Hi All,

I have requirement where i have multiple persona ( 4 different persona) with different functionality and we have to create a community for them. What will be the best apporach for this i.e should we create a 4 different community if yes then why ? 
Or should we create a single community with different functionality if yes then why ?

Please suggest...

Thanks
Sid 
hi everyone,
I have 2 profile with User License Customer Community Plus Login
there is a custom object with Project and  its child object Issues
OWD for Issues is controlled by Project
I have given read access to the project and read/write/edit for issue object
also created sharing set for the above 2 profile 
User-added image
some of the user cant see the issue records but when I log in from another customer user with the same profile from another account he can see issue records under his account project
do you have any solution 
Thanks, 
Rahul
Hi,
Is it possible to make a field on opportunity mandatory only if there is a specific primary partner attached to that opportunity (in the Partner related list)?
Hello,

I am receiving the below error and trying to figure out what's causing it. Could anyone assist?

Do i need to add the Approval Process Id as well in the "Action" element?

User-added image

How the Interview Started
Alex Valavanis (0051X000005w6AS) started the flow interview.
API Version for Running the Flow: 51
Some of this flow's variables were set when the interview started.
recordId = a2n0J000004KKNpQAO
GET RECORDS: Find_Distribution_Agreement_Info
Find all Distribution_Agreement__c records where:
Id Equals {!recordId} (a2n0J000004KKNpQAO)
Store the values of these fields in Find_Distribution_Agreement_Info: Agreement_Type__c, Regulatory_Status__c, LEI__c, Organisation__c, Name_of_Company_Register__c, Distributor_Contact_Title__c, Distributor_Contact_Phone__c, Distribution_Agreement_Business_Owner__c, Id, Status__c, Distributor_Contact_Email__c, Company_Number__c, Business_rationale__c
Result
Successfully found records.
DECISION: Do_we_have_required_fields
Outcome executed: Yes_we_have_required_Information
Outcome conditions:
1. {!Find_Distribution_Agreement_Info.Company_Number__c} (null) Does not equal
2. {!Find_Distribution_Agreement_Info.Name_of_Company_Register__c} (null) Does not equal
3. {!Find_Distribution_Agreement_Info.LEI__c} (null) Does not equal
4. {!Find_Distribution_Agreement_Info.Status__c} (Proposed) Equals Proposed
5. {!Find_Distribution_Agreement_Info.Distribution_Agreement_Business_Owner__r.Full_Name__c} (Chris Jones) Does not equal
6. {!Find_Distribution_Agreement_Info.Business_rationale__c} (Existing relationship) Does not equal
7. {!Find_Distribution_Agreement_Info.Distributor_Contact_Title__c} (Legal Counsel) Does not equal
8. {!Find_Distribution_Agreement_Info.Regulatory_Status__c} (Regulated) Does not equal
9. {!Find_Distribution_Agreement_Info.Distributor_Contact_Phone__c} (+49 5678943) Does not equal
10. {!Find_Distribution_Agreement_Info.Distributor_Contact_Email__c} (abc@acolin.com) Does not equal
11. {!Find_Distribution_Agreement_Info.Agreement_Type__c} (Distribution) Does not equal
Logic: Advanced Logic (((1 OR 2) OR 3) AND 4 AND 5 AND 6 AND 6 AND 7 AND 8 AND 9 AND 10 AND 11)
SUBMIT FOR APPROVAL: Distribution_Agreement_Approval_Process
Inputs:
objectId = {!recordId} (a2n0J000004KKNpQAO)


Error Occurred: No applicable approval process was found.

 

global class Batch_AddConToAcc implements Database.Batchable <sObject>,Database.Stateful,Database.AllowsCallouts {
     
     public List<String> nam=new List<String>();
     public Integer processedrecord=0;
    public String exp;
   String query = 'SELECT Id, Name FROM Account WHERE checkacc__c = True';
    global Database.QueryLocator start(Database.BatchableContext bc) {
         
        return Database.getQueryLocator(query);
    }

    global  void execute(Database.BatchableContext bc,List<Account> batch) {
       List<Account> acnt=new List<Account>();
        List<contact> lstCon = new List<Contact>();
        for (Account a : batch) {
           
            Contact c =  new Contact();
            c.LastName = a.Name;
        c.AccountId = a.Id;
            lstCon.add(c);
            a.checkacc__c = False;  
            acnt.add(a);
            processedrecord=processedrecord+1;
            nam.add(a.Name);
        }
        try{
         
       INSERT lstCon;
      
    }
        catch(Exception e){
            exp= e.getMessage();
        }
 update acnt;
        
        }
    
    global void finish(Database.BatchableContext bc) {
     

AsyncApexJob ajob = [SELECT Id, Status, NumberOfErrors, JobItemsProcessed,
                          TotalJobItems, CreatedBy.Email
                          FROM AsyncApexJob WHERE Id =
                          :bc.getJobId()];
 EmailUtility.sendSimpleEmail(ajob.Status,processedrecord,nam,exp);      
        
        
      
        }     
       
    }
I am working on my second Invocable method I want to call within a flow and I am having trouble conceptualizing this.

I want to output 3 different integer values from the invocable method back out to the flow but I don't know how to do this if I can have only one Return statement.

My first invocable method took in one variable and output one value so it was easy.

How should I solve for this?
insertaccount: execution of AfterInsert caused by: System.NullPointerException: Attempt to de-reference a null object Trigger.insertaccount: line 14, column 1

trigger insertaccount on Contact (after insert,after update) 
{
   set<id> accountIdList = new Set<id>();  
    for(contact con : Trigger.new)  
    {  
        accountIdList.add(con.accountid);  
    }  

    Map<Id,account> mapVar = new Map<Id,account>([SELECT id,name
                                                  FROM account WHERE Id IN : accountIdList]);

    for(contact cont : Trigger.new)
    {
            mapVar.get(cont.accountid).name = cont.firstname + cont.LastName;

    }
    update mapVar.values();
}

when I create a new contact so on basis of first name and last name of contact we have to create new account.

Hello everyone,
I want to show all the Chatter groups along with a button to join a group in a lightning component is it possible to do so if yes please help me in creating one.

thanks in advance

Hello,

I have a user with Partner Community license. My goal is to set up the navigation menu of the community in such way that through this menu users can access Service Appointment lists the same way a standard user can open the Service Appointment tab and choose any available record in the list view.

Problem is that the user does not see the list view after clicking on navigation menu item. It throws an error.

Admin preview:

User-added image

What Partner Community user sees:

User-added image

Profile settings of Partner Community user profile:

User-added image

Tabs are also enabled for all objects:

User-added image

What is the problem?
I am very new to this, but I am trying to display a warning toast to users if the stage name on an opportunity is changed from any value to Pending Approval. To do this I was trying to use Lightning components. 

Please see below for my cmp and js code. I tried to take 2 different approaches with this code and neither one have been successful so hoping that someone can provide some tips. Certainly also open to other ways of accomplishing this.

1. Use <aura:if and call the showWarningToast function if true. In the below code I am able to get it to show a button you can click on if the condition is true, but I have not been able to find a way to call the code without having the user click on the button. Also, the below code always shows the warning button if the value is Pending Approval not only if it is changed to Pending Approval.

2. Use <aura:handler name="change" and call the function itemsChange. This option seems more promising since I could easily add a statement to check if old and new value are different and only show the Toast if it is, but I am unable to show the old and new value. It simply shows old value: [object Object]current value: [object Object]

CMP:
<aura:component description="OpportunityTestComponent" implements="flexipage:availableForRecordHome,force:hasRecordId">
    <aura:attribute name="record" type="Object" description="The record object to be displayed"/>
    <aura:attribute name="OpptyRecord" type="Object" description="A simplified view record object to be displayed"/>

    <force:recordData aura:id="record" layoutType="FULL" recordId="{!v.recordId}" targetRecord="{!v.record}" targetFields="{!v.OpptyRecord}" mode="VIEW"/>

    <aura:handler name="change" value="{!v.OpptyRecord.StageName}" action="{!c.itemsChange}"/>
    
    <aura:if isTrue="{!v.OpptyRecord.StageName == 'Pending Approval'}">
         <lightning:button label="Warning" variant="inverse" onclick="{!c.showWarningToast}"/> 
    </aura:if>
</aura:component>

JS:

({
    showWarningToast : function(component, event, helper) {
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams({
            title : 'Please review the award date!',
            message: 'Please review the award date and correct as necessary!',
            key: 'info_alt',
            type: 'warning',
            mode: 'sticky'
        });
        toastEvent.fire();
    },
        itemsChange: function(cmp, evt) {
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams({
            title : 'Please review the award date!',
            message: "old value: " + evt.getParam("oldValue") + "current value: " + evt.getParam("value"),
            key: 'info_alt',
            type: 'warning',
            mode: 'sticky'
        });
        toastEvent.fire();
        }
})

 
  • March 04, 2021
  • Like
  • 0
Since being upgraded to the Spring '20 release, a process that we have has stopped saving BR() in a formula to the Rich Text field it is populating. 

Formula in Process:
"... next steps." + BR() + "<b>Next Step - ..."
Saved value on the record:
"... next steps.<b>Next Step - ..."
Furthermore, the saved value is different in scratch orgs:
... next steps.<br>&lt;/b&gt;Next Step - ..."
Expected output:
... next steps._BR_ENCODED_<b>Next Step - ..."
The last known time we have it saving correctly is Friday before our Spring 20 release. We began having abnormal results the morning after the release. The last time this process was modified was 12/18/2019.

Was there a change in behaviour that I missed included with this release? Has anyone else experienced this issue?