• Jayant Das
  • NEWBIE
  • 180 Points
  • Member since 2012


  • Chatter
    Feed
  • 6
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 68
    Replies
Have succesully created a test class previously.  However, now I have a trigger and a potential test class for that trigger based off some examples but I am not able to do Test | New Run.  I get a message "Add test methods to your test class" but am not sure how to do that in the case of a trigger.  Any help or sugggestions would be appreciated.

Here is the trigger:
trigger UpdateAssetFromSO on Service_Order__c (after update, after delete) {

    List<Id> idAssetList = new List<Id>();
    List<Asset> assetListToUpdate = new List<Asset>();
    
    if(trigger.isUpdate) {
        
        for (Service_Order__c so : trigger.new) {
            
            if(trigger.oldMap.get(so.Id).Total_Reimbursement_Amount__c == so.Total_Reimbursement_Amount__c) continue;
            
            idAssetList.add(so.Asset__c);
        }       
    }
    
    if(trigger.isDelete) {
        
        for (Service_Order__c so : trigger.old) {
                      
            idAssetList.add(so.Asset__c);
        }         
    }
    
    if(idAssetList.isEmpty()) return;
    
    for(Id id : idAssetList) {
        
        Asset asset = new Asset(Id = id);
        asset.SOChanged__c = true;
        
        assetListToUpdate.add(asset);
        
    }
    
    if(assetListToUpdate.size() > 0)
        Database.update(assetListToUpdate);
}

Here is the Test Class (test when the Labor field is updated and when the service order record is deleted):
@isTest(SeeAllData=true)

public class UpdateAssetFromSO_Test {

    public void DoIt(){
    
        //Create Service Orer to work with
        Service_Order__c so = new Service_Order__c(
           Account__c='001j0000016yvCrAAI',
           CurrencyIsoCode='USD-U.S. Dollar',
           Status__c='Open',
           Charge_To__c='11 - Logan',
           Labor_Reimbursement__c = 12.00
           );
           insert so;
        
        //Update Service Order Total Reimbursement Amount is a formula field so we update Labor to make it change.
        so.Labor_Reimbursement__c = 123.00;
        
        //Delete Service Order
        Delete so;
        
    } 
    
}

 
Hello,
 
I am working through to trying to understand dx.  I am not a sf developer but have some knowledge concerning it. 
 
We are running today bitbucket as our git repo.  We are not using it yet aside from daily backups of sorts.  Coding is being done strictly within the orgs themselves. 
 
We want to start using dx and our repo and refine our development process.  For me the part I am struggling the most with is our repo structure I think.  I have spent some time searching but have not found anything on this that helps me wrap my head around this. 
 
Our repo structure today is a listing of all metadatatypes and the files underneath it.  Class folder for example and all classes under it.  As part of dx it seems you create a project that includes the class folder and files within the force-app (I believe it was) folder.  Within this there a number of other folders and so on.  This structure is very different.  Are there folks in, or that were in a similar situation that married these 2 structures in some way and if so how did you do it? 
 
I believe we can do these conversions from one to the other and back but that sure seems like a lot of overhead. 
 
Also, I would love a better understanding of folks that are in a similar situation as we are, how did you go about starting to use dx and your vcs repo.  Another point I am struggling a bit with is so I spin up a scratch org and I am working on an issue with a few classes and workflows for example.  What is my process here in how I should work this with my git structure as I have it today?   
 
Do I create an empty project, bring in the classes I need from my repo, work them, work the workflow in the scratch org and sync that change down locally in to my project.  When ready to push back up to our vcs convert the project to the structure we have today then push?  
 
If there is a video on this or a good blog that I have overlooked I would love to read it and better understand what we need to do here.    
 
Thanks for the help.
 
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_lightning_openFiles.htm 

As I was creating a new lightning component with the lightning:openFiles functionality, I realized the documentation online is incorrect. the function is defined as "cmp", but within function itself it references "component".

I tried submitting a case, but apparently I need Premiere Support for anybody to fix this.  Can someone submit this to get fixed.

Thanks,
Hi

i would like to modify a form when i choose a pick value which returns input field show up and hidden event
How could this be enable? i cant find where i sort this thing out.
  • April 03, 2018
  • Like
  • 0
Hi All,

I am using lighning component in VF page using lightning out. Created simple datatable with Edit and Del option for each record. Now when I click on Edit link on each row, able to pass selected record Id to controller however not able to use below event code to edit the record. Getting undefined in console.log.
 
var editRecordEvent = $A.get("e.force:editRecord");    
console.log('***JN***'+editRecordEvent);
    editRecordEvent.setParams({
         "recordId": recId // recId is populating correctly
   });
    editRecordEvent.fire();

Any idea?

Thanks
Jagmohan
  • March 16, 2018
  • Like
  • 0
Hi Experts

We have serveral partners each with thier own login URL, which we would like to bring into a single shared login screen.

e.g.
myinstance.force.com/partner1/login
​myinstance.force.com/partner2/login

Is there a way to have one single login screen and it login to the correct partner depending on thier username/profile?

e.g.
myinstance.force.com/login

Any help would be apreciated.

Nick
We have an implementation of visual force email template as mentioned here (https://www.salesforce.com/us/developer/docs/pages/Content/pages_email_templates_creating.htm) which is used as a response to the customer whenever an email to case is created. The current implementation after the case is created sends an email to the Contact record's email in the language set in the custom language field on the Contact.

However if there are no Contact record present, the customer is still getting an email back through the very same template, in that case we are trying to understand how does Salesforce set the recipient email and the language? Any help on this is really appreciated.

Thanks,
Jayant
Getting the error when using the field in a SOQL query in Developer Console or Workbench. This works fine from a Java Client and Tooling API WSDL. Has someone encountered a similar problem and is aware of the resolution?
select Id, Name, SymbolTable from ApexClass

Any help on this is really appreciated.
The link @ https://developer.salesforce.com/docs/atlas.en-us.mobile_sdk.meta/mobile_sdk/push_using_ios.htm mentions steps to enable the "Push Messaging Enabled" option under Connected Apps --> Mobile App Settings. However this option is missing from Winter 14. Can anyone please suggest on how to enable Push notification for native iOS application?

Hi,

 

We have been facing an issue during CLI Data Load extract with Data Loader Version 21.0. The process that we are executing is to extract data from Salesforce and insert the data to a table in Oracle. The issue happens when a lookup field is being referenced in the SOQL query against which no data is returned.

 

After doing some research we saw that this issue does not happen if we use Data Loader v17.0 (also mentioned @ https://code.google.com/p/dataloadercliq/issues/detail?id=59). However would like to understand if this is a bug that has not been taken care in the recent versions of the data loader?

 

Any help/pointer on this is really appreciated.

 

SDL mapping:

MySubject__r.Name=MySubject

 

database-conf:

<entry key="MySubject__r.Name"  value="java.lang.String"/>

 

Exception log:

2013-12-11 10:24:17,573 FATAL [main] process.ProcessRunner topLevelError (ProcessRunner.java:211) - Unable to run process accountReplicate
java.lang.RuntimeException: java.lang.NullPointerException
at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:136)
at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:74)
at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.java:226)
Caused by: java.lang.NullPointerException
at com.salesforce.dataloader.mapping.SOQLMapper.getReferenceField(SOQLMapper.java:222)
at com.salesforce.dataloader.mapping.SOQLMapper.evalSfdcField(SOQLMapper.java:191)
at com.salesforce.dataloader.mapping.SOQLMapper.evalSfdcField(SOQLMapper.java:185)
at com.salesforce.dataloader.mapping.SOQLMapper.normalizeSoql(SOQLMapper.java:169)
at com.salesforce.dataloader.mapping.SOQLMapper.addSoqlFieldMapping(SOQLMapper.java:165)
at com.salesforce.dataloader.mapping.SOQLMapper.putPropertyEntry(SOQLMapper.java:98)
at com.salesforce.dataloader.mapping.Mapper.putPropertyFileMappings(Mapper.java:120)
at com.salesforce.dataloader.mapping.Mapper.putPropertyFileMappings(Mapper.java:115)
at com.salesforce.dataloader.mapping.Mapper.<init>(Mapper.java:76)
at com.salesforce.dataloader.mapping.SOQLMapper.<init>(SOQLMapper.java:57)
at com.salesforce.dataloader.controller.Controller.createMapper(Controller.java:179)
at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:120)
... 2 more
-1
FAIL

 

Thanks,

Jayant

Hi All,

 

I am a novice and 4 days old on mobile development. I have been trying to do a POC as a learning path and have successfully implemented the ContactExplorer example using the Local/Remote App Start Data. And now I wish to extend the functionality to Offline capabilities but am facing a blocker. I had initially started with Local (index.html), but since the Remote approach allows the flexibility of using VF page mobile components in the pages (https://github.com/forcedotcom/MobileComponents/tree/master/Visualforce/src/pages), hence moved to that approach. But currently am stuck with the navigation flow.

 

1. Remote App Start Data approach:

I modified the MobilePageWithComponents' page "Contact List" to navigate to MobilePage (<a href="#listPage" data-role="button">Contact List</a> TO <a href="/apex/MobilePage" data-role="button">Contact List</a>) so that I could display the contacts in split view. In bootconfig.js, I have pointed the Remote App Start Data to point to MobilePageWithComponents page. This works like a charm in browser but when I test this in emulator in eclipse, the navigation is stuck at MobilePageWithComponents page and is not forwarded to the MobilePage. I could see no logs as such and have been struggling to implement multi page flows in a mobile device.

 

2. Local App Start Data approach:

I wanted to extend the index.html to point to my VF pages, so that if the device is offline, at least the index.html is rendered and rest of the pages are rendered when the device is online. But am not sure how to invoke the VF page from index.html since the application would have started in the Local App Start Data approach.

 

I am looking for some help at this stage with someone who have tried out something similar and have been able to successfully implement. Any pointers on this is highly appreciated.

 

Regards,

Jayant

The link @ https://developer.salesforce.com/docs/atlas.en-us.mobile_sdk.meta/mobile_sdk/push_using_ios.htm mentions steps to enable the "Push Messaging Enabled" option under Connected Apps --> Mobile App Settings. However this option is missing from Winter 14. Can anyone please suggest on how to enable Push notification for native iOS application?
Have succesully created a test class previously.  However, now I have a trigger and a potential test class for that trigger based off some examples but I am not able to do Test | New Run.  I get a message "Add test methods to your test class" but am not sure how to do that in the case of a trigger.  Any help or sugggestions would be appreciated.

Here is the trigger:
trigger UpdateAssetFromSO on Service_Order__c (after update, after delete) {

    List<Id> idAssetList = new List<Id>();
    List<Asset> assetListToUpdate = new List<Asset>();
    
    if(trigger.isUpdate) {
        
        for (Service_Order__c so : trigger.new) {
            
            if(trigger.oldMap.get(so.Id).Total_Reimbursement_Amount__c == so.Total_Reimbursement_Amount__c) continue;
            
            idAssetList.add(so.Asset__c);
        }       
    }
    
    if(trigger.isDelete) {
        
        for (Service_Order__c so : trigger.old) {
                      
            idAssetList.add(so.Asset__c);
        }         
    }
    
    if(idAssetList.isEmpty()) return;
    
    for(Id id : idAssetList) {
        
        Asset asset = new Asset(Id = id);
        asset.SOChanged__c = true;
        
        assetListToUpdate.add(asset);
        
    }
    
    if(assetListToUpdate.size() > 0)
        Database.update(assetListToUpdate);
}

Here is the Test Class (test when the Labor field is updated and when the service order record is deleted):
@isTest(SeeAllData=true)

public class UpdateAssetFromSO_Test {

    public void DoIt(){
    
        //Create Service Orer to work with
        Service_Order__c so = new Service_Order__c(
           Account__c='001j0000016yvCrAAI',
           CurrencyIsoCode='USD-U.S. Dollar',
           Status__c='Open',
           Charge_To__c='11 - Logan',
           Labor_Reimbursement__c = 12.00
           );
           insert so;
        
        //Update Service Order Total Reimbursement Amount is a formula field so we update Labor to make it change.
        so.Labor_Reimbursement__c = 123.00;
        
        //Delete Service Order
        Delete so;
        
    } 
    
}

 
Hello,

I am new to Apex and I built a page controller for a page that calls a flow and then grabs a variable from the flow to set a redirect page to that record (an Opportunity in this case). My problem is that I don't know how to write the test class for this code as I would need to reference the flow. The functionality works great but without the test class I can't move my changes to production. Any help is greatly appreciated.

The visualforce page code is this:
<apex:page sidebar="false" Controller="OpportunityRedirect" > <flow:interview name="LookupReturnOpp" interview="{!LookupReturnOpp}" finishLocation="{!prFinishLocation}"> <apex:param name="varCurrentUserID" value="{!$User.Id}"/> </flow:interview> </apex:page>

and the Apex Controller is this:
public class OpportunityRedirect{

    public String Account { get; set; }
// Instanciate the Flow for use by the Controller - linked by VF "interview" attribute
 public Flow.Interview.LookupReturnOpp LookupReturnOpp {get;set;}

 // Factor your PageReference as a full GET/SET
 public PageReference prFinishLocation {
 get { 
 PageReference prRef = new PageReference('/' + strOutputVariable);
 prRef.setRedirect(true);
 return prRef;
 }
 set { prFinishLocation = value; }
 }

 // Factor your Flow output variable pull as a full GET / SET
 public String strOutputVariable {
 get {
 String strTemp = '';

 if(LookupReturnOpp != null) {
 strTemp = string.valueOf(LookupReturnOpp.getVariableValue('varOppID'));
 }

 return strTemp;
 }

 set { strOutputVariable = value; }
 } 

}

The flow that is referenced is a screen flow that simply looks up an Opportunity and saves it's ID in the flow variable varOppID.
I am having a sanario in email to case.
when  a auto response mail is send to user after creation of a case ,methioning the case created details .. 
Situation is if user has setup auto response mail saying that "out of office " .. this out of office email will come back to sales force and again a case will be created with subject " out of office " this will again auto response to user..thus this will go into infinite loop.. 
how to tackle this situation ..??????
One senario I can think of is if in user's " out of office " email we can attach case number ...
But I dont know how to do itt.
plz help

Hi all,
I'm a bit new to SFDC and am running into a decently sized duplicate problem in my org. We have DupeCatcher which does a great job of catching manual duplicates, but we're having issues with web-to-lead and imports (especially after conferences). With imports, we'd like to be able to search through both contacts AND leads for duplicates, instead of just one or the other. We'd rather stick to doing this freely, but I'm starting to think we're going to have to pay.
Do you have any free tricks?

What are your thoughts on these apps: Cloudingo, Demandtools, DMS Duplicate and Duplicate Check?

Thanks for the discussion!

public without Sharing class SendToContractorController {
    Public Account newAccount {get; set;}
    
    Public String AccountId ; 
    Public String  eventType ;
    
    Public ApexPages.StandardController controller {get; set;}
    
    public SendToContractorController() { 
        AccountId = ApexPages.currentPage().getParameters().get('Id');
        eventType = ApexPages.currentPage().getParameters().get('type');
        
    
        }
    
    
    public PageReference init() {
        try{
            
                if(eventType == 'SentToCustomer') {
                    newAccount.Sent_to_Customer__c = true;
                  //  newAccount.Subcontractor_Email__c = newAccount.Subcontractor_Search__r.Applicant2_Email__c ;
                    
                   update newAccount;
                    
                   // SendToContractorController.processEvent(new set<Id>{newAccount.id});
                    PageReference eventPage = new ApexPages.StandardController(newAccount).view();
                    eventPage.setRedirect(true);
                    return eventPage;
                    
                } else if(eventType == 'SyncDataFromCustomer') {
                    
                    List<Contractor_Job__c> contractorJobList = [SELECT Id, Event_Id__c, Start_Date_Time__c,End_Date_Time__c,Description__c, Status__c, Recharge_Notes__c, Special_Instructions__c 
                                                                 FROM Contractor_Job__c
                                                                 ];
                    system.debug('contractorJobList::'+contractorJobList);
                    SyncSubcontractorData.syncData(contractorJobList);
                    
                    PageReference eventPage = new ApexPages.StandardController(newAccount).view();
                    eventPage.setRedirect(true);
                    return eventPage;
                }
            
        } catch(Exception e){
            ApexPages.addMessages(e);
            
        }
        return null; 
    }
    
Hi guys, I cannot find the Accounts tab on Salesforce Setup Home list options. Can someone please help me out here.....Thanks.
Hi guys! How can I detect cases that were created via web-to-case? Thanks in advance.
Hi,

I have been given great help on here earlier today regarding this tirgger however we have hit a wall and I cant seem to get past this error, please see code below any help appriciated. 
trigger TriggeronCarePlan on Care_Plan_Details__c (before insert, before update) {
    
    TriggerCarePlanHandler handler =  new TriggerCarePlanHandler();
    
   if(trigger.isUpdate || trigger.isInsert)
   {
       handler.UpdateActivestatus(Trigger.new);
       
              
  public void TriggerCarePlanHandler {
    
    set<id> allContactIDs = new set<id>();
    List<Care_Plan_Details__c> allrelatedCarePlans = new List<Care_Plan_Details__c>();
    List<Care_Plan_Details__c> updateRecords = new List<Care_Plan_Details__c>();
    
  public class UpdateActivestatus (List<Care_Plan_Details__c> Triggernew)
    {        
        for (Care_Plan_Details__c var : Triggernew)
        {
            allContactIDs.add(var.ContactID );
        }  
           (Care_Plan_Details__c var : Triggernew) { system.debug('care pla details'+' '+ var); // see what are all the details are being populated for contact. //allContactIDs.add(var.ContactID ); }
    
       allrelatedCarePlans = [select id, Active_Inactive__c,ContactID from Care_Plan_Details__c where ContactID in:allContactIDs ];
     
       
       for (Care_Plan_Details__c var : allrelatedCarePlans) 
           {
                   Care_Plan_Details__c record = new Care_Plan_Details__c();
                    record.Id = var.id;
                    Record.Active_Inactive__c = false;
               updateRecords.add(record);               
           }
        
        if (!updateRecords.isEmpty())
        { 
            update updateRecords;
        }
    }
}
 
Thank You
  • April 05, 2018
  • Like
  • 0
Hello,
 
I am working through to trying to understand dx.  I am not a sf developer but have some knowledge concerning it. 
 
We are running today bitbucket as our git repo.  We are not using it yet aside from daily backups of sorts.  Coding is being done strictly within the orgs themselves. 
 
We want to start using dx and our repo and refine our development process.  For me the part I am struggling the most with is our repo structure I think.  I have spent some time searching but have not found anything on this that helps me wrap my head around this. 
 
Our repo structure today is a listing of all metadatatypes and the files underneath it.  Class folder for example and all classes under it.  As part of dx it seems you create a project that includes the class folder and files within the force-app (I believe it was) folder.  Within this there a number of other folders and so on.  This structure is very different.  Are there folks in, or that were in a similar situation that married these 2 structures in some way and if so how did you do it? 
 
I believe we can do these conversions from one to the other and back but that sure seems like a lot of overhead. 
 
Also, I would love a better understanding of folks that are in a similar situation as we are, how did you go about starting to use dx and your vcs repo.  Another point I am struggling a bit with is so I spin up a scratch org and I am working on an issue with a few classes and workflows for example.  What is my process here in how I should work this with my git structure as I have it today?   
 
Do I create an empty project, bring in the classes I need from my repo, work them, work the workflow in the scratch org and sync that change down locally in to my project.  When ready to push back up to our vcs convert the project to the structure we have today then push?  
 
If there is a video on this or a good blog that I have overlooked I would love to read it and better understand what we need to do here.    
 
Thanks for the help.
 
A simple query [select id from customObject__C] is working in Dev Console but throwing 
System.QueryException: List has no rows for assignment to SObject
Please let me know if you have any ideas on this.

Thank you!
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_lightning_openFiles.htm 

As I was creating a new lightning component with the lightning:openFiles functionality, I realized the documentation online is incorrect. the function is defined as "cmp", but within function itself it references "component".

I tried submitting a case, but apparently I need Premiere Support for anybody to fix this.  Can someone submit this to get fixed.

Thanks,
I have a visualforce page I am working on in which I am trying to edit a list of related records in a table format and save all the records with a single save button.  I created a purchase order object and a related purchase order products, which is the individual line item records that will go on the purchase order.  I used the Editing a Table of Data in a Page as my basis for creating the editiable table in visualforce.  The table draws in the related items for the purchase order.  I'm having trouble figuring out how to customize the save button to save the changes in the table.  I believe the save button is using the standard controller and trying to save the purchase order record.  I would like to customize the save button so that it can save the purchase order items in the editable table.  I'm learning how to code and i'm not sure how to set this up.  I'm thinking a controller extension to customize the save button, but I'm not sure how this would be coded.  Any help would be appreciated.  

Here is an example of the page currenlty
Example Purchase Order

And here is my current Visualforce Code
 
<apex:page standardController="Purchase_Order__c" >
    <apex:slds />
    <apex:detail inlineEdit="true"/>
   
    <!--<flow:interview name="AddProduct" />-->
    
    <apex:form> 
	<apex:pageBlock title="Purchase Order Items">
      <apex:pageBlockTable value="{!Purchase_Order__c.Purchase_Order_Products__r}" var="POLI">
      
        <apex:column value="{!POLI.POLI_Part_Number__c}"/>
        <apex:column value="{!POLI.Catalog_Number__c}"/>
        <apex:column value="{!POLI.UOM__c}"/>
        <apex:column value="{!POLI.ordered__c}"/>
        <apex:column headerValue="Backordered">
            <apex:inputField value="{! POLI.Backordered__c }"/>
        </apex:column>
        <apex:column headerValue="Received">
            <apex:inputField value="{! POLI.Received__c }"/>
        </apex:column>
        <apex:column headerValue="RMA">
            <apex:inputField value="{! POLI.RMA__c }"/>
        </apex:column>
      </apex:pageBlockTable>

   <apex:pageMessages />
   <apex:pageBlockButtons>
      <apex:commandButton value="Save" action="{!save}"/>
   </apex:pageBlockButtons>

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

 
Hi,

I would like to create a custom web form that will have fields related to opportunity fields. The idea is, when an employee completes the form, the data that is submitted will be populated in pre-existing fields in a pre-existing opportunity. 

Does anyone know the best way to go about this? We are on Enterprise edition, my coding knowledge is extremely limited FYI!

Thanks,
Pete