• Sforce.Ninja
  • NEWBIE
  • 229 Points
  • Member since 2011
  • Siddhesh Kabe


  • Chatter
    Feed
  • 6
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 78
    Replies
Hi,

If I have an existing SalesForce account (say Enterprise) and I want to create a developer account in order to develop an app and utilise the database structure I already have in place how do I go about setting this up?

i.e. Is it simply a case of signing up for a developer account with my existing account Administrator details and all my Customer records and Custom Fields will be available to me for developing with (as a copy of my live data)?

Thanks,

Mark
I have done a coding in Visualforce like its shows some Records Based on the Filter values I gave as input. It's having some fields like Name,Date...
My question is how can I sort these fiels by clicking on column title.

Thanks in advance :) 
 
I've created an individual user developer account, set up some data and created a mobile app that can log in and query the data successfully.
Back on developer.salesforce.com I've created a new User and assigned them User Licence:Salesforce, Profile:System Administrator.

Using my app I'm unable to log in using the new account.
faultstring INVALID_LOGIN: Invalid username, password, security token; or user locked out.

I'm 100% sure I'm setting the correct username and password, and the security token is the same one used for the original working account.

Would anyone have any ideas on why this account is being locked out?

Thanks,

Mark
 
I have created a simple Validation rule that states if Record Name = "RecordX" and Custom Setting Can Edit All Records != TRUE then you cannot edit the record. 

I have one test that is not working with the validation rule. I have put in the debug logs the current user and it is running with my user which it should. I can edit the record through the UI but the test validation rule is in place with the test.

Test Method:
@istest
public with sharing class OomasyncpageeExtension_test{
    testmethod static void OSPETmethod(){
        //create data
        
        User U = [SELECT Id FROM User WHERE Profile.Name='System Administrator' and isActive=true LIMIT 1];
        system.debug('User U::--::'+U);
        
        Ooma__c OCS_one = new Ooma__c (Name = 'Change Info', End_Point_URL__c = 'http://site.com' );
        insert OCS_one;
        
        ooma__c OCS_two = new Ooma__c (Name = 'Change or Cancel', End_Point_URL__c = 'site.com');
        insert OCS_two;
        
        id OSRT = Schema.SObjectType.service__c.getRecordTypeInfosByName().get('Voice Service').getRecordTypeId();
        id OOrt = Schema.SObjectType.opportunity.getRecordTypeInfosByName().get('Voice: New Sale').getRecordTypeId();
        
        Account acct = new Account(Name = 'First last');
        insert acct;
        
        Contact con = new Contact(AccountId = acct.Id, FirstName = 'first', LastName = 'last', EMail = 'someone@somewhere.com');
        insert con;
        
        Zuora__CustomerAccount__c bAcc=new Zuora__CustomerAccount__c();
        bAcc.Name='Test Bill';
        bAcc.Zuora__Account__c=acct.Id; 
        bAcc.Zuora__BillCycleDay__c = '1st of the month';
        bAcc.Zuora__BillToAddress1__c = '125 fake street';
        bAcc.Zuora__BillToAddress2__c = '';
        bAcc.Zuora__BillToState__c = 'UT';
        bAcc.Zuora__BillToPostalCode__c = '84058';
        bAcc.Zuora__BillToCity__c = 'Provo';
        bAcc.Zuora__BillToCountry__c = 'US';
        bAcc.Send_to_Collections__c = false;
        bAcc.Cancel_Billing_Account__c = false;
        Insert bAcc;
        
         Vivint_Employee__C VE = new Vivint_Employee__C (Name = 'Testname', Employee_ID__c ='999990');
        insert VE;
        system.debug('Inserted VE');
        
        opportunity oppty = new opportunity();
        Oppty.AccountId = acct.id;
        oppty.Billing_Address_Same_As_Service__c = true;
        oppty.Sales_Credit__c = VE.id;
        oppty.CloseDate = date.today();
        oppty.stageName = 'Submit For Enrollment';
        oppty.Billing_Account__c = bAcc.id;
        oppty.Contract_Signer__c = con.id;
        oppty.Service_Address_1__c = '125 fake street';
        oppty.Service_Address_2__c = '';
        oppty.Service_Address_City__c = 'Fake City';
        oppty.Service_Address_Postal_Code__c = '55555';
        oppty.Service_Address_State__c = 'CA';
        oppty.Service_Address_Country__c = 'US';
        oppty.Service_Level__c = 'Standard';
        oppty.RecordTypeId = oort;
        oppty.Name = 'Test Oppty';
        insert oppty;
        
        service__c OS = new Service__c (Account__c = acct.id, Initial_Opportunity__c = oppty.Id , Billing_Account__c = bAcc.id, Status__c = 'Active',  VOIP_Hardware_Serial_Number__c = 'Hardware serial 1', VOIP_Hardware_Serial_Number2__c= 'Hardware serial 2', RecordTypeId = OSRT, VOIP_internal_ID__c = '1234', VOIP_E911_State__c = 'CA', VOIP_E911_Postal_Code__c = '55555', VOIP_E911_Country_Code__c = 'US' ,VOIP_E911_City__c = 'test city', VOIP_E911_Address__c = 'test address', Service_level__c = 'Basic');
        OS.Contract_Signer__c = con.id;
        System.debug('Debug::: Service Record: ' + OS);
        System.debug('Current User: ' + UserInfo.getUserName());
        System.debug('Current Profile: ' + UserInfo.getProfileId());
        insert OS; 
        
        PageReference PG = Page.oomaSyncPage;
        Test.setCurrentPage(PG);
        ApexPages.currentPage().getParameters().put('id', string.valueOf(OS.id));
        Apexpages.standardcontroller stdcontroller = new Apexpages.standardcontroller(OS);
        OOmaSyncPageExtension a = new OOmaSyncPageExtension(stdcontroller);
        
        Test.startTest(); 
        Test.setMock(HttpCalloutMock.class, new OOmasyncpageextMHRG());
        
        a.oomacontactsync();
        a.nosync();
        Test.Stoptest();
    }//closing testmethod
}// closing class

Validation Rule:
AND( RecordType.DeveloperName = 'Voice_Record_Type',  !$Setup.Can_Modify_All_Services__c.Bypass_Service_Validation_Rules__c )

As mentioned before the Debug log says the Current User is me and the Profile Id is the Sys Admin Id. 
 
trigger beins_duplicate on Account (after insert) {
    
    account na = trigger.new[0];
  
  contact c=new contact();
  c.lastname=na.name;
  c.phone=na.phone;
  c.accountid=na.id;
  insert c;
  
  opportunity o=new opportunity();
  o.Name = na.Name;
        
        o.CloseDate = date.today();
        o.StageName = 'Prospecting';
  o.accountid=na.id;
  insert o;
}

nd i had written the test class as 

------------------
@istest
public class benis_duplicatetest
{
    static testmethod void test1(){

 account ac=new account(name='hari', phone='9700956194');
/* ac.name='hari';
 ac.phone='9700956194';
  
*/
 insert ac;

 contact co =new contact();
 
 co.accountId=ac.Id;
 co.lastname=ac.name;
 co.phone=ac.phone;
 insert co;
 
system.AssertEquals('hari',co.lastname);
system.AssertEquals('9700956194',co.phone);

}
}
  • November 24, 2014
  • Like
  • 0

Hi,

I was converting 3 Lead Records to Contact, and when im trying to get ID's of the records having a trigger in contact object with event of after insert I am only getting 1 ID per instance. I was expecting to get the 3 ID's in one instance.  

Hi,
I am using AngularJS to build a page on Salesforce1 mobile app. I have ability for users to upload attachments which are then saved in Attachment object. On Inserting the attachment, I am populating the id of the attachment on the object. Lets call it AttachmentId__c.

Normally ill simply use the '/servlet/servlet.FileDownload?file=' link to generate attachment link.

However, on Salesforce1 this link goes nowhere, it takes the user on the chatter feed and displays error. please login to correct org. 

Is there a way to get ServerURL for Salesforce1? Any pointers appreciated.
I'm pretty new to Apex and writing a simple trigger for when an account submits a form on our website (tracked on the formSubmit__c object) to create an Opportunity and am getting the following error message:

createOpp: execution of AfterInsert
 
caused by: System.DmlException: Insert failed. First exception on row 0 with id 006C000000ybKu1IAE; first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id]
 
Trigger.createOpp: line 16, column 1

My code is below. I received this error message yesterday when our feed created a new account when a new prospect submitted the form (we don't use Leads, only Accounts). I went to the new account's record, made a trivial edit on the form submit record, and it created the Opportunity just fine. If our feed is creating a new account as someone submits the form, it should still be able to fetch the account ID since this is an after insert trigger and the account a lookup field on the form submit record. What__c is the associated lookup field from form submit to account. Any help would be appreciated!

trigger createOpp on formSubmit__c (after insert,after update) {
  List<Opportunity> newOpps = new List<Opportunity>();
  for (formSubmit__c f : Trigger.new) {
    if (f.Subject__c.startswith ('Form Submit: Account Submitted a form. Please Contact immediately')) {
    Opportunity opp = new Opportunity();
    opp.Name        = 'Information Request Lead';
    opp.StageName   = 'Qualification';
    opp.Short_Description__c   = 'Information Reuqest';
    opp.Type   = 'Inbound';
    opp.CloseDate   = Date.today() + 7;
    opp.AccountId   = f.What__c; // Use the trigger record's Account ID
    opp.OwnerId   = '00580000003DcBHAA0';
    newOpps.add(opp);
      }
  insert newOpps;
    }
}

 
Just starting out and I have a simple issue.  I'm not able to pass a value from an inputField on a VF page to a custom controller.  Based on my searching, it should be easy.  Any help would be appreciated.

Here is my VF page:
<apex:page standardController="Campaign" extensions="MarketoMergeFieldExtension">
    <apex:form >
        <apex:pageBlock title="Marketo Merge Field Setter">
            <apex:PageBlockSection >
                <apex:outputField value="{!campaign.Name}"/>
            </apex:PageBlockSection>
            <apex:PageBlockSection title="Choose Marketo Merge Fields">
                <apex:inputField  value="{!campaign.Marketo_Merge_Field_X__c}"/>
            </apex:PageBlockSection>
            <apex:PageBlockSection >
                <apex:commandButton action="{!processMarketoMergeField}" value="Go!">
                     <apex:param name="mergefieldtextparm" value="{!campaign.Marketo_Merge_Field_X__c}" assignTo="{!mergefieldtext}"/>
                </apex:commandButton>
            </apex:PageBlockSection>            
        </apex:pageBlock>
    </apex:form>
</apex:page>
And here is my custom controller:
public class MarketoMergeFieldExtension {
   
    public String mergefieldtext {get;set;}
    private final Campaign c;
    
    public MarketoMergeFieldExtension(ApexPages.StandardController controller) {
        this.c = (Campaign)controller.getRecord();
    }

    public PageReference processMarketoMergeField() {
        system.debug('mergefieldtext: '+mergefieldtext);
       return null;
    }
    
}
Eventhough my picklist field Marketo_Merge_Field_X__c has a value, when I look at my Log, I see:
2:47:01:062 USER_DEBUG [23]|DEBUG|mergefieldtext: null
Thanks in advance.

 
HI,

I have a CSV file which contains both case and case comments. I want to insert both into Salesforce and i need to automate this process to run everyday. I need a parent ID to insert Case Comments which i dont have in my CSV.

Is there a way fullfill my requirement without using Java program?

Thanks,
Ganesh
Hi,
I am using AngularJS to build a page on Salesforce1 mobile app. I have ability for users to upload attachments which are then saved in Attachment object. On Inserting the attachment, I am populating the id of the attachment on the object. Lets call it AttachmentId__c.

Normally ill simply use the '/servlet/servlet.FileDownload?file=' link to generate attachment link.

However, on Salesforce1 this link goes nowhere, it takes the user on the chatter feed and displays error. please login to correct org. 

Is there a way to get ServerURL for Salesforce1? Any pointers appreciated.
Hi Guys,

I would like to create a field on the Oppty object that is called "Next Activity". In this field we need to populate the subject of the next scheduled activity related to the Oppty. I believe this requires an Apex trigger to accomplish this. Can any one help me in writting this trigger. Thanks in advance.

Regards,
Hi Guys

I am facing problem when going to login production org.

I am entering username and password ,after click the login button it is displaying Add a Time-Based Token in details page .can any body tell how to remove this for direct login

i need to select both picklist and save them 

Visual force page
==============


<apex:page controller="ctlDepPickLst" tabStyle="Account">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockButtons >
             </apex:pageBlockButtons>
            <apex:pageBlockSection columns="2">
                <apex:pageblockSectionItem >
                    <apex:outputLabel value="Country"/>
                </apex:pageblockSectionItem>        
                <apex:pageblockSectionItem >                
                    <apex:selectList size="1" value="{!country}">
                        <apex:selectOptions value="{!countries}"/>
                        <apex:actionSupport event="onchange" reRender="a"/>
                    </apex:selectList>                
                </apex:pageblockSectionItem>
                <apex:pageblockSectionItem >
                    <apex:outputLabel value="State"/>
                </apex:pageblockSectionItem>            
                <apex:pageblockSectionItem >
                    <apex:selectList size="1" value="{!state}" id="a">
                        <apex:selectOptions value="{!states}"/>
                    </apex:selectList>
                </apex:pageblockSectionItem>            
            </apex:pageBlockSection>        
        </apex:pageBlock>
        <apex:pageBlock >                            
        </apex:pageBlock>
    </apex:form>
</apex:page>



Custom Controller
------------------------===






public class ctlDepPickLst {
    public String country {get;set;}
    public String state {get;set;}
    public PageReference Save()
    {
        return null;
    }
    

    public List<SelectOption> getCountries()
    {
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('None','--- Select ---'));        
        options.add(new SelectOption('US','United States'));
        options.add(new SelectOption('IN','India'));
        return options;
    } 
    
    public List<SelectOption> getStates()
    {
        List<SelectOption> options = new List<SelectOption>();
        if(country == 'US')
        {       
            options.add(new SelectOption('CO','Colorado'));
            options.add(new SelectOption('NE','Nevada'));
            options.add(new SelectOption('TE','Texas'));
        }
        else if(country == 'IN')
        {       
            options.add(new SelectOption('AP','Andrapradesh'));
            options.add(new SelectOption('TS','Telangana'));
            options.add(new SelectOption('TM','Tamilnadu'));
        }
        else
        {
            options.add(new SelectOption('None','--- Select ---'));
        }      
        return options;
    }       
}
Hi All

I have created a apex class for sending mail.but my requirment is subject line is different for diffrenet object.

mainly i have created this for task object for assining task ,when user assign any task depending on custom object/standard object it will send a mail with proper subject line

for ex

if(acc.Company_Name__c !=null)
        {
         mail.setSubject(    +  acc.Company_Name__c );
         }
      else
mail.setSubject(    'There is no company name' );


i has create like this but its not working.
 
Hi Everyone,

I'm an Admin that hasn't really used code before in Salesforce. I've created a custom button to create a new event record and the code I'm using below (which I obtained elsewhere) isn't working. The record type ID is correct, but I don't know if the code for the button is configured properly. The security permissions for all the users of the record type I beleive are correct. can anybody help??

https://na4.salesforce.com/00U/e?evt6=SubjectGoesHere&what_id={!Account.Id}{!Account.Id}&ent=Event&RecordType=012D00000007NsD

Thanks everyone. You're help would be really appreciated!

Craig
Hi Everyone,

i have created a visualforce page.i have incorporated some css styles to that page.
when i open the page it's loading with salesforce styles, with few second gap its applying css styles.
Can some one tel me how to reduce the time gap or else can i load the page with css sttyles by default.

Regards
Lakshman
 
Dear friends

I've come across to the following error while running a visualforce page:

ResourceEvaluationAfterUpdate: execution of AfterUpdate caused by: System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact salesforce.com about custom indexing. Even if a field is indexed a filter might still not be selective when: 1. The filter value includes null (for instance binding with a list that contains null) 2. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times) Class.AP302_CalculateAverageRanking.calculateAverageRanking: line 44, column 1 Trigger.ResourceEvaluationAfterUpdate: line 45, column 1

The query that pops the error:

list<AggregateResult> resList = new list<AggregateResult> ([Select COUNT(Id) noOfResEval,
SUM(Ranking__c) totalRanking,
ResourceCatalogue__r.ParentResource__c rcaParent,
ResourceCatalogue__r.Name rcaName,
ResourceCatalogue__c rca
From ResourceEvaluation__c 
Where (ResourceCatalogue__c IN:resourceIds 
OR ResourceCatalogue__r.ParentResource__c IN:resourceIds)
AND Ranking__c > 0
AND LastModifiedDate = LAST_N_DAYS:180
group by ResourceCatalogue__c,ResourceCatalogue__r.ParentResource__c
,ResourceCatalogue__r.Name]);

According to this site provided before by salesforce support: 
https://help.salesforce.com/apex/HTViewSolution?urlname=How-can-I-make-my-SOQL-query-selective-And-the-process-to-determine-the-fields-that-can-be-custom-indexed&language=en_US

The query must have at least three filters and at least one of them must be selective, meaning that if it's a standard index should return less than 30% of the total records of the object total records or if it's a custom index less than 10% of the records. 

In this case we have three filters, one of them it's a standard (foreign key) ResourceCatalogue__c, we can consider the query selective as, at least of the three filter is selective, this return 203 from 155386 records. The other two filters are not selective but it shouldn't matter as at least one of them it's selective.

Can you please help us with this problem?

Best Regards,

Roniel
Hi,

i have create a page into Lightning. State and Country Picklist value visible into lightning picklist and select option stored into custom objects.
pls help me out.
 
 
I am new with salesforce, I have an Apex class and I would like to create a test for this class but I have no idea, can someone help me please
public class NouveauProduitExtensions {

    public NouveauProduitExtensions(ApexPages.StandardController controller) {
    }
    
    public PageReference cancel() {
        return Page.Nouveau_produit;
    }
    public JointMatProd__c Jointure {get; set;} 

    public Produit__c prod { get; set; }

    public NouveauProduitExtensions() {
        prod = new Produit__c();
        Jointure = new JointMatProd__c();
    }
    
    public PageReference showAddMatierePage() {
        return Page.Produit_Add_Matiere;
    }
    
    public PageReference Save() {
        insert prod;
        insert Jointure;
        PageReference acctPage = new ApexPages.StandardController(prod).view();

        acctPage.setRedirect(true);

        return acctPage;
    }

     public List<cMatiere> matiereList {get; set;}
     public List<JointMatProd__c> JointList {get; set;}
     public List<MatierePremiere__c> selectedMatieres{get;set;}
     public Integer value {get;set;} 

     public List<cMatiere> getMatieres() 

     {
      if(matiereList == null) {
       matiereList = new List<cMatiere>();
       for(MatierePremiere__c c : [select Id, Name, Unite__c from MatierePremiere__c])
    
       {

       matiereList.add(new cMatiere(c));
       }
      }
      return matiereList;
     }  
    
public PageReference processSelected()

 {
  
   
    selectedMatieres = new List<MatierePremiere__c>();
    JointList = new List<JointMatProd__c>();
    
    for (cMatiere cMat : getMatieres()) {
        if(cMat.selected == true) {
            selectedMatieres.add(cMat.mat);
        }
    }
   value = selectedMatieres.size();
   System.debug('printing listcontc'+selectedMatieres.size());
    
    for (MatierePremiere__c mat : selectedMatieres)
     {
        JointList.add(new jointMatProd__c(Produit__c = prod.id, MatierePremiere__c = mat.id, Quantite__c=0));
    }

   return page.Nouveau_produit;

 }

public class cMatiere

{
 public MatierePremiere__c mat {get; set;}
 public Boolean selected {get; set;}

 public cMatiere(MatierePremiere__c c) {
            mat = c;
            selected = false;
        }
  }


}