+ Start a Discussion
SandrineSandrine 
Hello,

I have below error when i run the ANt retrive command
Buildfile: C:\Users\Gyra\Music\apache-ant-1.9.4\bin\build.xml

FTOQ_test:
[sf:retrieve] Note: use ant -verbose to get more information on the failure

BUILD FAILED
C:\Users\Gyra\Music\apache-ant-1.9.4\bin\build.xml:14: Failed to login: Failed
 to send request to https://test.salesforce.com/services/Soap/u/38.0

Total time: 23 seconds
 
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>teestper</members>
        <name>ApexClass</name>
    </types>
    <version>38.0</version>
</Package>

any suggestions ?
Best Answer chosen by Sandrine
Syed Insha Jawaid 2Syed Insha Jawaid 2
Hi Sandrine

Please check your credentials in build.properties file once.If they are validated then revisit the login history for the user through which you are trying to execute ant command.It might be an IP issue as well.

Cheers!!!
kundlik Yewalekundlik Yewale 
Hello All,
how to retrieve record id from map using custom filed.
List<String> lststringid =  new List<String>();
                for(Servicing_Error__c se : lstservicingerror)
                {
                    if(se.Fastrack_Work_Order__c != null)
                    {
                         lststringid.add(se.Fastrack_Work_Order__c) ;  
                    }   
                }
                Map<id,workOrder> mapWorkOrder = new Map<id,workOrder>([Select id,FAStrackIdentifier__c from WorkOrder where FAStrackIdentifier__c IN:lststringid]); 
                
                System.debug('Keyset'+mapWorkOrder);
                
                for(Servicing_Error__c se2:lstservicingerror)
                {
                    if(Se2.Fastrack_Work_Order__c != null)
                    {
                        System.debug('mapWorkOrder.get(se2.Fastrack_Work_Order__c).id'+mapWorkOrder.get(se2.Fastrack_Work_Order__c).id);
                         se2.Fastrack_Work_Order__c = mapWorkOrder.get(se2.Fastrack_Work_Order__c).id; 
                    }
                }


I am getting below error:
System.StringException: Invalid id: 23982178: External entry point
Best Answer chosen by kundlik Yewale
Syed Insha Jawaid 2Syed Insha Jawaid 2
Hi Kundlik 

Try this piece of code : 

List<String> lststringid =  new List<String>();
for(Servicing_Error__c se : lstservicingerror)
{
    if(se.Fastrack_Work_Order__c != null)
    {
         lststringid.add(se.Fastrack_Work_Order__c) ;  
    }   
}
Map<String,Id> mapWorkOrder = newMap<String,Id>();
for( WorkOrder objWorkOrder : [Select id,FAStrackIdentifier__c from WorkOrder where FAStrackIdentifier__c IN:lststringid]) {
    mapWorkOrder.put(objWorkOrder.FAStrackIdentifier__c,objWorkOrder.Id);
}

for(Servicing_Error__c se2:lstservicingerror)
{
    if(Se2.Fastrack_Work_Order__c != null && mapWorkOrder.containsKey(se2.Fastrack_Work_Order__c))
    {
         se2.Fastrack_Work_Order__c = mapWorkOrder.get(se2.Fastrack_Work_Order__c).id; 
    }
}

In your code your data in the field was of text type but your map had 'ID' as dataype due to which this type conversion error arised.

Cheers!!!
Anuj Thakur 4Anuj Thakur 4 
Hi All,
1. we know that we can not call a future from a batch or from another future because both are asynchronous. But we can call a batch from another        batch even batchs also asynchronous. I googled it but did not get any proper answer. could you please suggest your views ont his.
2. we can call a batch from another batch only from start or finish method but not from execute method, why?
Any response would be appriciated.
Thanks,
Anuj
 
Best Answer chosen by Anuj Thakur 4
Nandigam RajeshNandigam Rajesh
Hi Anuj,
1) Usually we are not supposed to give a call from the asynchronous to asynchronous because we don't know when it get worked (executed when the source is available only). In terms of batch class we can do this only in the finish method, there only we can understand the another batch can execute after completion of one batch this is the exceptional case.
2) Can call batch class to batch class in only finish not possible​ in the start method. If we call the 2nd batch class in the execute method we may have a possibility to call the second batch once the some group of the records has been processed that would not be much effective for whole process.


Regards |Rajesh | Technician
Gateway Bikes Group4Gateway Bikes Group4 
User-added image

User-added image
<!-------Lightning Component:Opencase.cmp----->

<aura:component controller="OpenCasesApexController" implements="force:appHostable">
<aura:attribute name="cases" type="Case[]"/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:iteration items="{!v.cases}" var="case">
    <c:CaseList case="{!case}"/>
    </aura:iteration>
  </aura:component>
  
  <!--Lightning App:OpenCasesApp.app-->
<aura:application >
    <c:OpenCases/>
</aura:application>

<!---OpenCasesController.js->
({
doInit:function(cmp,event,helper){
       var action=cmp.get("c.getCaseDB");
       console.log('calling doInit');
       
       action.setCallback(this,function(response){
        var state=response.getState();
        
        if(cmp.isValid()  &&  state === "SUCCESS"){
          console.log('getting cases');
        
          cmp.set("v.cases",response.getReturnValue());
          }
});
     $A.enqueueAction(action);
}
  
   })
   
   //Apex Controller
    public with sharing class OpenCasesApexController {
 @AuraEnabled
    public static List <Case> getCaseDB(){
     String [] caseFields =new String[]{'Id','OwnerId','Type','Status','Priority',
                                     'IsClosed','Reason','Origin'};
        
         //Create a Map for all the Case object
          Map<String,Schema.SobjectField> caseMap = 
           Schema.SobjectType.Case.fields.getMap();
         
           for(String field:caseFields){
                if(!caseMap.get(field).getDescribe().isAccessible()){
                 System.debug('This field was not accessible:' +caseMap.get(field));
                 return null;
                     }
                  }   
    
         return [SELECT  Id
                      FROM Case 
                      where IsClosed=false
                      AND OwnerId =:UserInfo.getUserId() limit 5];
  }
}
<!--Nesting the Component:CaseList.cmp -->
<aura:component >
    <aura:attribute name="case" type="Case"/>
       <div onclick="{!c.goToRecord}">
        <force:recordview recordId="{!v.case.Id}" type="MINI"/>
        </div>
</aura:component>

<!--CaseListController.js-->
({
      goToRecord:function(cmp,event,helper){
    //Declaration of variable
    var sObjectEvent=$A.get("e.force:navigateToSobject");
        sObjectEvent.setParams({    "recordId":cmp.get("v.case.Id"),
                                "slideDevName":'detail'
        }) 
            sObjectEvent.fire();
        
        }
})

   
   
   
Best Answer chosen by Gateway Bikes Group4
Maharajan CMaharajan C
Hi,

The Issue is due to case-sensitive here in navigateToSobject  --> navigateToSObject  letter O should be in Caps.
 
goToRecord:function(cmp,event,helper){
        var sObjectEvent=$A.get("e.force:navigateToSObject");
        sObjectEvent.setParams({    
            "recordId":cmp.get("v.case.Id"),
            "slideDevName":"detail"
                               });
        sObjectEvent.fire();
    }

Can you please Let me know if it helps or not!!!

If it helps don't forget to mark this as a best answer!!!


Thanks,
Maharajan.C
Sadik Shaik 3Sadik Shaik 3 
Below is the code:
public class UtiityClassl{
public cls_data[] data;
public class cls_data {
public String customerName;
public String Id;
public String opportunityId;
public String Status;
public String Value;
}
public static UtilityClass parse(String json){
return (UtilityClass) System.JSON.deserialize(json, UtilityClass.class);
}
}

Can anyone please help me to write a test class for the above class;
Thanks in Advance
Best Answer chosen by Sadik Shaik 3
Raj VakatiRaj Vakati
Please past yout json string and here is the code
 
@isTest 
public class UtiityClasslTest 
{
	
	 static testMethod void testEx1() 
	 {
		String jsonVal ='' ; 
		UtiityClassl.parse(jsonVal);
		
	 }
}

 
David PicksleyDavid Picksley 
Hi All,

I am trying to output a date type of yyyy-MM-dd, not as a string. I can create the correctly formatted string and insert that into a set.
currentDate = Date.today().toStartofMonth(); // Outputs 2018-12-01 00:00:00

firstDayOfCurrentMonth = currentDate.addMonths(i).toStartofMonth();

String currentDateString = String.valueOf(firstDayOfCurrentMonth).removeEnd(' 00:00:00'); // Outputs 2018-12-01 as a string

However, the issue is converting that string back into the Date type using either .valueOf or .parse
Date.valueOf(currentDateString);
// Outputs 2018-12-01 00:00:00

Date.valueOf(currentDateString.removeEnd(' 00:00:00'))
// Outputs 2018-12-01 00:00:00

Date.parse(currentDateString)
// Throws error with Invalid Date : 2018-12-01

My question is, how can I convert the correctly formatted string back into the Date type?

Many thanks!!
 
Best Answer chosen by David Picksley
Syed Insha Jawaid 2Syed Insha Jawaid 2
Hi David

Try using Date.valueOf method.Please find below a piece of code to check :

 system.debug('Date : +  Date.ValueOf('2018-12-01 14:05:07'));

Cheers!!!
Kasa ManjushaKasa Manjusha 
Hi all,
How to add multiple charts for reports? Please help me.
Thanks 
Manju
Best Answer chosen by Kasa Manjusha
Syed Insha Jawaid 2Syed Insha Jawaid 2
Hi Manju

You cannot add more than one chart on a report.
For adding multiple charts go for dashboards

Cheers!!!!
DJPDJP 
Hello,
I have custom object Location__c and custom field on Account.SAP_BP_ID__c. The custom Object Location__c has fields AccountID__c and SAP_ID__c. Location__c will be populated via API in back ground. Location__c.AccountID__c has lookup relationship with Account. I need a trigger to update the AccountID__C on Location__c object with Account.ID whenever a new location is created. 
Update Location__c.AccountID__c where Location__c.SAP_BPID__c = Account.SAP_ID__c
and Location__c.AccountID__c has lookup relationship with Account (sorry to repeat)

Thanks
Dinesh
Best Answer chosen by DJP
Syed Insha Jawaid 2Syed Insha Jawaid 2
Hi Dinesh

Please use this following code block : 

TRIGGER on <LOCATION> beforeInsert { 
Set < String > setOfSAPIds = new Set < String >();
for(Location__c location : triggerNew) {
if(location.SAP_BPID__c != null)
setOfSAPIds.add(location.SAP_BPID__c);
}

if(setOfSAPIds.isEmpty())
 return;

Map < String, String > mapOfSAPidVsAccountId = new Map < String, String >();  
for(Account acc : [SELECT Id,SAP_ID__c from Account where SAP_ID__c IN : setOfSAPIds]) {
 mapOfSAPidVsAccountId.put(acc.SAP_ID__c,acc.Id);
}

if(mapOfSAPidVsAccountId.values().isEmpty())
 return;

for(Location__c location : triggerNew) {
if(location.SAP_BPID__c != null) {
location.AccountID__c = mapOfSAPidVsAccountId.get(location.SAP_BPID__c);
 }
}
}

TriggerNew has all the updated value, you can debug to check.

Cheers!!!!
 
Jim MontgomeryJim Montgomery 
I have this code in my page controller that allows for a "Select All" functionality.

public void selectAll() {
        if(allBool) {
            for(WrapperClass w : listWrapper) {
                w.checked = true;
            }
        } else {
            for(WrapperClass w : listWrapper) {
                w.checked = false;
            }

How do I pass that parameter to the test class?

 PageReference pageRef = page.Case_Inventory;
        pageRef.setRedirect(true);
    pageRef.getParameters().put('accountId',A.Id);
    pageRef.getParameters().put('CaseId',C.Id);
    pageRef.getParameters().put('All','True');
    test.setCurrentPage(pageRef);
    
      CaseInventory  CI = new CaseInventory();
            CI.selectAll();
Best Answer chosen by Jim Montgomery
Raj VakatiRaj Vakati
try this code
 
PageReference pageRef = page.Case_Inventory;
        pageRef.setRedirect(true);
    pageRef.getParameters().put('accountId',A.Id);
    pageRef.getParameters().put('CaseId',C.Id);
    pageRef.getParameters().put('All','True');
    test.setCurrentPage(pageRef);
    
      CaseInventory  CI = new CaseInventory();
	  CI.allBool =true ;
            CI.selectAll();

 
SandrineSandrine 
Hello,

I am working with email services,
Sometimes the email sending is not correct, receiptdoenst receive email or not attached to correct oject.

Howcani debug the issue ?

thank you for suggestions
Best Answer chosen by Sandrine
Raj VakatiRaj Vakati
Email Services can have several Email Addresses. Each Email Address has a context user (i.e. running user)

User-added image

You need to enable debug logging for that Context User. Well-designed email services do not use a specific individual as the Context user, rather, some dedicated headless user that serves as a traceability aid (as records will be created or modified using that context user and hence the audit fields become more useful)
Another possible answer is the email is sent from a domain not on the whitelist Accept Email from From. If you have set up the Email Service rules to Bounce the message rather than Discard, you gain additional insight as the sender will discover the problem.
And another debugging tool you have is the Email Snapshot feature available in Setup.

If everything is proper then debug log should appear.If debug log is not appearing you can check following points:
1. When you are replying to email, please make sure that replyto email id is same that you have added in replyto field on email addresses of email services.

Please make sure that you allowed all email addresses in 'Accept Email From' field of email service.