• rotfil
  • NEWBIE
  • 46 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 8
    Questions
  • 13
    Replies
I have a stage that I need to validate against a note on the Lead object.

Note

So what needs to happen:

- A user adds a note (anything!)
- Then I can make the first stage as complete otherwise

Is this a validation rule or a trigger - and how would I go about either?

Thanks,
James
  • January 16, 2018
  • Like
  • 0
I have an example class I've just created for illustravive purposes that updates an acount name via a remote action.

I need to be able to write a test class to cover it, and it also needs to contain a system assert/assertequals?

I have written the test class but how do I cover it with a system assert?

Method:
@RemoteAction
global static void updateAccountName (String supplierId, String newName) {

    Account acc = [Select Id, Name From Account Where Id = : supplierId];

    acc.name = newName;
    
    update acc;

}
Test class:
@isTest
public class updateSupplierTest { 

	static testMethod void test () {

        updateAccount con = new updateAccount();

    	//Create an Account
        List<Account> accts = new List<Account>();
        Account b = new Account(Name='Test Buyer',type = 'Account');
        accts.add(b);
        insert accts;

        //Remote actions
        updateAccount.updateAccount(r.id, 'New Account Name');
        System.assertEquals(????); 

    }

}

Thanks
 
  • November 06, 2017
  • Like
  • 0
Like you mighta static resource i.e. {!$Resource.resource_name}

How would you do this with a document stored in the Document Tab object? {!$Document.doc_name}

I would rather not include a direct link with document id - doesn't that change from Sandbox to Production?
  • March 06, 2017
  • Like
  • 0
<apex:repeat var="fruit" value="{!fruit}" id="fruit">

	<select class="form-control" id="fruit">

		<option value="Apple" {!IF(fruit.fruit__c=='apple','selected','')}>Apple</option>

	</select>

</apex:repeat>
All I want to do is put the following like of code

{!IF(fruit.fruit__c=='apple','selected','')} into a select option but oh no:

Element type "option" must be followed by either attribute specifications, ">" or "/>

Rubbish - how can I create a work around for this?
 
  • September 26, 2016
  • Like
  • 0
I am new to salesforce and given the documentation I am at a loss of where to start! If someone could write a test class for the following piece of code that would be most handy. I have simplified the method. I don't quite understand the 100% code coverage. I saw another post write something that didn't really make a whole bunch of sense.
 
public static string getJsonListOfAccounts () {

        String searchName = Apexpages.currentPage().getParameters().get('name');  

        String searchType = Apexpages.currentPage().getParameters().get('type');

        List<Account> listOfAccounts = new List<Account>();
       
        if (searchType == 'yes') {

            jsonListOfAccounts = [SELECT Id, Name, SummitElse from Account where example__c =: 'yes' AND Name like : '%'+ searchString +'%']; 

        } else {

            jsonListOfAccounts = [SELECT Id, Name from Account where example__c =: 'no' AND Name like : '%'+ searchString +'%']; 

        }
       
        return JSON.serializePretty(jsonListOfAccounts);

    }

 
  • September 21, 2016
  • Like
  • 0
How would I go about writing a test class for the following simplified class method?

    public static string getJsonListOfAccounts () {

        String searchName = Apexpages.currentPage().getParameters().get('name');  

        String searchType = Apexpages.currentPage().getParameters().get('type');

        List<Account> listOfAccounts = new List<Account>();
       
        if (searchType == 'yes') {

            jsonListOfAccounts = [SELECT Id, Name, SummitElse from Account where example__c =: 'yes' AND Name like : '%'+ searchString +'%'];

        } else {

            jsonListOfAccounts = [SELECT Id, Name from Account where example__c =: 'no' AND Name like : '%'+ searchString +'%'];

        }
       
        return JSON.serializePretty(jsonListOfAccounts);

    }
  • September 21, 2016
  • Like
  • 0
Developing a site in muliple langauges using visualforce and I am using Custom Labels. If there is a better way to manage lanugage translations do divulge the secret...

So I have created a custom label under setup > custom labels

{!$Label.idiots}

You must fill out the form correctly <b>stupid customer</b>!

This is the label. I need the customer to know how silly they are by putting it in bold. Any ideas?
 
  • August 04, 2016
  • Like
  • 0

When a new note is created in Opportunity I simply have to change / hardcode the value to 'Sales Opportunity'.

Do I need to build a trigger for this? If so how would I build a trigger to target the creation of this new note? Or is there an easier way to achieve this.

Thanks

Getting this error when I try to add my Towermaps to a new app builder page:
User-added image

Here are the codes I have based on the trailhead exercise:

TowerMapUtilClass:
public inherited sharing class TowerMapUtilClass {
     public static List<sObject> queryObjects(String theObject, List<String> theFields, String theFilter, String sortField, String sortOrder) {
          String theQuery = 'SELECT ' + string.join(theFields, ',');
          theQuery += ' FROM ' + theObject;
          if(!String.isEmpty(theFilter)) {
               theQuery += ' WHERE ' + theFilter;
          }
          if(!String.isEmpty(sortField)) {
               theQuery += ' ORDER BY ' + sortField;
               if(!String.isEmpty(sortOrder)) {
                    theQuery += ' ' + sortOrder;
               }
          }
          return database.query(theQuery);
     }


TowerMapControllerClass:
public inherited sharing class TowerMapControllerClass {
     @AuraEnabled
     public static List<Tower__c> getAllTowers() {
          String theObject = 'Tower__c';
          List<String> theFields = new List<String>{'Id', 'Name', 'State__r.Name', 'Tower_Location__Latitude__s', 'Tower_Location__Longitude__s'};
          String theFilter = '';
          String sortField = 'Name';
          String sortOrder = 'ASC';
          List<Tower__c> allTowers = TowerMapUtilClass.queryObjects(theObject, theFields, theFilter, sortField, sortOrder);
          return allTowers;
     }
Towermap:
<aura:component implements="flexipage:availableForAllPageTypes" controller="TowerMapControllerClass" access="global" >
     <aura:attribute name="mapMarkers" type="Object" access="PRIVATE" />
     <aura:attribute name="markersTitle" type="String" access="PRIVATE" />
     <aura:handler name="init" value="{!this}" action="{!c.handleInit}"/>
     <aura:if isTrue="{!!empty(v.mapMarkers)}" >
          <lightning:map mapMarkers="{!v.mapMarkers}" markersTitle="{!v.markersTitle}" zoomLevel="5"/>
 
     </aura:if>
</aura:component>

Towermap Controller:
({
     handleInit: function (component, event, helper) {
          helper.initHelper(component, event, helper);
     }
})
Towermap Helper:
({
     initHelper : function(component, event, helper) {
          helper.utilSetMarkers(component, event, helper);
     },
     utilSetMarkers : function(component, event, helper) {
          let action = component.get("c.getAllTowers");
          action.setCallback(this, function(response) {
               const data = response.getReturnValue();
               const dataSize = data.length;
               let markers = [];
               for(let i=0; i < dataSize; i += 1) {
                    const Tower = data[i];
                    markers.push({
                        'location': {
                             'Latitude' : Tower.Tower_Location__Latitude__s,
                             'Longitude' : Tower.Tower_Location__Longitude__s
                        },
                        'icon': 'utility:Tower',
                        'title' : Tower.Name,
                        'description' : Tower.Name + ' Tower Location at ' + Tower.State__r.Name
                   });
               }
               component.set('v.markersTitle', 'Out and About Communications Tower Locations');
               component.set('v.mapMarkers', markers);
          });
          $A.enqueueAction(action);
     }
})

I also created the cutom object Tower.

Anyone know where my break is?

Thanks!

Erin
I have an example class I've just created for illustravive purposes that updates an acount name via a remote action.

I need to be able to write a test class to cover it, and it also needs to contain a system assert/assertequals?

I have written the test class but how do I cover it with a system assert?

Method:
@RemoteAction
global static void updateAccountName (String supplierId, String newName) {

    Account acc = [Select Id, Name From Account Where Id = : supplierId];

    acc.name = newName;
    
    update acc;

}
Test class:
@isTest
public class updateSupplierTest { 

	static testMethod void test () {

        updateAccount con = new updateAccount();

    	//Create an Account
        List<Account> accts = new List<Account>();
        Account b = new Account(Name='Test Buyer',type = 'Account');
        accts.add(b);
        insert accts;

        //Remote actions
        updateAccount.updateAccount(r.id, 'New Account Name');
        System.assertEquals(????); 

    }

}

Thanks
 
  • November 06, 2017
  • Like
  • 0
Like you mighta static resource i.e. {!$Resource.resource_name}

How would you do this with a document stored in the Document Tab object? {!$Document.doc_name}

I would rather not include a direct link with document id - doesn't that change from Sandbox to Production?
  • March 06, 2017
  • Like
  • 0
<apex:repeat var="fruit" value="{!fruit}" id="fruit">

	<select class="form-control" id="fruit">

		<option value="Apple" {!IF(fruit.fruit__c=='apple','selected','')}>Apple</option>

	</select>

</apex:repeat>
All I want to do is put the following like of code

{!IF(fruit.fruit__c=='apple','selected','')} into a select option but oh no:

Element type "option" must be followed by either attribute specifications, ">" or "/>

Rubbish - how can I create a work around for this?
 
  • September 26, 2016
  • Like
  • 0
How would I go about writing a test class for the following simplified class method?

    public static string getJsonListOfAccounts () {

        String searchName = Apexpages.currentPage().getParameters().get('name');  

        String searchType = Apexpages.currentPage().getParameters().get('type');

        List<Account> listOfAccounts = new List<Account>();
       
        if (searchType == 'yes') {

            jsonListOfAccounts = [SELECT Id, Name, SummitElse from Account where example__c =: 'yes' AND Name like : '%'+ searchString +'%'];

        } else {

            jsonListOfAccounts = [SELECT Id, Name from Account where example__c =: 'no' AND Name like : '%'+ searchString +'%'];

        }
       
        return JSON.serializePretty(jsonListOfAccounts);

    }
  • September 21, 2016
  • Like
  • 0

When a new note is created in Opportunity I simply have to change / hardcode the value to 'Sales Opportunity'.

Do I need to build a trigger for this? If so how would I build a trigger to target the creation of this new note? Or is there an easier way to achieve this.

Thanks

A little background on me- I'm currently not a Salesforce Admin... I'm in a field unrealted to IT.  I'm trying to pass the Salesforce Certified Admin 201 test so that I may possibly get a job as a Jr Admin somewhere. I failed my 1st attempt at the 201 exam and am not confident enough at this point to take it again.  Since I don't have the luxury of having practical Admin experience, I've been learning on my own in Dev Orgs with online learning materials.  Here are the things I've studied/completed:
- SFDC Admin Trails (and other trails except developer)
- Focus on Force (Study Guide and 201 practice exams) http://focusonforce.com/
- Admin Zero to Hero http://www.adminhero.com/zero-hero/
- Udacity Salesforce Training: https://www.udacity.com/course/intro-to-point-click-app-development--ud162
- Salesforce Fundamentals https://developer.salesforce.com/docs/atlas.en-us.fundamentals.meta/fundamentals/
- Salesforce CRM Definitive Handbook: https://play.google.com/store/books/details/Paul_Goodey_Salesforce_CRM?id=POfBGSjfaikC

I just discovered the "How to Be Successful with Salesforce" handbook, however it's over 5300 pages, so I'm wondering if diving into this is the right thing to do or if I'll just get lost in minutia.  Here's the link: http://resources.docs.salesforce.com/198/13/en-us/sfdc/pdf/sf.pdf

I completed the Admin Trails before any other training materials, so I'm going to re-do them in a new Dev Org to see if I retain more.

If there are any other study resources that will help me pass the 201, please let me know.  I understand that most Admins take this test after being on the job for several months, but I don't have that option as I don't think I'll be able to get an Admin job without being certified since I have no IT experience and no previous experience as an Admin .

Thanks,

Chris
I've got my setSSKU() function setup to fire on the Model field, but I can't get my code to set the values on the Model and SKU(
<apex:inputField id="SSKU" value="{!objCase.Sensor_SKU__c}"/>
) fields. This code workw the the <apex:form> tag not sure why it's not working on this page.

JS
function setSSKU(){ var SSKUE = document.getElementById('{!$Component.pbMainLumidigm:SSKU}'); var model = document.getElementById('{!$Component.pbMainLumidigm:LuModel}').value; if(model=='M-Series'){ for(i=0; i < SSKUE.options.length; i++){ if(SSKUE.options[i].text.indexOf('V') >= 0){ SSKUE.options[i].style.display = 'none'; } if(SSKUE.options[i].text.indexOf('M') >= 0){ if(SSKUE.options[i].style.display == 'none'){ SSKUE.options[i].style.display ='block'; } } } } if(model=='V-Series'){ for(i=0; i < SSKUE.options.length; i++){ if(SSKUE.options[i].text.indexOf('M') >= 0){ SSKUE.options[i].style.display = 'none'; } if(SSKUE.options[i].text.indexOf('V')>=0){ if(SSKUE.options[i].style.display =='none'){ SSKUE.options[i].style.display = 'block'; } } } } }




Visualforce
<apex:pageBlock id="pbMainLumidigm" title="Case Edit" rendered="{!IsLumidigmRecType}"> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!saveCase}" onclick="return validateChannelPartner();"/> <apex:commandButton value="Save & Close" action="{!saveAndCloseCase}" onclick="return validateChannelPartner();"/> <apex:commandButton value="Cancel" immediate="true" action="{!cancelCase}"/> </apex:pageBlockButtons> <apex:pageBlockSection id="pbsFirst" title="Case Information" > <apex:pageBlockSectionItem > <apex:outputLabel value="Parent Case"></apex:outputLabel> <apex:inputField value="{!objCase.ParentId}"/> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:pageBlockSection> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:outputLabel value="Product"/> <apex:inputField required="true" value="{!objCase.Product__c}"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:outputLabel value="Model"></apex:outputLabel> <apex:inputField id="LuModel" required="true" value="{!objCase.Model__c}" onchange="setSSKU()"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > </apex:pageBlockSectionItem> <apex:pageBlockSectionItem rendered="{!isRCNHRecType || ispivCLASS}"> <apex:outputLabel value="OS Language"/> <apex:inputField value="{!objCase.OS_Language__c}"/> </apex:pageBlock>

 

Hi,

 

I have created a input box and a link. When I click on the link, an alert will show the value of the input box. But this is not happening as of now, Please suggest the code changes. Thanks!

 

<apex:page id="pa">
 <apex:includeScript value="{!$Resource.jQuery}"/>
 <script type="text/javascript">
         var j$ = jQuery.noConflict();
         
         j$(document).ready(function(){
             j$("a").click(function(){
            var xyz = j$("#pa:f1:userInput").val();
            //var xyz = document.getElementById('{!$Component.pa.f1.userInput}').value;
             alert(xyz);
             });
        });         
  </script>

  <a herf="#" id="clickHere">click here</a>
  <apex:form id="f1">
      enter something <apex:inputText id="userInput"/>  
  </apex:form>
</apex:page>

 Thanks

Sam

 

 

Hi there,

I need to develop a site in multiple languages using custom labels, but I found HTML tags in custom labels display as plan text, please advise, thanks alot!

Hi,

 

I am trying to dynamically assign the language in a visualforce page based on the User's language defined in the personal information. Right now it is hard coded as

 

 

<apex:page language="fr" >.

...

 

</apex:page>

 

Is it possible to achieve this via global variables without the use of a custom controller ? Alternatively can we leverage Custom Settings to achieve this.

 

Thanks

Atirath