• Puneet_Mishra
  • NEWBIE
  • 5 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 14
    Replies
Hello All,
I am working on Service Cloud and while doing Omni-Channel Queue based routing testing I have encountered an issue. I have created a Community (Public) and allowing guests to create cases from the community without login, (Enable Support API on the community). Cases are getting created in Salesforce but it's getting assigned to my Admin user, I tried changing the Support Setting to "Default Case Owner" but no luck, I tried writing assignment rules to assign the Case to Queue if the type is "Web" but no luck again. Then I wrote a before insert trigger to change the owner to Queue which worked but now the case is not coming for accepting in Omni-Channel when Omni Channel status changed to 'Available'.
Even in the Omni Supervisor tab, the fourth case is not appearing. I have been through all Salesforce documents and didn't find any explanation or any type of limitations

Any help here is very much appreciated.

Omni-Channel not showing Case record created from Community
Omni Supervisor also not showing the Case, even though its been assigned to Queue
Regards,
Puneet
We got contact extract from production and there is a field of data type rich text area which is been used to store contact image. Data loading team uploaded the data to sandbox and we were able to display the images in our lightning component but image do not displayed on community when investigate we found out image source is pointing to production i.e. (img src="https://production.salesforce.com/servlet/servlet.ImageServer?id=01541000002yi92AAA&oid=00D41000000XUZ3") instead of sandbox. When we tried to upload the image manually the image src displays as (img src="/sfsites/c/servlet/rtaImage?eid=0035400000HkFAR&feoid=00N4100000eTIwO&refid=0EM5400000050K5")
Can anyone explain me
1. how image of production url is getting displayed in lightning component and on contact detail record but not on community?
2. How can we resolve this issue ?
I tried to search for solution but no luck. I appreciate your help.
Thank you in advance.
Hi All,

We are facing a strange error while saving a record.
We have multicurrecy enable for our org and on opportunity we have a field "Net Value" which is a curreny field (18,0) and we have written a custom lightning component to create/edit a opportunity, we do not use classic anymore.
Issue which we are seeing are coming only for european countries but not on all opportunity records.

On some records when user which is also the owner of opportunity tries to save opportunity they get NUMBER_OUTSIDE_VALID_RANGE error on "Net Value" field but we do not have any code written which change field value. But when same record is been saved by Admin who is not the owner of opportunity then error do not comes and goes away permanently. 

We are not able to understand why Lightning behaving like this, Did anyone come across any error like this.

Thanks in Advance,
Puneet.
Hi All,

I am facing a strange behaviour, seems like some permission is revoked from profile.
I have a User who is complaining that schedule refresh option is not coming on Dashboard.
I am not sure what permission got changed from the profile.

User-added image

Thank you for your help
Hi Guys,

I working on 'Build Flexible Apps with Visualforce Pages and Lightning Components' trailhead module and I was on 'Create a SimilarProperties Lightning Component' there is one statement comes up which states " the component also uses the force:hasRecordIdinterface, which will automatically retrieve the Id of the current Record page and store it in the <aura:attribute> with a name of recordId."
User-added image

My question is is it mandatory to declare attribute with name recordId instead on any other name like oppId etc.
and what if I have multiple attribute declare with same type="Id", how framework works in this case.

many of you might feel this question stupid but it just came to my mind. I am gonna try it myself but want to know from your expert views.

Thanks in advance.
Hi All,

I was taking the 'Handling Actions with Controllers' challenge under Lightning Component Basic and got stuck and not sure where I am wrong.
Challenge was
Add a button to the campingListItem component that when clicked, marks the item as packed.
  • Add a button labeled Packed! that calls the packItem controller function when clicked.
  • The controller action marks the item attribute as packed, updates the item value provider and disables the button.
I have created the component and was working on controller.js but always getting an error, below are my code
<aura:component >
    <aura:attribute name="item" type="Camping_Item__c" required="false"/>
    
    <p>Name:
        <ui:inputText value="{!v.item.Name}" />
    </p>
    
    <p>Price:
        <ui:inputCurrency value="{!v.item.Price__c}" />
    </p>
    
    <p>Quantity:
        <ui:inputNumber value="{!v.item.Quantity__c}" />
    </p>
    
    <p>Packed:
        <ui:inputCheckbox value="{!v.item.Packed__c}"/>
    </p>
    
    <ui:button label="Packed!" press="{!c.packItem}" />
    
</aura:component>
controller.js
({
	packItem : function(component, event, helper) {
		event.getSource().set('v.disabled', true);
        component.set("v.item.Packed__c", true);
    }
})
I have set required=false on campingListItem due to which I can add my component to my App without provided any value
campingListItemApp:
<aura:application >
	<c:campingListItem />
</aura:application>

but everytime I run my package I am getting an error :
User-added image

Can anyone explain why I am getting this error and if possible can provide me a solution.

Thank in Advance.

 
Hi All,
I working on my visualforce page where I would like to some google charts. I am working on BarChart right now and I am using google.visualization.arrayToDataTable();

I tried passing 'JSON' as parameter to DataTable from my controller and even custom data format which is mentioned in examples on internet but niether I get any error nor any message. Please help where I am doing wrong but please don't give an example of hardcoded values.

function drawGoogleBarChart() {
                     // Define the chart to be drawn.
                       var data = google.visualization.arrayToDataTable(                        
                        '{!bestperformer}'                                                  
                    );
                    console.log('11'+{!bestSeller});
                       var options = {
                        title: 'Bestsellers',
                          isStacked:true,
                          series: {
                            0: { color: '#5B9BD4' },
                            1: { color: '#EC7C30' }
                          },
                        animation:{
                            duration: 2000,
                            easing: 'out',
                            "startup": true
                          },
                        legend:{position: 'bottom'}
                       };  
                
                       // Instantiate and draw the chart.
                       var chart = new google.visualization.BarChart(document.getElementById('bestsellers_chart'));
                       chart.draw(data, options);
                }
Controller logic returns a JSON response 
[ {
  "user1" : "SOME USER 1",
  "won" : 1,
  "lost" : 0
}, {
  "user1" : "SOME USER 3",
  "won" : 5,
  "lost" : 1
}, {
  "user1" : "SOME USER 4",
  "won" : 10,
  "lost" : 4
} ]

I tried creating custom string which was mentioned in examples 

[ "Users", "Won", "Lost"],
[ "SOME USER 1", 1, 0], 
[ "SOME USER 3", 5, 1], 
[ "SOME USER 4", 10, 4] 
]

but above values didn't work for me.

Please help me know where I am doing wrong.

THanks, In Advance
Hi All,

I have started with Salesforce BULK API and installed cURL using cURL download wizard for 64 bits.
I have also created login.txt file as mention in guide and tried to run the curl command 
[ curl https://login.salesforce.com/services/Soap/u/38.0 -H "Content-Type: text/xml; charset=UTF-8" -H "SOAPAction: login" -d @login.txt ] but getting an error 
UNKNOWN_EXCEPTION: Content is not allowed in prolog.

cmd error
 
Please Help
Hi,

I have written a trigger on ContentDocumentLinkobject to cover the below scenario:

1. If there is a ContentDocumentLink record created with a ContentDocumentId & Entity ID is of MessagingSession object, and
2. MessagingSession record referred in Entity ID has a case linked to it then

A new ContentDocumentLink record is created to link the ContentDocumentId and the case related to MessagingSession record referred in EntityID.

Now, I don't know how to write the test class of the same as I am not finding way to create MessagingSession record. Kindly help.
Hi,

As I am unable to complete the code coverage in batch apex.
global class countContactRecordsBatch implements Database.Batchable<sObject> {
    global Database.QueryLocator start(Database.BatchableContext bc) {
        string query='select id,Census_Date__c from hed__Term__c where Census_Date__c=LAST_N_DAYS:1';
        system.debug('query' +query) ;
        return Database.getQueryLocator(query); 
    }
    
    global void execute(Database.BatchableContext bc, List<hed__Term__c> scope){
        
        list<hed__Term__c> termList=[select id from hed__Term__c where Census_Date__c=LAST_N_DAYS:1];
        list<hed__Course_Offering__c> moduleOfferingList=[select hed__Term__r.id,(select hed__Contact__r.id,hed__Program_Enrollment__r.Program__r.id  from hed__Course_Enrollment__r) from hed__Course_Offering__c where hed__Term__r.id IN:termList];
        Map<string,set<string>> termProgramContacts=new Map<string,set<string>>();
        for(hed__Course_Offering__c co:moduleOfferingList) {
            system.debug('Term Id-'+co.hed__Term__r.id);   
            
            for(hed__Course_Enrollment__c ce:co.hed__Course_Enrollment__r){
                string mapKey = co.hed__Term__r.id+'-'+ce.hed__Program_Enrollment__r.Program__r.id;
                if(ce.hed__Program_Enrollment__r.Program__r.id!=null){
                    if(termProgramContacts.containsKey(mapKey)){
                        set<string> existingValue = termProgramContacts.get(mapKey);
                        existingValue.add(ce.hed__Contact__r.id);
                        termProgramContacts.put(mapKey, existingValue);
                    }                       
                    else{
                        set<string> newValue = new set<string>();   
                        newValue.add(ce.hed__Contact__r.id);
                        termProgramContacts.put(mapKey,newValue);
                    }
                }
            }
        }
            
            system.debug('Program Contact- '+termProgramContacts);
            list<hed__Term__c> termProgramList=new list<hed__Term__c>();
            list <Program_Session__c> programSessionList = new list <Program_Session__c>();
            termProgramList=[select id,(select id,Program__r.id from Program_Sessions__r) from hed__Term__c where id IN:termList];
            Map<string,integer> updateCount = new Map<string,integer>();
            for(hed__Term__c termProgram:termProgramList){
                for(Program_Session__c ps:termProgram.Program_Sessions__r){
                    string tpKey = termProgram.id+'-'+ps.Program__r.id;
                    if(termProgramContacts.containsKey(tpKey)){
                        integer contactCount = termProgramContacts.get(tpKey).size();
                        integer existingCount = 0;
                        if(updateCount.containsKey(ps.id)){
                            existingCount = updateCount.get(ps.id);                         
                        }
                        updateCount.put(ps.id,contactCount+existingCount);//progran term id and count
                        system.debug('updateCount'+updateCount.values().size());
                    }
                    ps.Total_enrolments_actual__c=updateCount.get(ps.Id);
                    programSessionList.add(ps);
                    system.debug('Total_enrolments_actual__c' +ps.Total_enrolments_actual__c);                    
                    system.debug('termProgramList ' +termProgramList);            
                }
            }
            if(programSessionList!=null && !programSessionList.isEmpty()){
                update programSessionList;
                
                
            }
        
    }
            global void finish(Database.BatchableContext BC){
                
            }

       
    //code end
    
   
}
===
Test class
=====

@isTest
public class countContactRecordsBatchTest {
    
    static testMethod void contactRecords(){
        
        list<Program_Session__c> psList=new list<Program_Session__c>();
        list<Account> acc=new list<Account>();
        list<hed__Term__c> termList=new list<hed__Term__c>();//term 
        list<Program__c> programList=new list<Program__c>();
        list<hed__Course_Offering__c> mcList=new list<hed__Course_Offering__c>();
        list<hed__Course__c> courseList=new list<hed__Course__c>();
        list<hed__Program_Enrollment__c> prEnrollmentList=new list<hed__Program_Enrollment__c>();
        list<Contact> consList=new list<contact>();
        
        
        Account a=new account();
        a.Name='Test Account';
        acc.add(a);
        
        insert acc;
        
        hed__Term__c te=new hed__Term__c();
        te.Name='test term';
        te.hed__Account__c=acc[0].id;
        te.Census_Date__c=date.today();
        termList.add(te);
        insert termList;//Term
        
        Program__c pc=new Program__c();
        pc.Name='test program ';
        programList.add(pc);//Program ..
        
        
        //insert module offering
        hed__Course_Offering__c mc=new hed__Course_Offering__c();
        hed__Course__c cou=new hed__Course__c();
        cou.name='test course';
        cou.hed__Account__c=acc[0].Id;
        courseList.add(cou);
        insert courseList;
        
        mc.Name='Test Module Offering';
        mc.hed__Course__c=courseList[0].id;
        mc.hed__Term__c=termList[0].id;
        mcList.add(mc);
        
        
        //Insert contact
        contact con=new contact();
        con.lastName='test contact Name';
        consList.add(con);    
        
        
        //program Enrollment
        hed__Program_Enrollment__c pe=new hed__Program_Enrollment__c();
        pe.Program__c=programList[0].id;
        pe.hed__Contact__c=consList[0].id;
        prEnrollmentList.add(pe);
        
        
        Program_Session__c ps=new Program_Session__c();
        ps.Term__c=termList[0].id;
        //     ps.Program__c=programList[0].id;
        ps.Program__c=programList[0].id;
        //ps.Total_enrolments_actual__c=1;
        psList.add(ps);
        database.insert (psList,false);
        
        list<Program_Session__c> prs=[select id ,Term__r.id,Program__r.id,Total_enrolments_actual__c from Program_Session__c];
        for(Program_Session__c pccc:prs){
            pccc.Total_enrolments_actual__c=10;
        }
        
        test.startTest();
        
        database.SaveResult []sr=database.update(prs,false);
        countContactRecordsBatch obj=new countContactRecordsBatch();
        database.executeBatch(obj);
        test.stopTest();
    }
    
}

As I am getting 44% code coverage on it.
Any suggestions.

Thanks
Hello 

i have written a test class for the trigger, when i try to run the test i get 100% code coverage,i have even disabled the validation rule which is present on the lead object,  but still in the Test results i get the following error

System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Error::::::Divide by 0: [CRM_Owner__c]

how do i resolve this issue
Below is my trigger and Test class
 
trigger ShareWithCRMOwner on Lead (after insert,after update) {
    List<LeadShare> csShareList = new List<LeadShare>();
    for( Lead cs : trigger.new ) {
        if( cs.CRM_Owner__c != NULL ) {
            // Create a new LeadShare object for each Lead where CRM_Owner__c field is not NULL.
            LeadShare csShare = new LeadShare();
            // Give Read write access to that user for this particular Lead record.
            csShare.LeadAccessLevel = 'edit';
            // Assign Lead Id of Lead record.
            csShare.LeadId = cs.id;
            // Assign user id to grant read write access to this particular Lead record.
            csShare.UserOrGroupId = cs.CRM_Owner__c;
            csShareList.add( csShare );
        }
    }
    if( csShareList != null && csShareList.size() != 0 ) {
        try {
            insert csShareList;
            update csShareList;
             if(Test.isRunningTest())
            {
                integer k=1/0;
            }
        }catch( Exception e ) {
            trigger.new[0].CRM_Owner__c.addError('Error::::::'+e.getMessage());
        }
    }
}

Test Class
 
@isTest
private class TestShareWithCRMOwner {
    
    // test that newly inserted records marked as pubic=true have corresponding shares created
    static testMethod void testAddShares() {
        
        Set<ID> ids = new Set<ID>();
        List<Lead> Leads = new List<Lead>();
        
        for (Integer i=0;i<50;i++)
            Leads.add(new Lead(FirstName='First ',LastName='Name '+i,RecordTypeId='012p0000000Nn05AAC',
                               Email='email'+i+'@email.com',Company='ABSYZ',CRM_Owner__c='00528000006OKhPAAW'));
        
        insert Leads;
        
        // get a set of all new created ids
        for (Lead c : Leads)
            ids.add(c.id);
        
        // assert that 50 shares were created
        List<LeadShare> shares = [select id from LeadShare where 
                                  LeadId IN :ids and RowCause = 'Manual'];
        System.assertEquals(shares.size(),50);
        
    }
    
    // insert records and switch them from public = true to public = false
    static testMethod void testUpdateContacts() {
        
        Set<ID> ids = new Set<ID>();
        List<Lead> Leads = new List<Lead>();
        
        for (Integer i=0;i<50;i++)
            Leads.add(new Lead(FirstName='First ',LastName='Name '+i,RecordTypeId='012p0000000Nn05AAC',
                               Email='email'+i+'@email.com',Company='ABSYZ',CRM_Owner__c='00528000006OKhPAAW'));
        
        insert Leads;
        
        for (Lead c : Leads)
            ids.add(c.id);
        
        update Leads;
        
        // assert that 0 shares exist
        List<LeadShare> shares = [select id from LeadShare where 
                                  LeadId IN :ids and RowCause = 'Manual'];
        System.assertEquals(shares.size(),0);
        
        for (Lead c : Leads)
            c.CRM_Owner__c='2F00528000006OKhP';
        
        update Leads;
        
        // assert that 50 shares were created
        shares = [select id from LeadShare where LeadId IN :ids and RowCause = 'Manual'];
        System.assertEquals(shares.size(),50);
        
        for (Lead c : Leads)
            c.CRM_Owner__c='2F00528000006OKhP';
        
        update Leads;
        
        // assert that 0 shares exist
        shares = [select id from LeadShare where LeadId IN :ids and RowCause = 'Manual'];
        System.assertEquals(shares.size(),0);
        
    }
    
}




 
rigger QuoteLineItemTrigger on Quotes__c (Before insert, Before update)
{
List<QuoteLineitem__c> quote = new List<QuoteLineitem__c>();
Set<Id>productidSet =New Set<Id>();
for(Quotes__c child : trigger.new )
{
if(child.IsSyncing__c != true)
{
//productidSet.add(child.QuoteLineitem__r.Product2Id__c);
//quote.add(child.Product_Image__c = Product2Id.Product_Image__c);
quote.add(child);
}
}

for(QuoteLineitem__c lst:lstQuote){
productidSet.add(lst.Product2Id__c);
}

Map<id,Product2__c>ProductMap=New Map<Id,Product2__c>([Select id,Product2Id__c,Name From Product2__c where id=:productidSet ]);
List<QuoteLineitem__c> lstQuote= [select id from QuoteLineitem__c where QuotesId__c=:quote];


for(QuoteLineitem__c child : lstQuote)
{
if(child.Product2Id__c != null && ProductMap.containskey(child.Product2Id__c))
{
child.Product2Id__c = ProductMap.get(child.Product2Id__c).Name;
}
}
}

User-added image

 
Argument cannot be null in Apex class
Hi All,

When the Belowmethod called through VF page button , SOme time am getting below error

Argument cannot be null.

Error is in expression '{!addworkorders}' in component <apex:commandButton> in page check_available_rawmaterials: Class.Check_Available_Rawmaterials.addworkorders: line 49, column 1
Which is Highlightes as Bold in the below mentioned code

Kindly please help me to over come from this issue
 public void addworkorders() {
        AttachmentCallWrapperlist3.clear();
        setprodid.clear();
        setRMid.clear();
        lstrmri.clear();
        lstComp .clear();
        //wraplist.clear();
        //Result.clear();
        //Result1.clear();
        //Result2.clear();
        iRmInvLst.clear();
        AttachmentCallWrapperlist.clear();
        AttachmentCallWrapperlist3.clear();
         Productnamemap.clear();
        Productqtymap.clear();
            
        show = true;
        /*for (Project__c iRow:lstworkorder) {if (iRow.Selected__c == true) {   setRMid.add(iRow.Opportunity__c);
            } 
        }   */                     
        Boolean isTrue = TRUE;
        IF(setprojectid!=Null){
            lstrmri =[select ID,Product2Id,Quantity from OpportunityLineItem where OpportunityID=:setprojectid]; 
            IF(lstrmri .size()>1){
            For(OpportunityLineItem  olt:lstrmri ){ 
            setprodid.add(olt.Product2Id);
                }
            }                          
        }  
        If(lstrmri.size()>0) { wraplist=new List<AddWrapperField1>();  
            Result=[select SUM(Quantity) Totalqty,Product2.name ProdName from OpportunityLineItem where opportunityID=:setprojectid      group By Product2.name];                          
            
            IF(Result.size()>0){
            for(AggregateResult res:Result){   wraplist.add(new AddWrapperField1(Res)); 
                Productqtymap.put((String)res.get('ProdName'), (Decimal)res.get('Totalqty'));
            }   
            }
        }  
        IF(setprodid!=Null){
            lstComp =[select ID,name,Raw_Material__c,Selected__c,Product__R.name,Total_Measurement__c  from Component__c where Product__r.name in : Productqtymap.keyset()];
            If(lstComp .size()>0) {
                wraplist1=new List<AddWrapperField>();         
                Result1=[select SUM(Total_Measurement__c) TotalMeasure,Raw_Material__r.name Name,Product__r.name pName  from Component__c  where Product__r.name in : Productqtymap.keyset()
                         group By Product__r.name,Raw_Material__r.name]; 
                Result2=[select Raw_Material__r.name Name  from Component__c  where Product__r.name in : Productqtymap.keyset()
                         group By Raw_Material__r.name]; 
                     IF( Result1.SIZE()>0 && Productqtymap!=Null){
                          for(AggregateResult res2:Result1){  
                 Rawmaterialmap.put((string)res2.get('Name'),(Double)res2.get('TotalMeasure')* Productqtymap.Get((String)res2.get('pName')));
                 }
            }  
            If(Result1.size()>0 && Productqtymap!=NUll && Rawmaterialmap!=Null ){
                for(AggregateResult res1:Result1){ 
                    AttachmentCallWrapper I= New AttachmentCallWrapper();  
                    i.qty=0; 
                    i.RequiredMaterial =(string)res1.get('Name'); 
                       If(Rawmaterialmap.size()>0){
                       i.Qty=Rawmaterialmap.get((string)res1.get('Name')); }
                    i.ProductName =(string)res1.get('pName');             
                    i.ProdutQty  = Productqtymap.Get((String)res1.get('pName')); 
                    AttachmentCallWrapperlist.add(i);            
                } 
                
                }
                
                if(AttachmentCallWrapperlist.size()>0 && Productqtymap!=Null){
                For(AttachmentCallWrapper  atc: AttachmentCallWrapperlist){           
                    if (Productqtymap.containskey(atc.RequiredMaterial)){            
                        Productqtymap.put(atc.RequiredMaterial,
                        (atc.Qty+ Productqtymap.get(atc.RequiredMaterial)) );     
                        Productnamemap.put(atc.RequiredMaterial,atc.RequiredMaterial);         
                    }Else{
                        Productqtymap.put(atc.RequiredMaterial, atc.Qty);
                        Productnamemap.put(atc.RequiredMaterial,atc.RequiredMaterial);    
                    }
                }
            }
        }  
        
        }
        iRmInvLst=[SELECT id,Name,RawMaterial__c,Available_RM_in_OrigMeasure__c ,Unit__c FROM Raw_Material_Inventory__c 
                   WHERE Name IN :Productnamemap.keyset()];
        IF(iRmInvLst.Size()>0 && Productqtymap!=Null){
            For(Raw_Material_Inventory__c INV: iRmInvLst){
                AttachmentCallWrapper2 atc4 = new AttachmentCallWrapper2();
                atc4.RequiredMaterial=INV.NAME;  
                atc4.Stock=INV.Available_RM_in_OrigMeasure__c;
                if(INV.Available_RM_in_OrigMeasure__c<Productqtymap.get(INV.NAME)){
                atc4.Requiredqty=Productqtymap.get(INV.NAME)-INV.Available_RM_in_OrigMeasure__c;
                    atc4.PurchaseUnit=INV.Unit__C;
                }
                atc4.Qty=Productqtymap.get(INV.NAME);   AttachmentCallWrapperlist3.add(atc4);
                
            }
        }
    }

Thanks,
Shakila
I'm currently writing a test class and keep getting "Method does not exist or incorrect signature errors... I'm not certain or confident that I am writing the test class properly...



public class SetEMT {
    ApexPages.StandardController stdCtrl;
    public SetEMT(ApexPages.StandardController controller) {
        stdCtrl=controller;
    }
    List<EmailTemplate> mmts;
    public String mmtid {get; set;}
    public String mmtname {get; set;}
    public String folder {get; set;}
    
    public List<EmailTemplate> getTemplates() {

        if(mmts == null) mmts = [select name, description from EmailTemplate order by Name];              
        return mmts;
    }
    
    public void changeTemplates() {
      if(folder != null && !folder.equals('')) mmts = [select name, description from EmailTemplate where FolderId = :folder order by Name];
      else mmts = [select name, description from EmailTemplate order by Name];
    }
    
    public List<SelectOption> getFolders() {
        List<Folder> folders = [select name, Id from Folder where Type = 'Email' order by name];
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('',''));
        for (Folder f : folders) {
            options.add(new SelectOption(f.Id,f.Name));
        }
        return options;
    }
    public void setTemplate() {
        EAST_Mailing__c mailing = (EAST_Mailing__c)stdCtrl.getRecord();
        mailing.PreApprovedEmailTemplateName__c = mmtname;
        mailing.PreApprovedEmailTemplateLink__c = URL.getSalesforceBaseUrl().toExternalForm() + '/' + mmtid;
        update mailing;
    }
}



@ istest (SeeAllData=true)
public class SetEMTTest
{
    private static testmethod void validate(){
        
        List<EmailTemplate> eList = new List<EmailTemplate>();
        EmailTemplate e = new EmailTemplate (Name = 'Test Template', TemplateType= 'Text');   
        eList.add(e);
       
        ApexPages.StandardSetController setCtr = new ApexPages.StandardSetController(eList);
        SetEMT.setSelected(new EmailTemplate[]{e});
        MassUpdateSimpleController controller = new MassUpdateSimpleController(SetEMT);
        
        controller.getTemplates();
        
        System.assert(controller.getTemplates()!=null);
        
    }
    
}
 
i found that i cant use @wire without setting cacheable=true.  But i dont want to cache the data... is there any solution?
<apex:page standardController="Contact" extensions="datepickerController" docType="html-5.0" >
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/css/datepicker.css"/>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/js/bootstrap-datepicker.js"></script>
    
    <script>
        $(function () {
            $("#datepicker").datepicker({ 
                format: "dd/mm/yyyy",
                autoclose: true, 
                todayHighlight: true
            }).datepicker().val();
        });
        function getValues(element){
            console.log(element.value);
        }
    </script>
    <apex:pageMessages />
    <apex:sectionHeader title="Date Picker" subtitle="Create Contact" />
    <apex:form id="frm">   
        <apex:pageblock title="Contact" id="pb">
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" action="{!Cancel}" />
            </apex:pageBlockButtons>
            <apex:pageBlockSection id="pbs">
                <apex:inputField value="{!Contact.Salutation}" />
                <apex:inputField value="{!Contact.FirstName}" />
                <apex:inputField value="{!Contact.LastName}" />                
                <apex:inputField value="{!Contact.Birthdate}" />  
                Birthday :--- <input type="text" id="datepicker" onchange = "getValues(this);" value="{!Contact.Birthdate}" />
                <apex:pageBlockSectionItem >
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
            
        </apex:pageblock>
    </apex:form>
</apex:page>

I am very new to development in general and to Salesforce development. I have a custom object Announcements__c. I want to display the most recent announcement record on a visualforce page. I have gone through the visualforce basics module (https://trailhead.salesforce.com/content/learn/modules/visualforce_fundamentals) but still cannot figure out how to pass the record ID of the most recent announcement record (custom object). Here is my apex class - which I modeled after the trailblazer example which used the Contact standard object, so not really sure this translates well to my custom object:

User-added image
And here is the visualforce markup:

User-added image

I get no errors, but also don't get my custom object field to display. Any help would be much appreciated!

Hi All,

We are facing a strange error while saving a record.
We have multicurrecy enable for our org and on opportunity we have a field "Net Value" which is a curreny field (18,0) and we have written a custom lightning component to create/edit a opportunity, we do not use classic anymore.
Issue which we are seeing are coming only for european countries but not on all opportunity records.

On some records when user which is also the owner of opportunity tries to save opportunity they get NUMBER_OUTSIDE_VALID_RANGE error on "Net Value" field but we do not have any code written which change field value. But when same record is been saved by Admin who is not the owner of opportunity then error do not comes and goes away permanently. 

We are not able to understand why Lightning behaving like this, Did anyone come across any error like this.

Thanks in Advance,
Puneet.
This no longer works as described in the Trailhead.  Selecting "User with Limited Access to Treasures" on the CRUD & FLS Visualforce Demo tab yields an "insufficient access" error with no data returned.
Hi All,

I have started with Salesforce BULK API and installed cURL using cURL download wizard for 64 bits.
I have also created login.txt file as mention in guide and tried to run the curl command 
[ curl https://login.salesforce.com/services/Soap/u/38.0 -H "Content-Type: text/xml; charset=UTF-8" -H "SOAPAction: login" -d @login.txt ] but getting an error 
UNKNOWN_EXCEPTION: Content is not allowed in prolog.

cmd error
 
Please Help