• Sangeet kasera
  • NEWBIE
  • 100 Points
  • Member since 2018
  • Grazitti Interactive


  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 14
    Questions
  • 26
    Replies
I want to update 2 different object and record which are triggering rusing flow.
I have added a decision box and under decision I have added different outcome with criteria. Based on that outcome i am updating record using loop. But whenevr i am debugging the flow only 1st outcome is running even all three outcome condition met for that record.
I want to check all outcome in every transaction and if criteria met it should update the record.
Screenshot for flow is attached.
User-added image
Hello Everyone,

I have a requirment to insert  a feed with attachment link when any email is received in salesforce from EmailMessage [ Like if any customer is sending an email with attachment link so Feed should be inserted and attachment will link in feed ] like below image.
       User-added image

I have a requirment this by using a field -RelatedRecordId from FeedItem Object.

Please help me to get the answer....

Regards,
Sangeet
 
I have created a custom lightning component with fixed footer content using slds-docked-form-footer, and it is working fine for 100% width page but when i am trying to reduce the page size then content goes up and footer is still fixed at bottom.
User-added image
Markup Code -
 <div class="slds-docked-form-footer">
  <lightning:button class="myBtn" variant="brand" label="Save" title="Save" onclick="{! c.save }" />
  <lightning:button class="myBtn slds-m-left_small" variant="brand" label="Cancel" title="Cancel" onclick="{! c.cancel }" />
</div>

Expected- I want that footer will fix at bottom with 100%  width when page size is 100% and page content will be scrollabe except button like below detail page standard functionality.
User-added image​​​​​​​
I just want to display a column baesd on field type, If field type is textarea ar RichTextArea then i want 1 column otherwise i want 2.
I fetched the data in apex to differentiate a fieldType. AnyOne please help me to implement it in pageBlockSection

Apex Code-
 result = new List<String>();
    String query = 'Select Id ';
    for(string fieldset : objectFields.keySet()) {  
        if(selectedCaseSummaryFields.contains(fieldset.toLowercase())){
            Schema.SObjectField fieldSearch = objectFields.get(fieldset);
            Schema.DescribeFieldResult fieldDescribe = fieldSearch.getDescribe();
            if(fieldDescribe.getType() == Schema.DisplayType.TextArea) {
            result.add(fieldDescribe.getLabel());
        }
        caseSummaryFields.Add(fieldset);
        }    
         if(fieldset != 'Id') query += ',' +fieldset;
    }
    System.debug('result' + result);

Visualforce Code-
 <!-- Case Summary Section Starts --> 
  <apex:pageBlockSection title="Summary" columns="2" >
      <apex:repeat value="{!caseSummaryFields}" var="f">
          <apex:outputField value="{!workingCase[f]}" />
      </apex:repeat>
  </apex:pageBlockSection>

Current View-
User-added imageI want description should take in 1 column and others took 2.

Regards,
Sangeet
 
Hi All,

I have one Visualforce page Which has one rich text area comment body, I just want to fetch one Email Template using command button and insert it inside comment body field. Please help me out to solve this issue.

Rich text area comment body
User-added image

Apex Controller-

public EmailTemplate mailBody {get;set;}
public String CheckBody {get;set;}
public pageReference InsertTemplate(){
EmailTemplate mailBody = [SELECT id,name, subject,HtmlValue, Body FROM EmailTemplate WHERE id='00X6F000002ZhmpUAC' ];
System.debug('templateBody'+mailBody.Body);

CheckBody = mailBody.Body;
System.debug('CheckBody'+CheckBody);
return null;
}

Visualforce Page- 
<apex:pageBlockSection columns="1">
    <apex:inputCheckbox value="{!cmt.IsPublished}" label="Public"/>
        <div style="margin-bottom:15px;">
        <apex:inputfield id="ccBody" label="Comment" styleClass="" value="{!workingCase.Case_Comment__c}"  rendered="{!setting.Enable_RichText_Comment__c}">
            <apex:outputText value="{!CheckBody}"></apex:outputText>
        </apex:inputfield>

    <!--  <apex:inputtextarea id="ccBody1" label="Comment"  styleClass="cmntBody" value="{!workingCase.Case_Comment__c}" rendered="{!not(setting.Enable_RichText_Comment__c)}" cols="100" rows="15">
    <apex:outputText value="{!CheckBody}"></apex:outputText>
    </apex:inputtextarea> -->
    <apex:inputHidden value="{!nonStaticAttachmentIdType}" id="myHiddenField"/>
        <apex:actionFunction name="passStringToController" action="{!getAttachmentvalues}" rerender="myHiddenField"/>
    </div>
</apex:pageBlockSection>

When I am printing both variable i dont know why mail body is coming blank.
Checkbody Data=== {!CheckBody}
Mail Body Data ==={!mailBody.Body}

 <apex:outputText value="{!CheckBody}"></apex:outputText>
This Output text I wan to shiw inside comment body when i click on command button.

Regards,
Sangeet
Hi All,

I am creating a filter with checkboxes, I want when case comment checkbox is true then all comment associated with case are shown and when we check checkbox Email, Then only comments which are added by mail should be shown means-
  • If Email is check for email-to-case then only comment are shown which startsWith To:
  • and If Case Comment is checked then except To: comments should be shown.
I don't know startsWith is used in SOQL or not but i Used like operater but it is showing error please help me to find the correct query

My sample code are -
if(filterLabel.isEmpty() && commentFilter==true){
    System.debug('Inside custom setting Enable If query');
    String srchValue = 'To:';
    string tempInput = '%' + srchValue + '%';
    commentQuery = commentQuery + ' And CommentBody NOT LIKE \'%' + srchValue + '%\'';
    System.debug('Inside if of custom setting check'+commentQuery);
}
else if(!filterLabel.isEmpty() && commentFilter==true && !filterLabel.contains('Email')){
    String srchValue = 'To:';
    string tempInput = '%' + srchValue + '%';
    commentQuery = commentQuery + ' And CommentBody LIKE \'%' + srchValue + '%\'';
    System.debug('Inside first else of custom setting check'+commentQuery);
}
else if(!filterLabel.isEmpty() && !commentFilter==true && !filterLabel.contains('Email')){
    commentQuery = commentQuery +' And Createdby.Id IN: Ids';
    System.debug('Inside second else of custom setting check'+commentQuery);
}
else if(!filterLabel.isEmpty() && !commentFilter==true && FilterStringValue=='Email' && filterLabel.contains('Email')){
    String srchValue = 'To:';
    string tempInput = '%' + srchValue + '%';
    commentQuery = commentQuery + ' And CommentBody LIKE \'%' + srchValue + '%\'';
    System.debug('Inside third else of custom setting check'+ commentQuery);
}
else if(!filterLabel.isEmpty() && commentFilter==true && FilterStringValue=='Email' && filterLabel.contains('Email')){
    commentQuery = commentQuery;
    System.debug('Inside fourth else of custom setting check'+ commentQuery);
}
else if(!filterLabel.isEmpty() && commentFilter==true && filterLabel.contains('Email')){
    commentQuery = commentQuery;
    System.debug('Inside fifth else of custom setting check'+commentQuery);
}

I also used below query - 

String
startValue = 'To:';
   commentQuery = commentQuery + ' And CommentBody NOT LIKE '+ startValue +'%\'';

Regards,
Sangeet
I have one Dyanmic query using Not In operator but it is giving an error when i am trying to run my code i used several ways but still not found the solution.

I am not good in using escape character in where condition of SOQL
Please help me out
Query -
String 
CreatedById = '5006F00002iorNcQAI';
I Tried 
  •    customObjQuery = customObjQuery+' And (Createdby.Id NOT IN:CreatedById)'; 
  •   customObjQuery = customObjQuery+' And Createdby.Id =\''+IN:CreatedById+'\'';
Anyone also please explain the concept of using escape character in SOQL.

Regards,
Sangeet
Hi,

I am using Conditional if condition in styleClass attribute of <apex:commandbutton> to render a button class as per value selected by picklist, but it is not working.

Below is my picklist and command button
 <div class="sortStyle11">
  <b style="margin-right: 8px;"> Sort by Relevance:</b>
    <apex:selectList size="1" value="{!pickvalueForSubsUnSubs}">
        <apex:actionSupport event="onchange" action="{!perform}" rerender="table1k"/>
        <apex:selectOption itemLabel="--None--" itemValue="--None--" ></apex:selectOption>
        <apex:selectOption itemLabel="Subscribed" itemValue="Subscribed" ></apex:selectOption>
        <apex:selectOption itemLabel="Unsubscribed" itemValue="Unsubscribed"></apex:selectOption>
        </apex:selectList>
       <apex:commandButton value="Search records" action="{!MassSubORUnSub}"  styleClass="{!IF(pickvalueForSubsUnSubs == '--None--','check', IF(pickvalueForSubsUnSubs == 'Unsubscribed','SubscribedClass', 'UnSubscribedClass'))}}" style="width: 153px;border-radius: 17px;line-height: 2;margin-left: 10px;"/>
</div>

Initally i want button to be hide and when  pickilst value is subscribed I want to rendered one UnSubscribedClass and same for another.

Regards,
Sangeet 
 
I am using inline editing in my table tag, to update the data of any cell.

I iterated table data from apex class, also i have implemented ondbclick() for edit the cell but when I am double clicking on the cell then it edit whole column.

I want, When i am double clicking of any cell on column Email Digest it edit's only that cell.
Below Snapshot- 
User-added image
Below is my table from itertion-

<aura:attribute name="showLink" type="Boolean" default="true" />
  <aura:iteration items='{!v.subscriptions}' var="sub" >
        <tr class="backround_colr bg-altrnate-color">
            <td>{!sub.subs.ObjectSubscription__c}</td>
            <td>{!sub.objTitle}</td>
            <td>{!sub.subs.Record_Id__c}</td>
            <td ondblclick = "{!c.inlineEdit}" style="{! v.showLink == true ? '' : 'display:None'}">{!sub.subs.Email_Digest__c}</td>
                <div style="{! v.showLink == false ? '' : 'display:None'}">
                    <lightning:input name="titleField" required= "true" aura:id="titleFieldVal" label="Title" value="{!sub.subs.Email_Digest__c}"/><br/>
                    <div class="slds-align_absolute-center" >
                        <lightning:button variant="brand" value="{!v.itrr.id}" label="Save" title="Save" onclick="{! c.saveRecord }" />
                        <lightning:button variant="brand" value="{!v.itrr.Title}" label="Cancel" title="Cancel" onclick="{! c.cancelRecord }" />
                    </div>
                </div>
            <td>{!sub.subs.SubscribedBy__c}</td>
            <td><lightning:button variant="{!sub.subs.Activated__c==true ? 'destructive' : 'success'}" class="buttonStyle" label="{!sub.subs.Activated__c==true ? 'UnSubscribe' : 'Subscribe'}" value="{!sub.subs.Id}" onclick="{!c.handleSubsOrUnSubs}"/></td>
        </tr>
     </aura:iteration>
Controller for ondbclick-
   inlineEdit  : function(component, event, helper) {
        component.set("v.showLink",false);
    },
 
I am not good In Visualforce Page, Please help me out...
I have created one vf page for searching user record stored in custom object Subscription__c by from which user directly subscribe or unsubscribe the record using command button.
I also added one more button for inline editing, but for that editing is working fine, I am able to do so but the record is not getting updated now means it is not getting saved.
UI:-
User-added image

Apex Class :- 

public with sharing class ListPageForAdminController {
    
    public boolean hideSec{get; set;}
    public List<Subscription__c> subsD {get;set;}
    public String searchKey {get;set;}
    public Id paramValue3 {get;set;} 
    public integer totalRecs = 0;
    public integer OffsetSize = 0;
    public integer LimitSize= 5;
    
    public ListPageForAdminController(){
        hideSec = false;
        totalRecs = [select count() from Subscription__c];
    } 
    
    public pagereference perform(){
        subsD = new List<Subscription__c>();
        List<String> searchData = new List<String>();
        searchData = searchKey.split(',');
        string searchquery='SELECT id, SubscribedBy__c, ObjectSubscription__c,Record_Id__c,Activated__c FROM Subscription__c';
        string whereClause = ' where ';
        if(searchKey == ''){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.FATAL,'Please enter UserDetail'));
            if(subsD.isEmpty()){
                subsD.clear();
                hideSec = false;
            } 
        }
        else{
            for (string s : searchData){  
                if (whereClause == ' where '){
                    whereClause += ' SubscribedBy__r.Name like \'%'+ s +'%\' OR SubscribedBy__r.Email like \'%'+ s +'%\' ';
                }
                else{
                    whereClause += ' or SubscribedBy__r.Name like \'%'+ s +'%\' OR SubscribedBy__r.Email like \'%'+s+'%\' ';
                } 
             }
            hideSec = true;
            searchquery += whereClause + ' LIMIT :LimitSize OFFSET :OffsetSize' ;
            subsD= Database.query(searchquery);
        }
        return null;
    }
    public PageReference quickUpdat(){
        try{
            List<Subscription__c> obj1 = new List<Subscription__c>();
            Subscription__c initial11 = new Subscription__c();
            initial11.Id = paramValue3;
            obj1.add(initial11);
            update obj1;
            return ApexPages.CurrentPage();
        }
        catch(Exception e) {
            System.debug('@@@Error');
            return null;
        }
    }
 public PageReference SubORUnSub(){
            List<Subscription__c> obj1 = new List<Subscription__c>();
            Subscription__c initial = new Subscription__c();
            initial.id = paramValue3;
            if(paramValue4==false){
                initial.Activated__c = true;
            }    
            else {
                initial.Activated__c = false;
            }
            obj1.add(initial);
            update obj1; 
            System.debug('alt' + paramValue3);
            System.debug('alt' + paramValue4);
            return null;
            
        }
    }

Visualforce Page:-
<apex:page title="List Page For Admin" controller="ListPageForAdminController" lightningStylesheets="true" sidebar="false" id="thePage">
<style>
</style>
<script>
function decimalOnly(e){
    e.value = e.value.replace(/[^A-Za-z\,@.]/g,'');   
    if(e.value.split(',').length>2) e.value = e.value.replace(/ \,+$/,"");
    
};   
</script>
<apex:slds />
<div>
<div class="slds-scope">
        <apex:form > 
            <div class="slds-grid slds-wrap">
                <div class="slds-col slds-size_12-of-12">
                    <div class="slds-grid slds-wrap">
                        <div class="slds-col slds-size_12-of-12">
                            <div class="slds-col slds-size_5-of-12">
                                <apex:pageMessages ></apex:pageMessages>
                            </div> 
                            <span class="searchBox_Label">Enter UserDetail to Search</span> 
                            
                            <apex:inputText value="{!searchKey}" html-placeholder="Enter Text to search" onkeyup="decimalOnly(this);" label="Input" style="width: 300px;line-height: 2;margin-left: 10px;"/>
                            <apex:commandButton value="Search records" action="{!perform}"  styleClass="slds-button slds-button--brand" style="width: 153px;border-radius: 17px;line-height: 2;margin-left: 10px;"/>
                        </div>
                        <div class="slds-col slds-size_12-of-12" id="op" >
                            <apex:pageBlock title="Search Result" id="details" rendered="{!hideSec}" mode="inlineEdit">
                                <apex:pageBlockTable value="{!subsD}" var="srh">
                                    <apex:column value="{!srh.id}"/>
                                    <apex:column value="{!srh.ObjectSubscription__c}"/>
                                    <apex:column value="{!srh.Record_Id__c}"/>
                                    <apex:column value="{!srh.Activated__c}"/>
                                    <apex:column value="{!srh.SubscribedBy__c}"/>
                                    <apex:column >
                                        <apex:commandButton id="update" action="{!quickUpdat}" value="save" >
                                            <apex:param name="subId" value="{!srh.id}" assignTo="{!paramValue3}"/>
                                        </apex:commandButton>
                                    </apex:column>
                                    <apex:column title="Action" headerValue="Subscribe/Unsubscribe"> 
                                        <apex:commandButton value="{!if(srh.Activated__c = true,'UnSubscribe', 'Subscribe')}" action="{!SubORUnSub}" oncomplete="window.location.reload();" styleClass="{!if(srh.Activated__c = true,'slds-button slds-button--destructive', 'slds-button slds-button--success')}" style="width: 192px;border-radius: 17px;line-height: 2;margin-left: 10px;">
                                            <apex:param name="subscriptionId" value="{!srh.id}" assignTo="{!paramValue3}"/>
                                            <apex:param name="subsActivated" value="{!srh.Activated__c}" assignTo="{!paramValue4}"/>
                                        </apex:commandButton>
                                    </apex:column>
                                    <apex:inlineEditSupport showOnEdit="update, cancelButton" hideOnEdit="editButton" event="ondblclick"
                                                            changedStyleClass="myBoldClass" resetFunction="resetInlineEdit">
                                    </apex:inlineEditSupport>
                                </apex:pageBlockTable>
                                <apex:pageblockButtons >
                                    <apex:commandButton value="First Page" rerender="details" action="{!FirstPage}" disabled="{!prev}"/>
                                    <apex:commandButton value="Previous" rerender="details" action="{!previous}" disabled="{!prev}"/>
                                    <apex:commandButton value="Next" rerender="details" action="{!next}" disabled="{!nxt}"/>
                                    <apex:commandButton value="Last Page" rerender="details" action="{!LastPage}" disabled="{!nxt}"/>
                                </apex:pageblockButtons>
                                
                            </apex:pageBlock> 
                            </div>
                    </div>
                </div>
            </div>
        </apex:form>
    </div>
</div>
</apex:page>
I Have one  <apex:inputText value="{!searchKey}" html-placeholder="Enter Text to search"/>

User-added image


Where User Enter's Comma Seperated Values like Record ID and Name(Ex:- 01I2w000000eRuaEAE, Raj) both are different User Id and Name, I want to extract both user's data using SOQL.

Below is my Apex code-

 public List<Subscription__c> subsD {get;set;}
    public String searchKey {get;set;}
    //List<String> searchData = searchKey.split(',');
    public Id paramValue3 {get;set;} 
    public boolean paramValue4 {get;set;}
    
    public void perform(){
        List<String> searchData = new List<String>();
        searchData = searchKey.split(',');
        string searchquery='SELECT id, SubscribedBy__c, ObjectSubscription__c,Record_Id__c,Activated__c FROM Subscription__c where SubscribedBy__r.Name like \'%'+ searchData +'%\' OR SubscribedBy__r.Email like \'%'+searchData+'%\' Limit 10';
        subsD= Database.query(searchquery);
    }

I am getting query in debug like this-

14:35:38:021 SOQL_EXECUTE_BEGIN [13]|Aggregations:0|SELECT id, SubscribedBy__c, ObjectSubscription__c,Record_Id__c,Activated__c FROM Subscription__c where SubscribedBy__r.Name like '%xxx, yyy%' OR SubscribedBy__r.Email like '%(xxx,  yyy)%' Limit 10

Any one Please Help me to get the correect query by which I can Extract data for both
 
I am new in salesforce development please help me out, I have one Picklist field in my project from where uer can select the email diget value to get mail.
User-added imageI am new in salesforce development please help meout, I have one Picklist field in my project from where uer can select the email diget value to get mail. 

Now I have created one Schedular to Schedule mail and call batch class from it for sending mail to individual user as per subscribed data, If any user subscribed some record from list and some of them are edited within 24 hour so i want to send list of mail to user that these records are updated within 24 hour, Or if anyone wants mail weekly then send same to that user.

Means I want to handle it at user level for every user.

Currently I have 2 records in debug in email digest field for User 1 is daily and and User 2 is weekly but this accepts only weekly record and sent mail to current user.

I want schedular to schedule at user level If User 1 wants daily mail then he got(List of record updated within day) and if user 2 wants weekly(List of record updated in last week) then he got.

Below is my Batch class and scheduler

Schedular Class:-
global class EmailSchedularForIdea implements Schedulable{
    List<String> EmailDigestValue = new List<String>(); 
    List<String> EmailDigestObjValue = new List<String>(); 
    List<String> ideaIdSet= new List<String>(); 
    Map<String,Idea> ideaMap = new Map<String,Idea>();
    
    global EmailSchedularForIdea(){
        
    } 
    global void execute(SchedulableContext SC) {
        Integer Days = 0; 
        // String emailQuery = 'SELECT Email_Digest__c, Object_Name__c FROM Email_Digest__c WHERE CreatedById =: UserInfo.getUserId()';
        List<Email_Digest__c> queryForData = [SELECT Email_Digest__c, Object_Name__c FROM Email_Digest__c WHERE CreatedById =: UserInfo.getUserId()];
        //  List<Email_Digest__c> queryForData = Database.query(emailQuery);
        
        for(Email_Digest__c emailDigestData : queryForData)
        {
            EmailDigestValue.add(emailDigestData.Email_Digest__c);
            EmailDigestObjValue.add(emailDigestData.Object_Name__c);
        }
        System.debug('EmailDigestValue ' + EmailDigestValue);
        System.debug('EmailDigestValue ' + EmailDigestObjValue);
        if(EmailDigestValue.contains('Daily') && EmailDigestObjValue.contains('Idea')){
            Days = 1;
            System.debug('EmailDigestValue==Daily ' + Days);
        }
        if(EmailDigestValue.contains('Weekly') && EmailDigestObjValue.contains('Idea')){
            Days = 7;
            System.debug('EmailDigestValue==Weekly ' + Days);
        }
        if(EmailDigestValue.contains('Monthly') && EmailDigestObjValue.contains('Idea')){
            Days = 30;
            System.debug('EmailDigestValue==Monthly ' + Days);
        }
        String IdeaData = 'SELECT Id, Title, CreatedDate, LastModifiedDate FROM Idea WHERE LastModifiedDate = LAST_N_DAYS:' + Days + ' ORDER BY LastModifiedDate DESC';
        List<Idea> ideaQuery = Database.query(IdeaData);
        System.debug('ideaQuery_____ '+ ideaQuery);
        for(Idea Ide : ideaQuery){
            ideaIdSet.add(Ide.id);
            ideaMap.put(Ide.id,Ide);
            
            System.debug('ideaIdSet_____ '+ ideaIdSet);
            System.debug('ideaMap=====' + ideaMap);
        }
            try{
                EmailNotificationBatchJob bb = new EmailNotificationBatchJob(ideaIdSet);
                Database.executeBatch(bb);
            }
            catch(Exception e){
            }
     }
}

Batch Class:-
global class EmailNotificationBatchJob implements Database.Batchable<sObject>{
    //  public List<SObject> availableObject = ['Idea, Knowledge__kav'];
    Map<String, List<Subscription__c>> ideaSubMap= new Map<String, List<Subscription__c>>();
    List<String> datalist = new List<String>();
    global EmailNotificationBatchJob(List<String>  returnRecordId){
        datalist = returnRecordId;
    } 
    
    public List<SObject> start(Database.BatchableContext BC)
    { 
        List<Subscription__c> IdeaSub = [Select Id, SubscribedBy__c, ObjectSubscription__c,Record_Id__c,SubscribedBy__r.Email from Subscription__c where Record_Id__c =: datalist AND SubscribedBy__c =: UserInfo.getUserId()];        
        System.debug('IdeaSub ' + IdeaSub);
        return IdeaSub;
        
    }
    global void execute(Database.BatchableContext BC, List<Subscription__c> editedIdeaId)
    {
        // List<Contact> con = new List<Contact>([Select id, Name From Contact LIMIT 2]);
        
        List<Subscription__c> sublist2 = new  List<Subscription__c>();
        String objectName;
        String subscriptionId;
        system.debug('editedIdeaId-->'+editedIdeaId);
        //   List<Messaging.MassEmailMessage> mails = new List<Messaging.MassEmailMessage>();
        if(!editedIdeaId.isEmpty()){
            System.debug('editedIdeaId ' + editedIdeaId);
            for(Subscription__c subscriptionData:editedIdeaId){
                if(ideaSubMap.containsKey(subscriptionData.SubscribedBy__r.Email)){
                    sublist2 = ideaSubMap.get(subscriptionData.SubscribedBy__r.Email);
                }
                
                sublist2.add(subscriptionData);
                System.debug('sublist2 ' + sublist2);
                ideaSubMap.put(subscriptionData.SubscribedBy__r.Email,sublist2);
                System.debug('ideaSubMap ' + ideaSubMap);
            }
            for(Subscription__c objName : sublist2){
                objectName = objName.ObjectSubscription__c;
                subscriptionId = objName.Id;
            }
            System.debug('objectName@@@@@@ ' + objectName);
            System.debug('subscriptionId@@@@ ' + subscriptionId);
            List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>(); 
            String templateName;
            String userEmail;
            List<Id> usr = new List<Id>();
            List<Id> records = new List<Id>();
            for(String ownerIdss:ideaSubMap.Keyset()){
                templateName = objectName +' Batch Subscribe Template';
                userEmail = ownerIdss;
                System.debug('ideaSubMap@@@@@@' + ideaSubMap);
                messaging.singleEmailMessage mail = new messaging.singleEmailMessage();
                mail.ToAddresses = new string[]{userEmail};
                    mail.setSubject('---------List of Record--------- ');
                mail.setUseSignature(false);
                string htmlBody = '<div> ';
                htmlBody += '<table border="1px""><tr> <td><b>Record Ids </b></td>';
                for(Subscription__c idsss : sublist2){
                    //  System.debug('List is'+id);
                    System.debug('Record ids now are'+idsss.Record_Id__c );
                    htmlBody += '<td> ' + idsss.Record_Id__c + '</td>';
                }
                htmlBody += '</tr> </table> </div>';
                mail.setHtmlBody(htmlBody);
                mail.setSaveAsActivity(false);
                mails.add(mail); 
            }
            System.debug('mails' + mails);
            Messaging.sendEmail(mails);
        }
        
    }
    global void finish(Database.BatchableContext bc){
        
    }
}
I have Created one custom setting with email digest feature which sends a mail to user through batch classes as per record value stored.

For Ex- If Internal user stores as Email Digest Daily then he would get mail daily, and if he selects as weekly then he get mail weekly for record update, which is working for perfect for Internal user.

I am mangaging(storing) custom setting data for user from apex class.
User-added image
But this data is stored at org level, means if internal user saves email digest value as daily then this is applied for every user.

I want to change update this custom setting data at user level by which i can set the schedular as per user want.

If Suppose any uesr wants mail to daily then he got mail daily record update and if any one wants weekly then it got.
I am new in salesforce development please help me out, I have one Picklist field in my project from where uer can select the email diget value to get mail.
User-added imageI am new in salesforce development please help meout, I have one Picklist field in my project from where uer can select the email diget value to get mail. 

Now I have created one Schedular to Schedule mail and call batch class from it for sending mail to individual user as per subscribed data, If any user subscribed some record from list and some of them are edited within 24 hour so i want to send list of mail to user that these records are updated within 24 hour, Or if anyone wants mail weekly then send same to that user.

Means I want to handle it at user level for every user.

Currently I have 2 records in debug in email digest field for User 1 is daily and and User 2 is weekly but this accepts only weekly record and sent mail to current user.

I want schedular to schedule at user level If User 1 wants daily mail then he got(List of record updated within day) and if user 2 wants weekly(List of record updated in last week) then he got.

Below is my Batch class and scheduler

Schedular Class:-
global class EmailSchedularForIdea implements Schedulable{
    List<String> EmailDigestValue = new List<String>(); 
    List<String> EmailDigestObjValue = new List<String>(); 
    List<String> ideaIdSet= new List<String>(); 
    Map<String,Idea> ideaMap = new Map<String,Idea>();
    
    global EmailSchedularForIdea(){
        
    } 
    global void execute(SchedulableContext SC) {
        Integer Days = 0; 
        // String emailQuery = 'SELECT Email_Digest__c, Object_Name__c FROM Email_Digest__c WHERE CreatedById =: UserInfo.getUserId()';
        List<Email_Digest__c> queryForData = [SELECT Email_Digest__c, Object_Name__c FROM Email_Digest__c WHERE CreatedById =: UserInfo.getUserId()];
        //  List<Email_Digest__c> queryForData = Database.query(emailQuery);
        
        for(Email_Digest__c emailDigestData : queryForData)
        {
            EmailDigestValue.add(emailDigestData.Email_Digest__c);
            EmailDigestObjValue.add(emailDigestData.Object_Name__c);
        }
        System.debug('EmailDigestValue ' + EmailDigestValue);
        System.debug('EmailDigestValue ' + EmailDigestObjValue);
        if(EmailDigestValue.contains('Daily') && EmailDigestObjValue.contains('Idea')){
            Days = 1;
            System.debug('EmailDigestValue==Daily ' + Days);
        }
        if(EmailDigestValue.contains('Weekly') && EmailDigestObjValue.contains('Idea')){
            Days = 7;
            System.debug('EmailDigestValue==Weekly ' + Days);
        }
        if(EmailDigestValue.contains('Monthly') && EmailDigestObjValue.contains('Idea')){
            Days = 30;
            System.debug('EmailDigestValue==Monthly ' + Days);
        }
        String IdeaData = 'SELECT Id, Title, CreatedDate, LastModifiedDate FROM Idea WHERE LastModifiedDate = LAST_N_DAYS:' + Days + ' ORDER BY LastModifiedDate DESC';
        List<Idea> ideaQuery = Database.query(IdeaData);
        System.debug('ideaQuery_____ '+ ideaQuery);
        for(Idea Ide : ideaQuery){
            ideaIdSet.add(Ide.id);
            ideaMap.put(Ide.id,Ide);
            
            System.debug('ideaIdSet_____ '+ ideaIdSet);
            System.debug('ideaMap=====' + ideaMap);
        }
            try{
                EmailNotificationBatchJob bb = new EmailNotificationBatchJob(ideaIdSet);
                Database.executeBatch(bb);
            }
            catch(Exception e){
            }
     }
}

Batch Class:-
global class EmailNotificationBatchJob implements Database.Batchable<sObject>{
    //  public List<SObject> availableObject = ['Idea, Knowledge__kav'];
    Map<String, List<Subscription__c>> ideaSubMap= new Map<String, List<Subscription__c>>();
    List<String> datalist = new List<String>();
    global EmailNotificationBatchJob(List<String>  returnRecordId){
        datalist = returnRecordId;
    } 
    
    public List<SObject> start(Database.BatchableContext BC)
    { 
        List<Subscription__c> IdeaSub = [Select Id, SubscribedBy__c, ObjectSubscription__c,Record_Id__c,SubscribedBy__r.Email from Subscription__c where Record_Id__c =: datalist AND SubscribedBy__c =: UserInfo.getUserId()];        
        System.debug('IdeaSub ' + IdeaSub);
        return IdeaSub;
        
    }
    global void execute(Database.BatchableContext BC, List<Subscription__c> editedIdeaId)
    {
        // List<Contact> con = new List<Contact>([Select id, Name From Contact LIMIT 2]);
        
        List<Subscription__c> sublist2 = new  List<Subscription__c>();
        String objectName;
        String subscriptionId;
        system.debug('editedIdeaId-->'+editedIdeaId);
        //   List<Messaging.MassEmailMessage> mails = new List<Messaging.MassEmailMessage>();
        if(!editedIdeaId.isEmpty()){
            System.debug('editedIdeaId ' + editedIdeaId);
            for(Subscription__c subscriptionData:editedIdeaId){
                if(ideaSubMap.containsKey(subscriptionData.SubscribedBy__r.Email)){
                    sublist2 = ideaSubMap.get(subscriptionData.SubscribedBy__r.Email);
                }
                
                sublist2.add(subscriptionData);
                System.debug('sublist2 ' + sublist2);
                ideaSubMap.put(subscriptionData.SubscribedBy__r.Email,sublist2);
                System.debug('ideaSubMap ' + ideaSubMap);
            }
            for(Subscription__c objName : sublist2){
                objectName = objName.ObjectSubscription__c;
                subscriptionId = objName.Id;
            }
            System.debug('objectName@@@@@@ ' + objectName);
            System.debug('subscriptionId@@@@ ' + subscriptionId);
            List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>(); 
            String templateName;
            String userEmail;
            List<Id> usr = new List<Id>();
            List<Id> records = new List<Id>();
            for(String ownerIdss:ideaSubMap.Keyset()){
                templateName = objectName +' Batch Subscribe Template';
                userEmail = ownerIdss;
                System.debug('ideaSubMap@@@@@@' + ideaSubMap);
                messaging.singleEmailMessage mail = new messaging.singleEmailMessage();
                mail.ToAddresses = new string[]{userEmail};
                    mail.setSubject('---------List of Record--------- ');
                mail.setUseSignature(false);
                string htmlBody = '<div> ';
                htmlBody += '<table border="1px""><tr> <td><b>Record Ids </b></td>';
                for(Subscription__c idsss : sublist2){
                    //  System.debug('List is'+id);
                    System.debug('Record ids now are'+idsss.Record_Id__c );
                    htmlBody += '<td> ' + idsss.Record_Id__c + '</td>';
                }
                htmlBody += '</tr> </table> </div>';
                mail.setHtmlBody(htmlBody);
                mail.setSaveAsActivity(false);
                mails.add(mail); 
            }
            System.debug('mails' + mails);
            Messaging.sendEmail(mails);
        }
        
    }
    global void finish(Database.BatchableContext bc){
        
    }
}
Hello Everyone,

I have a requirment to insert  a feed with attachment link when any email is received in salesforce from EmailMessage [ Like if any customer is sending an email with attachment link so Feed should be inserted and attachment will link in feed ] like below image.
       User-added image

I have a requirment this by using a field -RelatedRecordId from FeedItem Object.

Please help me to get the answer....

Regards,
Sangeet
 
I have created a custom lightning component with fixed footer content using slds-docked-form-footer, and it is working fine for 100% width page but when i am trying to reduce the page size then content goes up and footer is still fixed at bottom.
User-added image
Markup Code -
 <div class="slds-docked-form-footer">
  <lightning:button class="myBtn" variant="brand" label="Save" title="Save" onclick="{! c.save }" />
  <lightning:button class="myBtn slds-m-left_small" variant="brand" label="Cancel" title="Cancel" onclick="{! c.cancel }" />
</div>

Expected- I want that footer will fix at bottom with 100%  width when page size is 100% and page content will be scrollabe except button like below detail page standard functionality.
User-added image​​​​​​​
I just want to display a column baesd on field type, If field type is textarea ar RichTextArea then i want 1 column otherwise i want 2.
I fetched the data in apex to differentiate a fieldType. AnyOne please help me to implement it in pageBlockSection

Apex Code-
 result = new List<String>();
    String query = 'Select Id ';
    for(string fieldset : objectFields.keySet()) {  
        if(selectedCaseSummaryFields.contains(fieldset.toLowercase())){
            Schema.SObjectField fieldSearch = objectFields.get(fieldset);
            Schema.DescribeFieldResult fieldDescribe = fieldSearch.getDescribe();
            if(fieldDescribe.getType() == Schema.DisplayType.TextArea) {
            result.add(fieldDescribe.getLabel());
        }
        caseSummaryFields.Add(fieldset);
        }    
         if(fieldset != 'Id') query += ',' +fieldset;
    }
    System.debug('result' + result);

Visualforce Code-
 <!-- Case Summary Section Starts --> 
  <apex:pageBlockSection title="Summary" columns="2" >
      <apex:repeat value="{!caseSummaryFields}" var="f">
          <apex:outputField value="{!workingCase[f]}" />
      </apex:repeat>
  </apex:pageBlockSection>

Current View-
User-added imageI want description should take in 1 column and others took 2.

Regards,
Sangeet
 
I have one Dyanmic query using Not In operator but it is giving an error when i am trying to run my code i used several ways but still not found the solution.

I am not good in using escape character in where condition of SOQL
Please help me out
Query -
String 
CreatedById = '5006F00002iorNcQAI';
I Tried 
  •    customObjQuery = customObjQuery+' And (Createdby.Id NOT IN:CreatedById)'; 
  •   customObjQuery = customObjQuery+' And Createdby.Id =\''+IN:CreatedById+'\'';
Anyone also please explain the concept of using escape character in SOQL.

Regards,
Sangeet
   map<id,string> prodArtifectsmap = new map<id,string>();
Repalce String AS List  in a map i have probleam in the for loop .. how can i do that. what is correct solution for that.please let me know..
Hi please help me some poc's or code snippet if possible. I need to 1st get all the custom setting from the entire org then need to search email field type to all those custom settings ..Find those email field and then update with the new value. Some of the custom settings are having 3 email type fields as toEmail, ccEmail and bccEmail my code should find all those 3 fields across all custom settings and then update with the new email id .Please provide some code snippet if possible Mag.. Thanks for the help...
Kindly let me what mistake I am making in below SOQL?

select Week__c from cutomobject where OwnerId = userinfo.getUserId()

select Week__c, max(createddate),max(Name) Submittername from cutomObject where OwnerId = :userinfo.getUserId() group by Week__c order by max(createddate) desc LIMIT 10
Hi All,
Good day!!
I created one lightning table and added Inline edit for one column .When I was trying to edit column and update the new value its not saving the record .
.Please help me out.
Here is my code 
public class BillingHoursTimesheet
 {
                @AuraEnabled
    public static List<wrapper> getBillingRecord(string invoiceid )  
   {
  
       string projectid ; 
       date start;
       date endda;
       
         
       List<Invoice__c> res =[select Start_Date__c,End_Date__c,Project__c from Invoice__c where Id=:invoiceid]; 
       if(res.size()>0){
          projectid =res[0].Project__c;
               start =res[0].Start_Date__c;
           endda =res[0].End_Date__c;
       }
       
       List<wrapper> wr =new List<wrapper>(); 
        map<String, Decimal> projMap = new map<String, Decimal>(); 
       for(Project_Team_Member__c ptm: [select Id, Employeee__r.Name , Charged_Rate__c  from Project_Team_Member__c where Project__c=:projectid  ]){
        projMap.put(ptm.Employeee__r.Name, ptm.Charged_Rate__c);       
           system.debug('Value of Rate:'+ ptm);   
       }      
       for(AggregateResult tes: [select Timesheet__r.Employeee__r.Name em , SUM(No_of_hours__c) tot from Timesheet_Detail__c where Project__c=:projectid AND  Date__c>=:start AND Date__c<=:endda group by Timesheet__r.Employeee__r.Name ])
       {
   
         
           wrapper t = new wrapper();
           t.empname =String.valueof(tes.get('em'));
           t.hour =(Decimal) tes.get('tot');
           t.chargedhour =(Decimal) tes.get('tot'); 
           t.rate=projMap.get(t.empname); 
          wr.add(t);
       } 
       
       return wr; 
      
    }
     public class wrapper{
         @AuraEnabled
        public string empname;
          @AuraEnabled 
         public decimal hour;
         @AuraEnabled 
         public decimal chargedhour;
         @AuraEnabled
         public Decimal rate;
     } 
     @AuraEnabled
     public static boolean saveAccount(List<Project_Team_Member__c> lstAccount) {  
       try { 
          
            update lstAccount;  
            return true;  
              
        } catch(Exception e) {  
          
            return false;  
              
        }  
            
        
    } 
}
 
({
                doInit : function(component, event, helper) {
                                helper.getBillingRecord(component); 
                },
    
    
    inlineEditName : function(component,event,helper){   
       
        component.set("v.nameEditMode", true); 
        
        setTimeout(function(){ 
            component.find("inputId").focus();
        }, 100);
    },
    
    Save: function(component, event, helper) {
      
        if (helper.requiredValidation(component, event)){
             
               var action = component.get("c.saveAccount");
                  action.setParams({
                    'lstAccount': component.get("v.billLst")
                  });
            action.setCallback(this, function(response) {
                var state = response.getState();
                if (state === "SUCCESS") {
                    var storeResponse = response.getReturnValue();
                    
                    component.set("v.billLst", storeResponse); 
                
                    component.set("v.showSaveCancelBtn",false);
                    alert('Updated...');
                }
            });
            $A.enqueueAction(action);
        } 
    },
    
    cancel : function(component,event,helper){
      
        $A.get('e.force:refreshView').fire(); 
    } ,
    
     closeNameBox : function (component, event, helper) {
        
        component.set("v.nameEditMode", false); 
     
        if(event.getSource().get("v.value").trim() == ''){
            component.set("v.showErrorClass",true);
        }else{
            component.set("v.showErrorClass",false);
        }
    }, 
    
    onNameChange : function(component,event,helper){ 
       
        if(event.getSource().get("v.value").trim() != ''){  
            component.set("v.showSaveCancelBtn",true);
        }
    }
    
  
})
 
<aura:component controller="BillingHoursTimesheet" implements="force:appHostable,force:hasRecordId,forceCommunity:availableForAllPageTypes,flexipage:availableForAllPageTypes" access="global">
 <aura:handler name="init" value="{!this}" action="{!c.doInit}" /> 
    <!-- calling doInit method in Component Controller -->
    
    <aura:attribute name="showSaveCancelBtn" type="boolean" default="false" description="flag for rendered save and cancel buttons in aura:if "/>
    <aura:attribute name="showErrorClass" type="boolean" default="false"/> 
    <aura:attribute name="nameEditMode" type="boolean" default="false" />
    <aura:attribute name="ratingEditMode" type="boolean" default="false" />
    <aura:attribute name="billLst" type="List"/> <!-- create Array type object variable-->
    <aura:attribute name="sNo" type="string" />
    <article class="slds-card">
      <div class="slds-card__header slds-grid">
        <header class="slds-media slds-media_center slds-has-flexi-truncate">
          <div class="slds-media__figure">
            <span class="slds-icon_container slds-icon-standard-account" title="description of icon when needed">
                <lightning:icon iconName="standard:customers" size="large" alternativeText="List account"/>
            </span>
          </div>
          <div class="slds-media__body"> 
            <h1 style="color:#9ACD32;"> 
              <a href="javascript:void(0);" class="slds-card__header-link slds-truncate" title="Logged Hours">
                  <span class="slds-text-heading_small">LOGGED HOURS</span>
              </a>
            </h1>
          </div>
        </header>
       </div>
      <div class="slds-card__body"> 
        <table class="slds-table slds-table_cell-buffer slds-table_bordered slds-table_col-bordered">
          <thead> 
            <tr class="slds-line-height_reset"> 
                <th scope="col">
                <div class="slds-truncate" title="S.No" >S.No</div>  
              </th>
              <th scope="col">
                  
                <div class="slds-truncate" title="Employee Name">Employee Name</div>

              </th>
              
                <th scope="col">
                <div class="slds-truncate" title="Total Hours">Total Hours</div>
              </th>
                <th scope="col">
                <div class="slds-truncate" title="Charged Hour">Charged Hour</div> 
              </th>
                <th scope="col">
                <div class="slds-truncate" title="Rate">Rate</div>
              </th>
                <th scope="col">
                <div class="slds-truncate" title="Amount">Amount</div>
              </th>
            </tr>
          </thead>
          <tbody>
              <aura:iteration items="{!v.billLst}" var="acc" indexVar="sNo">
                  
                  <!-- iteration account record.-->
                  <tr class="slds-hint-parent">
                      <td><div class="slds-truncate">{!sNo + 1}</div></td> 
                      <th scope="row">
                          <div class="slds-truncate" title="Name">{!acc.empname}</div>   
                      </th>
                     
                      <th>
                          <div class="slds-truncate" title="Hours" >{!acc.hour}</div> 
                      </th>
                     
                          <td ondblclick="{!c.inlineEditName}" class="{! v.showErrorClass == true ? 'slds-cell-edit slds-has-error' : 'slds-cell-edit'}">
            <span class="slds-grid slds-grid_align-spread">
                <!-- show input and output section based on boolean flag --> 
                <aura:if isTrue="{!v.nameEditMode == false}">
                    <span class="slds-truncate" title="Rate">{!acc.chargedhour}</span> 
                    <button onclick="{!c.inlineEditName}" class="slds-button slds-button_icon slds-cell-edit__button slds-m-left_x-small" tabindex="0" title="Edit Name">
                      <lightning:icon iconName="utility:edit" size="xx-small" alternativeText="edit"/>
                    </button>
                   
                    <!-- Inline Edit Section in else case-->  
                    <aura:set attribute="else">
                        <section  tabindex="0" class="slds-popover slds-popover_edit" role="dialog" style="position: absolute; top: 0px">
                            <div class="slds-popover__body">
                                <div class="slds-form-element slds-grid slds-wrap">
                                    <div class="slds-form-element__control slds-grow">
                                        <ui:inputText class="slds-input inputFieldWidth"
                                                      labelClass="slds-form-element__label slds-form-element__label_edit slds-no-flex"
                                                      aura:id="inputId"
                                                      blur="{!c.closeNameBox}"
                                                      change="{!c.onNameChange}"
                                                      
                                                      required="false"
                                                      label="Charged Hour"
                                                      value="{!acc.chargedhour}" /> 
                                    </div>
                                </div>
                            </div>
                            <span id="form-end" tabindex="0"></span>
                        </section>  
                    </aura:set>  
                </aura:if> 
            </span>
        </td>
                      
                      
                      
                      
                      
                      
                     <!-- <th>
                          
                          <div class="slds-truncate" title="Charged Hour" >  
                              {!acc.hour}
                          </div>         
                      </th> -->
                      
                      <th  >   
                          <div class="slds-truncate" title="Rate"  > {!acc.rate} </div>        
                      </th> 
                      
                      <th> 
                         <div class="slds-truncate" title="Amount" >
                       {!acc.chargedhour*acc.rate}
                         </div> 
                         
                      </th>  
                      </tr> 
                      
                  
              </aura:iteration>
              
               <tr class="slds-hint-parent">
                      
                      <th colspan="5"  style="text-align:right">  
                          
                         <b>Grand Total:</b>
                         
                      </th>  
                  <th >  
                           
                        SUM
                         
                      </th>  
                        
                      </tr>  
             
            
  
          </tbody>
    
        </table>
          
        <lightning:buttonGroup class="slds-m-around_medium">
            <aura:if isTrue="{!v.showSaveCancelBtn}">
                <lightning:button label="Cancel" onclick="{!c.cancel}"/>
                <lightning:button label="Save" onclick="{!c.Save}" variant="success"/>
                </aura:if>
            </lightning:buttonGroup> 
             
      </div>
         
      <footer class="slds-card__footer"><a href="javascript:void(0);"><!--View All <span class="slds-assistive-text">entity type</span>--></a></footer>
    </article>
</aura:component>


 
Hi,

I am using Conditional if condition in styleClass attribute of <apex:commandbutton> to render a button class as per value selected by picklist, but it is not working.

Below is my picklist and command button
 <div class="sortStyle11">
  <b style="margin-right: 8px;"> Sort by Relevance:</b>
    <apex:selectList size="1" value="{!pickvalueForSubsUnSubs}">
        <apex:actionSupport event="onchange" action="{!perform}" rerender="table1k"/>
        <apex:selectOption itemLabel="--None--" itemValue="--None--" ></apex:selectOption>
        <apex:selectOption itemLabel="Subscribed" itemValue="Subscribed" ></apex:selectOption>
        <apex:selectOption itemLabel="Unsubscribed" itemValue="Unsubscribed"></apex:selectOption>
        </apex:selectList>
       <apex:commandButton value="Search records" action="{!MassSubORUnSub}"  styleClass="{!IF(pickvalueForSubsUnSubs == '--None--','check', IF(pickvalueForSubsUnSubs == 'Unsubscribed','SubscribedClass', 'UnSubscribedClass'))}}" style="width: 153px;border-radius: 17px;line-height: 2;margin-left: 10px;"/>
</div>

Initally i want button to be hide and when  pickilst value is subscribed I want to rendered one UnSubscribedClass and same for another.

Regards,
Sangeet 
 
Is it possible to insert a feeditem of type Contentpost triggered from email message ? and set the visibility to "AllUsers" ? 

We currently need a way to show those feeds to the portal users on a custom front end for only emails sent to the case contact.