• mukesh gupta
  • SMARTIE
  • 1932 Points
  • Member since 2015
  • 7X Salesforce Certified

  • Chatter
    Feed
  • 54
    Best Answers
  • 2
    Likes Received
  • 1
    Likes Given
  • 117
    Questions
  • 519
    Replies
Hello,
Having an issue saving my class.  getting 
Compile Error: Invalid loop variable type expected SObject was Notice__c

I am passing the parameters from another Class and I am trying to update a field on the Notice__c object with teh vatQueVatValue value
If you see any other issues with the batch class please also advise.
public class UpdateNoticeFromAccountQueueableBatch implements Database.Batchable <sObject>, Database.Stateful{
    public List<Notice__c> noticeList = new List<Notice__c>();
    public String vatQueVatValue;
    public UpdateNoticeFromAccountQueueableBatch ( List<Notice__c> records ,String vatValueFromQue ) {
        noticeList = records;
        vatQueVatValue = vatValueFromQue;
        system.debug('noticeList value in batch' + noticeList );
        system.debug('vatQueVatValue value in batch' + vatQueVatValue );
    }
    public List<SObject> start(Database.BatchableContext bc){
        return noticeList;
    }
    public void execute(Database.BatchableContext bc, List<SObject> scope){
         List< notice>  NoticeToUpdateFromAccount = new List<Notice__c>();   
         system.debug('scope value ' + scope);
         system.debug('vatQueVatValue value batch' + vatQueVatValue);
         if(!scope.isEmpty()){
             For ( Notice__c noticess : scope){  ---- Compile Error: Invalid loop variable type expected SObject was notice Notice__c 
               noticess.Any_other_Lessor_Info_VAT_Number__c  = vatQueVatValue;
              system.debug('notices.Any_other_Lessor_Info_VAT_Number__c ' + notices.Any_other_Lessor_Info_VAT_Number__c);
             }
         }   
         Database.update(scope, false);
    }
    public void finish(Database.BatchableContext bc){
    }
}

Cheers,
P
 
hey guys plz help how to convert lead from mail .plz guide detail stepwise
Hi there! 

I'd like to test my data from my web-to-lead process (wix website). It creates a lead via WTL. 
Thanks in advance :)
I am not able insert a record in opprotunity object via lightnig components. I don't where i going wrong. 

Component: -
<aura:component controller="BookingController"  implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction"  access="global">

    
<aura:attribute name="BookObj" type="String" default="{'sobjecttype' : 'Opportunity'}"/>
<aura:attribute name="StaffId" type="String"/>  
<aura:attribute name="Name" type="String" default=""/>
<aura:attribute name="BookingDate" type="Date" default=""/>
<aura:attribute name="Kilometer" type="String" default=""/>
<aura:attribute name="Pickup" type="String" default=""/>
<aura:attribute name="Drop" type="String" default=""/>
<aura:attribute name="Cab" type="String"/>
<aura:attribute name="SelectPayment" type="String[]" default=""/>
<aura:attribute name="AcctId" type="String" default="Account[]"/>
<aura:attribute name="DriverId" type="String" default="Employee_Information__c"/>
    <aura:attribute name="Stage" type="String" default="New"/>

<br/>
<div class="slds-page-header">
        <div class="slds-align_absolute-center">
            <div class="slds-text-heading_large">
                <div class="slds-m-top_xx-large">
                    Booking Cab
                </div>
            </div>
        </div>
    </div>
    
<br/>
<lightning:recordEditForm aura:id="recordEditForm" objectApiName="Opportunity">
    <lightning:messages/>
    <lightning:inputField fieldName="Name" type="String" value="{!v.Name}"/>
    <lightning:inputField fieldName="CloseDate" type="Date"  value="{!v.BookObj.BookingDate}"/>
    <lightning:inputField fieldName="Pickup_Location__c" type="String" value="{!v.BookObj.Pickup}"/>
    <lightning:inputField fieldName="Dropping_Location__c" type="String" value="{!v.BookObj.Drop}"/>
    <lightning:inputField fieldName="Kilometer__c" type="String" value="{!v.BookObj.Kilometer}"/>
    <lightning:inputField fieldName="Select_Option__c" type="String" value="{!v.BookObj.Cab}"/>
    <lightning:inputField fieldName="Select_Payment__c" type="String" value="{!v.BookObj.SelectPayment}"/>
    <lightning:inputField label="Customer id" fieldName="AccountId"  type="String" selectedRecord="{!v.BookObj.AccntId}"/>
    <lightning:inputField fieldName="Driver__c" selectedRecord="{!v.BookObj.AccntId}" type="String" required="true"/>
    <lightning:inputField fieldName="StageName"  value="{!v.BookObj.Stage}"/>
</lightning:recordEditForm>

<lightning:button label="Book" onclick="{!c.doBook}"></lightning:button>
</aura:component>

Controller: -

({
  doBook : function(component, event, helper) { 
    var action = component.get("c.SaveRecord");
    action.setParams({ 
        "Opp": component.get("v.BookObj")
    });
    action.setCallback(this, function(a) {
           var state = a.getState();
            if (state === "SUCCESS") {
                var name = a.getReturnValue();
               alert("hello from here"+Name);
            }
        });
    $A.enqueueAction(action)
}
})


Apex Class: -
public with sharing class BookingController {
    
    @AuraEnabled
    public static Opportunity SaveRecord(Opportunity oppObj){
         System.debug('opportunity::' +oppObj.Name);
        insert oppObj;
        return oppObj;
        
    }
}
Hi Team,

CAn you please give me some idea , why and when we need dynamic dashboard

Thanks
Hello,

trigger always runs in system mode.

https://salesforce.stackexchange.com/questions/172060/types-of-execution-system-mode-or-user-mode

But what if the trigger calls a method from a class which has "with sharing" or "without sharing defined"?

I did my own tests and it seems that if the method is called from a trigger, even the method executes in system mode, so it does not matter if it is "with" or "without sharing", once it is called from a trigger, it always runs in system mode.

Yes or no?
I have a validation rule on the 'Interested Modules' picklist that is working below....

text( Interested_Modules__c ) = "Leadr + HR"
&&
 isblank(text(Broker_Status__c) )

However the picklist has grown and I now need to add additional values that if those values are selected, they also fire the validtion rule to fill out Broker Status. I need to add 5 more values. 
Can we restrict an Support Agent from sending Email messages from the Salesforce FROM with his/her Nominal Address?

Support Agents are supposed to send Emails only FROM the predefined Organization-Wide Email Addresses or Email-to-Case addresses (but NOT from their nominal addresses).

In other words:
We want to avoid Agents from sending messages from addresses like john.smith@cognizant.com;

We want all Agents to send messages from predefined addresses such as contact@corporateDomain.com;

I do not think that is possible with point-and-click configuration in Salesforce (I am not finding anything usefule in the documentation).

I can think of a "Before Apex Trigger" to display a message but... it would not look good (the john.smith@cognizant.com address would still appear on the FROM drop-down list of addresses, even if we can stop the Agent from sending it with that "Before Apex Trigger).

Any idea of how I could restrict an Agent user from using his/her own address to send an outbound email mssge from objects like Leads, Contacts, Cases, etc. ?
Hi Developer Community , i have a url field called  youtube_video __c,

in this field i will keep embedded youtube link , and how can i use this field in  aura component for displaying video based on the url field ?

can anyone please help me with the solution or code

Thanks in Advance

I have a queue where thare are 10 members. and I have created a email alert.

how can i send email using email alert to this particualr queue ?
There is no option to select queue in email alert.

public class triggerclassss {
    public set<id> aa= new set<id>();
    
    public  void accountss(list<contact>aaas){
        
        system.debug('contacts----'+aaas);
        
        for(contact c : aaas)
        {
            aa.add(c.accountid);
            
            system.debug('account ids----'+ c);
        }
        
        
        
        map<id,account> hg =  new map<id,account>([select id,name,phone from account where id in : aa]);
        
        system.debug('account with id and records'+hg);
        for(contact c : aaas)
        {
            
            if(c.accountid == hg.get(c.accountid).id)
            {
                
                system.debug('matching id with accuont and contact'+hg);
                c.phone = hg.get(c.accountid).phone;
            }
            system.debug('assigning contact phone'+c.phone);
        }
    }
}

can anyone please tell me why null pointer exception displaying at line 23
Hi Team,

I have created a LWC component and want to link with quick Action. but QuickAction only support with AURA. so how to i link LWC.

Regards
Hey, I need to attach a csv file to the task record. I could insert it to Account object, but it is not working for Tasks. Could you please let me know if it is possible to insert attachment to Task object.
Sample code below,

ContentVersion conVer = new ContentVersion();
        conVer.ContentLocation = 'S';
        conVer.PathOnClient = 'taskFile.csv'; 
        conVer.Title = 'Task Test Files'; 
        conVer.VersionData = Blob.valueOf(attString);
        insert conVer;  
        
        
        Id conDoc = [SELECT ContentDocumentId FROM ContentVersion WHERE Id =:conVer.Id].ContentDocumentId;
        ContentDocumentLink conDocLink = New ContentDocumentLink();
        conDocLink.LinkedEntityId = '00T5g00000IbMnyEAF'; //Task Id
        conDocLink.ContentDocumentId = conDoc;  
        conDocLink.shareType = 'C';
        insert conDocLink;

Thanks in Advance!
 I''m struck on Step 1 

User-added imageHere's my code ):
Can someone please help me out !

User-added image
Hi All,

I don't understand about ESB Integration in salesforce, can you  please explain about this

Thanks
Hi Team,

I need to display data from an external system inside of  Salesforce, and has chosen not to enable lightning Experience. we do not need the  data for any other purposes within Salesforce.

How to cover this requirment
 
Hi All,
I'm getting below error in accountList.html. Please guide me.

User-added image
 
  • June 05, 2021
  • Like
  • 0
I am using a process buider:- 

if user cloned any opportunity then one of my process builder should not execute, after creation of this opportunity if user edit this opportunity then process builder should execute.

Please suggest
Hi Expert,

I have a custom field on Task object, and now i want to update task by API. i have tried to update by Postman, but facing error.
 
{
        "message": "insufficient access rights on object id",
        "errorCode": "INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY",
        "fields": []
    }

 Please suggest

Regards
Mukesh
Hi Expert,

I am using add error method, when criteria match then addError method call, but here script doenot stop and execute next loop.

i want to stop script when addError call. i have used break; return; but nothing happen

 
for (Opportunity currOpp: newOpportunities_1){
              System.debug('currOpp name '+currOpp.name);
            if (currOpp.RecordTypeId!=PMRecordTypeId.Id  ){
                currOpp.addError(Label.pmr);   
               
            }
          }

for (Opportunity currOpp: newOpportunities_2){
              System.debug('currOpp name '+currOpp.name);
         
          }

Thanks 
Mukesh

 
Hi Expert ,

I am creating dynamic check boxes that's crated perfect, change event is not working for created check boxes;

when i select any check box then get error
getting error :- Unable to find action 'handleSelectedOLI' on the controller 
 
for(var i = 0; i<5; i++){
 $A.createComponent(
            "ui:inputCheckbox",
            {
                "aura:id": "checkBoxOLI",
                "value":chekboxVal,
                "change": component.getReference("c.handleSelectedOLI")
            },
            function(newButton, status, errorMessage){
                //Add the new button to the body array
                if (status === "SUCCESS") {
                    var body = component.get("v.body");
                    //body.push(newButton);
                    component.set("v.body", newButton);
                }
                else if (status === "INCOMPLETE") {
                    console.log("No response from server or client is offline.")
                    // Show offline error
                }
                else if (status === "ERROR") {
                    console.log("Error: " + errorMessage);
                    // Show error message
                }
            }
        );  
		
handleSelectedOLI: function(component, event, helper) {
        alert('change ecevt ');
    
    },

Please suggest

Regards
Mukesh
Hi Expert,

I want to destroy selected check box when user try to select all and click on delete buttion.
 without destroy this is exist already and make extra check boxes that's was previously deleted so now i want to destroy selected items

Below code is creating check boxes:-

this is select All check box
<ui:inputCheckbox value = "{!v.isSelectAll}" change="{!c.handleSelectAllOLI}" aura:id="selectAll"/>

this is list of check boxes:-
<aura:iteration items="{!v.DEFProductInstance}" var="item" indexVar = "indx">
<ui:inputCheckbox aura:id="checkBox" />
 </aura:iteration>


Please suggest

Thanks
When manager reject opportunity then error message display from trigger, but i want to bypass addError message in apex trigger. for spicific condition user face addError message, but when opportuntiy reject by manager then i want to by pass this error message.

Please suggest

Regards
Mukesh 
Hi Expert,

I am using below code but not able to get maximum length  on keyUp event.

 
<ui:inputCurrency class="slds-input" aura:id="curr" format="##,##,###,##0.00" maxlength="6" updateOn="keyup" keyup = "{!c.changesValueInput}"/>

Please suggest
 
Hi Expert,

I am creating contact by 'e.force:createRecord', but now i want to created contact record Id. after this event. 

Can you please suggest.

Regards
Mukesh 
Hi Expert,

I am trying to create a lwc project in VS code, but when i try to create 
then facing error:

command 'sfdx.force.project.create' not foundUser-added imagePlease suggest.

I am using jdk1.8.0_231 for 64 bit
Hi expert,

I have multiple country picklist in lightning compont that's is iterating in Table TR
we i choose any picklist value 'UAS' and click on save button than this picklist should be disable.

but when i change of picklist then picklist disable on selection time. but i want to disable on save button.

Please suggest
<aura:iteration items="{!v.CountryDetails}" var="item" >
<tr> 
<td class="slds-cell-wrap">
                        <lightning:select name="statusFld" label="" value="{!item.Country__c}" disabled="{!item.Country__c == 'Closed Won')}">
                            <option value="--None--">--None--</option>
                            <aura:iteration items="{!v.listCountry}" var="val">
                                <option value="{!val.value}" selected="{!val.value==item.Country__c}">{!val.key}</option>
                            </aura:iteration>
                        </lightning:select>
                    </td>
</tr>
</aura:iteration>

 
Hi I am using visualforce page to open Lightninng component in new tab:-

on opportunity object -->> button & Link (Name:-AddProduct)

add URL parameter :- 

/apex/OppProduct_VFP?oppId={!Opportunity.Id}

when user click on 'AddProduct' button then below VF page open in new tab with lightnig component:-

OppProduct_VFP:-
<apex:page controller="TestController" tabStyle="Opportunity" lightningStylesheets="true">
    <apex:includeLightning />
    <div class="slds" style="margin-top:10px;margin-left:10px;"> 
        <div id="lightning" />
    </div>
   
    <script>
    

        $Lightning.use("c:AddProductApp", function() {
            $Lightning.createComponent(
                "c:AddProduct",
                {recordId : "{!OpportunityId}"},
                "lightning",
                function(cmp) {
                   
            });
        });
    </script>
</apex:page>

i have a close button in AddProductController to close this tab but not able to closed this tab getting UNDEFINED in console log. i am not able to get TabId by this code.

 
Close : function(component, event, helper){
        var workspaceAPI = component.find("workspace"); // mentioned in component 
          workspaceAPI.isConsoleNavigation().then(function(consoleResponse) {  
              console.log('consoleResponse-->>> '+consoleResponse) // return undefined
              workspaceAPI.getFocusedTabInfo().then(function(tabResponse) {
                  console.log('tabResponse-->> '+tabResponse)// return undefined
                   var isSubtab = tabResponse.isSubtab;
                  console.log('isSubtab-->> '+isSubtab);// return undefined
              });
        });
Please suggest and let me know where i am wrong
​​​​​​​
I am using a lightning componet, whrn i click on a button then this coponent open. on this component i have a close button. when i click on this closed button page redirect to previous page, but tab not closed.

i am using below code for tab close
closeFocusedTab : function(component, event, helper) {
         var workspaceAPI = component.find("workspace");
        //alert(workspaceAPI);
        workspaceAPI.getFocusedTabInfo().then(function(response) {
            //alert('aaaa -- '+response);
            var focusedTabId = response.tabId;
            workspaceAPI.closeTab({tabId: focusedTabId});
        })
        .catch(function(error) {
            console.log(error);
        });

    
    }

    Can you please suggest.

User-added image
Hi Expert,

I want to add attachment on record creation time in apex code, but in attachment custom code  we need record Id, but record is not created. so how achive this functionality,

Example: when we fill any exam from then we can attachemtn or document, and then save the record.

Thanks
 
Hi Expert,

i want to open a popup box that should be open when user logged In. when user  closed this then this will not reopen for this session. if user logged in again then popup should be open .

what i have done:

create a lightning component and added this on home page layout. but this popup open again and again when home page refresh. 

So can you please suggest what should i use sothat model popup should open once for current session.

Regards
Mukesh
Hi Expert,

I want to use Remote Objects in lightning component , below code is working in visualforce  pages, but now i need to implement this code in lightning component.

for example:- 
  <!-- Remote Objects definition to set accessible sObjects and fields -->
    <apex:remoteObjects >
        <apex:remoteObjectModel name="Warehouse__c" jsShorthand="Warehouse" 
            fields="Name,Id">
            <apex:remoteObjectField name="Phone__c" jsShorthand="Phone"/>
        </apex:remoteObjectModel>
    </apex:remoteObjects>

Thanks
Mukesh
Hi Expert,

In one class i have two soql:-
Example:- 
public class test(){

     List<Account> acc = [select id, name from Account Limit 40000];
     List<Contact> con = [seldect id, email from Contact Limit 15000];
}

//above queries will return limit excede error or not 

 
Hi Expert,

I want to reopen a case when any email comes from user. what i implemented:-

I creaed a workflow that execute on when agent close a case with email template taht's have a case thread id. but when customer reply this email then related case shouuld be reopen and this mail should be add in Email related list on that case.

Please suggest.

Regards
Mukesh​



  





 
Hi Expert,

How would sharing rule work in the below scenario

Suppose i create a new object called "XXXX". Now profile called "AAAA" doesn't have read, create, edit permission on it.

Q1: What would happen if I create a record of object "XXX" and share it with user which has profile "AAAA" and give him "Edit" permission on the record? Would user be able to see the record or edit the record? please qualify your answer.

Q2: Can anybody explain in what order access on record or object is granted in terms of OWD, Sharing rule, Role and profile?

Q3: If i set OWD setting as Public Read/Edit on Object "XXXX" but profile "AAAA" don't have read, create and edit permission on Object "XXXX" then the user who owns profile "AAAA" would be able to see and edit the records of object "XXXX"?

Q4: What would happen if profile "AAAA" has only Read permission on Object "XXXX" then user who owns profile "AAAA" would be able to see and edit ALL the records of object "XXXX"?

Q5: In order to work out OWD setting, at least profile must have Read permission on that particular object?

Q6: The user who is higher role in hierarchy would get owner permission on the records created by user who are lower in the roles means he can edit and delete the record as well. Is that correct?

Please share your best 

Regards
Mukesh
Hi Expert,

I have added a inline visualforce page on case page layout. Now i am able to upload files perfectlry, but now i want to add loader or spiner on file upload time. I add a spiner in visualforce page but when uploading compleatd. then this move on case Tab with files list not on same page. 
 
<apex:page standardController="Case" extensions="UploadFileController" >
<apex:form >
<style type="text/css">
.bPageBlock .detailList .dataCol {
    width: 100%;
}

.bPageBlock .detailList .dataCol {
    width: 107%;
}


dataCol.first {
    text-align: center;
    }

  .detailList td.dataCol.first.last:nth-child(1) {
    text-align: right;
    width: 50%;
}
.inner-tab {
    padding: 20px 0px;
}
  </style>
  
 
 <apex:pageMessages />
 
 <apex:actionStatus id="pageStatus">
    <apex:facet name="start">
        <apex:outputPanel >
           <img src="/img/loading32.gif" width="50" height="50" />
           
            <apex:outputLabel value="Loading..." />
        </apex:outputPanel>            
    </apex:facet>
    
    <apex:facet name="stop">
         
    
    </apex:facet>
    
</apex:actionStatus>
 
<apex:pageBlock >




<apex:pageBlockSection id="sec1" rendered="{!sec1}"> 
    <apex:commandButton id="btnUpload"  action="{!Upload}" value="Upload File"  />
   
    <br/>
     <br/>
    <apex:pageBlock title="File Links" id="rerenderId">
    
      <apex:pageBlockTable value="{!listOfFiles}" var="fl" width="100%">
           <apex:column headerValue="URL" width="50%"><apex:outputLink target="_blank" value="{!fl.URL__c}">{!fl.Url}</apex:outputLink></apex:column>
           <apex:column headerValue="Created Date" width="20%" value="{!fl.createdDate}"></apex:column> 
      </apex:pageBlockTable>
    </apex:pageBlock>
  
    
</apex:pageBlockSection>


<div class="inner-tab">
<apex:pageBlockSection id="sec2" rendered="{!sec2}">
 <apex:inputFile value="{!AttchBody}" fileName="{!AttchName}" fileSize="{!AttachSize}"/>
 
 <apex:commandButton id="btnSubmit"  action="{!SubmitAttachment}" value="Submit Attachment"/>
</apex:pageBlockSection>
 </div>


</apex:pageBlock>





</apex:form>
 
  
</apex:page>

  
public with sharing class UploadFileController {

    Public Id RecordId {get;set;}
    public Blob AttchBody {get;set;}
    public String AttchDesc {get;set;}
    public String AttchName {get;set;}
    Public Integer AttachSize {get;set;}
    Public Attachment attch {get;set;}
    public boolean attachmentBtn {get; set;}
    public boolean sec1 {get;set;}
    public boolean sec2 {get;set;} 
    public External_File_Relationship__c fileDB; 
    public External_File__c ef;
    public List<String> fileList {get;set;} 
    public String parentId; 
    Public List<External_File__c>listOfFiles {get;set;}
     
  
     public UploadFileController(ApexPages.StandardController controller) {
        parentId = ((case)controller.getRecord()).id;
        sec1 = true;
        sec2 = false;
        
        RecordId = ApexPages.CurrentPage().getParameters().get('Id');
        init();

    }
    
    
    public PageReference SubmitAttachment(){
    
      if(AttchName != '' && AttchBody != NUll ){
      
      //file that is 25Mb or less
      if(AttachSize <= 25000000 ){
          External__c  extFile = new External__c();
          extFile.Name =  AttchName;
          extFile.CaseId__c = RecordId;
          
          Insert extFile ;
          attch = new Attachment(ParentId=extFile.id,Description=AttchDesc,Name=AttchName,Body=AttchBody);
       
         try{
                insert attch;
                
                system.debug('attch  '+attch);
                AttchBody = null;
                AttchDesc = null;
                AttchName = null;
               
            }
            catch(DMLException ex){
                    ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading attachment'));
                    return null;
             
            }
            
            
            ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'Attachment uploaded successfully'));
            
            string Attid= attch.id;
            string attachmentid=Attid.substring(0,15);
            String sfdcBaseURL = URL.getSalesforceBaseUrl().toExternalForm();
            extFile.File_Public_URL__c = sfdcBaseURL+'/servlet/servlet.FileDownload?file='+attachmentid;
            update extFile;
            sec2 = false;
            sec1 = true;
            init();
          
      }
      
      }else{
      
          ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR, AttchName +' is too large - please choose a file that is 25Mb or less'));
      
      }
        return null;
          
      }
      
      public void init(){
           List<External_File__c> lst = [Select URL__c, CreatedDate  from  External__c where CaseId__c =: RecordId];
           listOfFiles  = lst;
      }
      
     public PageReference Upload() {
       sec1 = false;
       sec2 = true;
       
       return null;
         
    
    }

}

when i add spinner or Loding then, this move to case tab with inline visualforce page.


Please suggest, what i am doing wrong

Regards
Mukesh
 
Hi Expert,

I am using below code in my lightning componant but facing error "Jquery_File/jquery-3.3.1.min.js 404 (Not Found)" in browser console.

here "Jquery_File" is static resources name and 
 <ltng:require scripts="{!$Resource.Jquery_File + '/jquery-3.3.1.min'}" />

https://testnewdomian-dev-ed.livepreview.salesforce-communities.com/sfsites/c/resource/1535093740000/Jquery_File/jquery-3.3.1.min.js 404 (Not Found)

Thanks
Mukesh

 
Hi Expert,

I want to create some demo on marketing cloud  journey builder. Can any one share about how to acces journey builder in markeing cloud.

Thanks
Mukesh
Hi Expert,

I need to create an application for me to send SMS directly from Salesforce. Please suggest.

User-added image
Hi Expert,

I am using a test class for coverage 75% code, but few things are not covered. Can any one suggest what is going wrong.

this my test Class: --
@isTest
public class TestProfessorSelectCourse {
    @isTest static void ProfessorCourse(){
       
        
        Professor__c prof = new Professor__c(Name ='JP',Email__c='jp@gmail.com');
        insert prof;
        
        Class__c cls = new Class__c(name='12G', Class_Teacher__c = prof.id);
        insert cls;
        
        Course__c cors = new Course__c(Professor__c=prof.id,Class__c =cls.id, name='Ruby', Start_Date__c= Date.today() , End_date__c= Date.newInstance(2017,03,20));
       	//Professor__c prof = new Professor__c(Name ='JP');
        //cors.Professor__c = prof.Name;
        insert cors;
    }
}

and below is my main class


User-added image

Thanks 
Mukesh
I have approval process when i submit it to approval.. Approver is receiving the bell notification but after approving/rejecting the record intial submitter is not receiving any bell notifications.. Privously it used to work for me 
Having problem sending email in my Opportunity Trigger Handler Class. The template uses merge fields from the Opportunity but TargetObjectId says it is only accepting Contacts, Leads and Users (this is a really stupid limitation by the way).

I don't want to put the Opportunity ownerId either becasue the email doesn't go to the opportunit owner, it goes to a list of support staff. Here is my code so far. Sorry it's a bit of a mess. Really trying to send as a template and not as a plain text email.

I have also tried to use the renderStoredEmailTemplate method but also with no success.

Please help!
 
if(Opp.StageName == 'Documentation' && stageFrom == 'Submission'){
                
                //Fix this TargetObjectID issue***
                Messaging.reserveSingleEmailCapacity(2);
                Messaging.SingleEmailMessage DocEmail = new Messaging.SingleEmailMessage();
                    
                EmailTemplate et =[SELECT Id, Name FROM EmailTemplate WHERE Name = 'Doc Stage'];
                DocEmail.setTemplateId(et.Id);
                DocEmail.setToAddresses(new String[] {'email1@company.com', 'email2@company.com'});
                DocEmail.setReplyTo('DocEmails@Company.com');
                DocEmail.setSenderDisplayName('Doc Automated Emails');
                DocEmail.setTargetObjectId(Opp.OwnerId);
                DocEmail.setWhatId(Opp.Id);
                DocEmail.setSaveAsActivity(FALSE);
                Messaging.sendEmail(new Messaging.SingleEmailMessage[] {DocEmail});
                
            }

 
Hello All,
I am planning to write the Platform Developer 1 exam in a couple of days. I need the preparation material links. If any know best links please provide me. Thanks in Advance.
Hello Team User-added imageUser-added image
I have enabled Account Contact Relationship to use a "many to many" relationship which is working. But, getting an error "This contact already has a relationship with this account." when I try to add a contact through an account relationship with a new Role. Is there any way to avoid this error declaratively?
Hi All,

I have a requirement in which I have to communicate back and forth between apex and javascript.
The initial step being in apex should then call javascript based on some condition check, that  javascript will do some processing and will then call apex and that will again call Javascript and then apex.

Can somebody suggest how to maintain the control flow ?
Quote is the parent class.
EPC__c and OM__c - These are the custom object under the Quote. (Means EPC and OM Contains Lookup relationship with Quote)
I have a custom button to Delete all Records on EPC and OM on Quote's related list.
Custom Link Button
And flow is like this:

Flow to delete all records which have a parent id Quote
I just want to write a test class to cover the above flow. But not able to cover the flow using below code:

Test Method

Thanks.
Hello I have a requirement, I want to show error message if any user try to create a new contact with same  name  that is already association with a account.
using workflow or validation rule. 
Please don't recommend to use trigger. I know how to achieve this using trigger 
 
It is running as the current user  which has SA rights. Any thoughts on why this would occur? 
Hi Everyone,
Is it possible to set default stage when we try to create new opportunity manualy, instead of 'None' in stage field can we have first stage as default there?
How to create Components where account and contacts can be added with components?


Please help!! I am unable to understand.
How to know which object is Master in master-detailed relationships?
Hello,
Having an issue saving my class.  getting 
Compile Error: Invalid loop variable type expected SObject was Notice__c

I am passing the parameters from another Class and I am trying to update a field on the Notice__c object with teh vatQueVatValue value
If you see any other issues with the batch class please also advise.
public class UpdateNoticeFromAccountQueueableBatch implements Database.Batchable <sObject>, Database.Stateful{
    public List<Notice__c> noticeList = new List<Notice__c>();
    public String vatQueVatValue;
    public UpdateNoticeFromAccountQueueableBatch ( List<Notice__c> records ,String vatValueFromQue ) {
        noticeList = records;
        vatQueVatValue = vatValueFromQue;
        system.debug('noticeList value in batch' + noticeList );
        system.debug('vatQueVatValue value in batch' + vatQueVatValue );
    }
    public List<SObject> start(Database.BatchableContext bc){
        return noticeList;
    }
    public void execute(Database.BatchableContext bc, List<SObject> scope){
         List< notice>  NoticeToUpdateFromAccount = new List<Notice__c>();   
         system.debug('scope value ' + scope);
         system.debug('vatQueVatValue value batch' + vatQueVatValue);
         if(!scope.isEmpty()){
             For ( Notice__c noticess : scope){  ---- Compile Error: Invalid loop variable type expected SObject was notice Notice__c 
               noticess.Any_other_Lessor_Info_VAT_Number__c  = vatQueVatValue;
              system.debug('notices.Any_other_Lessor_Info_VAT_Number__c ' + notices.Any_other_Lessor_Info_VAT_Number__c);
             }
         }   
         Database.update(scope, false);
    }
    public void finish(Database.BatchableContext bc){
    }
}

Cheers,
P
 
hey guys plz help how to convert lead from mail .plz guide detail stepwise
i have a batch class as below :
-------------------------------------------------------------
public class DM_TechAvailability implements Database.Batchable<sObject> {
    public DM_TechAvailability(){
        
    }
    
    public Database.QueryLocator start (Database.BatchableContext BC){
        string BLANK = '';
        string nulll = NULL;
        
        String query = 'select id, SV_Date_String__c, SV_Date__c from SV_Technician_Availability__c 
        where SV_Date__c  != null and (SV_Date_String__c =: BLANK or SV_Date_String__c =: nulll)';
        
        system.debug('1*'+Database.getQueryLocator(query));
        return Database.getQueryLocator(query);
    }
    public void execute(Database.BatchableContext BC, List<sObject> xTcope){
        List<SV_Technician_Availability__c> taList = new List<SV_Technician_Availability__c>();
        for(sObject eachTcope: xTcope){
            SV_Technician_Availability__c eachTA = (SV_Technician_Availability__c)eachTcope;
            eachTA.SV_Date_String__c = String.ValueOf(eachTA.SV_Date__c);
            taList.add(eachTA);
        }
        Database.update(taList, false);
    }
    public void finish(Database.BatchableContext Bc){
        
    }

}

Test Class which i have written as :
-----------------------------------------------
@isTest
public class Test_DM_TechAvailibility {

    @isTest
    public static void Test_method() {
        
        List<SV_Technician_Availability__c> techAvailabilityList = new List<SV_Technician_Availability__c>();
        for(Integer i=0; i<10; i++) {
            SV_Technician_Availability__c techAv = new SV_Technician_Availability__c();
            techAv.SV_Date_String__c = '';
            techAv.SV_Date__c = System.Today();
            techAvailabilityList.add(techAv);            
        }
        insert techAvailabilityList;
        
        system.debug('2*'+techAvailabilityList);
        
        test.startTest();
            DM_TechAvailability obj = new DM_TechAvailability();
            Database.executeBatch(obj);
        test.stopTest();
    }         
        
}

It covers only 50% and doesn't cover 'Execute' method of apex class.
Can you please help with your inputs how can i increase the percentage?

Thanks in Advance !
Rupesh