+ Start a Discussion
Alden GordonAlden Gordon 
I am attempting to execute a simple SOQL query on objects with two-word names, and it is proving surprisingly difficult. 

The query below works fine:
"select name from user limit 10"

I want to execute something similar on an object called "User Emails" - I know that is the name as it was pulled from the schema builder. However, any simple query on this table fails, no matter what format of the two-word name I try.

For example: 
"select date from user_emails limit 10" 
This fails with the error "Object type 'user_emails' is not supported". This is true of any format of the object name I have tried (useremails, UserEmails, user-emails, etc).

What is the correct way to query these objects? 


 
Best Answer chosen by Alden Gordon
Anurag VermaAnurag Verma
Hi Alden,

You will have to use API name in SOQL to get this work. To get API name for a custom object go to the setup->Build->Create->Objects. Click on the object "User Emails" from the list. Get the "API Name" from there and use that in your SOQL.
Alesha KuhlmanAlesha Kuhlman 
AND(
Or(
(ISPICKVAL(StageName , "9 - Closed/Lost (0%)")),
(Ispickval(StageName, "6 - Closed/Won (100%)"))),
 
ISBLANK(Text( Close__c )), 
 
or(not
($RecordType.Name = "Existing Business Renewal '17",
$RecordType.Name="Service/SOW '17",
$RecordType.Name="Recurring Revenue"))
)
 
Best Answer chosen by Alesha Kuhlman
Sridhar NarayansaSridhar Narayansa
Try this. I switched not and or.

AND(
Or(
(ISPICKVAL(StageName , "9 - Closed/Lost (0%)")),
(Ispickval(StageName, "6 - Closed/Won (100%)"))
),
 
ISBLANK(Text(Close__c )), 
 
not(or
($RecordType.Name = "Existing Business Renewal '17",
$RecordType.Name="Service/SOW '17",
$RecordType.Name="Recurring Revenue"))
)
Best Answer chosen by Michele Toscano
Maharaja CMaharaja C
Hi Michele,

Based on the record type you can do it.

First add all the picklist values in the depedency field for controlling in field depedency.

Then you can modify the pickist values in the record type.

Go to setup -> Build-> Customize-> object-> Record type -> Picklists Available for Editing ->Edit(Pickilist field in the Picklists Available for Editing ) ->save

Change the values (For each record type).

Can you please let me if you want any help?

If it helps choos this as a best answer!!!

Thanks,
Raj
force shahidforce shahid 
Hi Friends,

I write a program on javascript base. When i give the less than 3 letters user name it wil display error msg. But its not working and also F1 is not woking. Please check this code and help me to solve this problem,

Code:


<apex:page >
    <script>
    function f1(uid,pwd){
        var u=document.getElementByid(uid).value;
        var p=document.getElementByid(pwd).value;
        if(u==""){
            alert(' Please enter User name');
            document.getelementbyid(uid).focus();
        }
        else{
            if(u.length<3)
                alert('Please Enter username minimum 3 Characters');
        }
        if(p==""){
            alert('Please Enter Password');
            document.getelementbyid(pwd).focus();
        }
    }
    function f2(uid,pwd){
        document.getelementbyid(uid).value="";
        document.getelementbyid(pwd).value="";
    }
    </script>
    
    <apex:form>
        <apex:pageBlock>
            <apex:pageBlockSection title=" Entry Section">
                <apex:outputText value="Enter User Name"></apex:outputText>
                <apex:inputText id="uid"/>
                <apex:outputText value="Enter Password"></apex:outputText>
                <apex:inputText id="pwd"/>
                
                <apex:commandButton value="Submit" onclick="f1('{!$component.uid}','{!$component.pwd}')"/>
                <apex:commandButton value="CLear" onclick="f2('{!$component.uid}','{!$component.pwd}'"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>
Best Answer chosen by force shahid
Dayakar.DDayakar.D
Hi Shahid,
The problem here is JavaScript is a case-sensitive language. This means that the language keywords, variables, function names, and any other identifiers must always be typed with a consistent capitalization of letters.

User-added image
we should use statement like below 
document.getElementById(uid).value;

Please find below code it will work.
<apex:page >
    <script>
    function f1(uid,pwd){
        var u=document.getElementById(uid).value;
        var p=document.getElementById(pwd).value;
        if(u==""){
            alert(' Please enter User name');
            document.getElementById(uid).focus();
        }
        else{
            if(u.length<3)
                alert('Please Enter username minimum 3 Characters');
        }
        if(p==""){
            alert('Please Enter Password');
            document.getelementbyid(pwd).focus();
        }
    }
    function f2(uid,pwd){
        document.getElementById(uid).value= "";
        document.getElementById(pwd).value= "";
        
    }
    </script>
    
    <apex:form>
        <apex:pageBlock>
            <apex:pageBlockSection title=" Entry Section">
                <apex:outputText value="Enter User Name"></apex:outputText>
                <apex:inputText id="uid"/>
                <apex:outputText value="Enter Password"></apex:outputText>
                <apex:inputText id="pwd"/>
                
                <apex:commandButton value="Submit" onclick="f1('{!$component.uid}','{!$component.pwd}')"/>
                <apex:commandButton value="CLear" onclick="f2('{!$component.uid}','{!$component.pwd}')"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Please let me know, if it helps you.

Best Regards,
Dayakar.D

 
Parthiban SudhamanParthiban Sudhaman 
I wanted to add few design styles in the existing opportunity result grid without using any VF page.
In detail,
1. I need to add a class attribute in the result grid
2. Need to use the static resource which has the style for the class.

Please confirm if this is possible.
Thanks,
 
Best Answer chosen by Parthiban Sudhaman
piyush_sonipiyush_soni
hi Parthiban Sudhaman
you can NOT add CSS for salesforce standred page view. for doing this you must create a custom vf page and add CSS on it .and override your standard page with this vf page
Let me inform if it helps you and kindly mark it best answer if it helps you so it make proper soltuions for others
thanks
http://sfdcmonkey.com
SandrineSandrine 
Hello,

I have a web page which i want be visible from salesforce.

How can i acheive it ?
Best Answer chosen by Sandrine
bob_buzzardbob_buzzard
You want to use Force.com sites - these allow you to create an unauthenticated web site on Salesforce.  The official implementation guide is at:

http://resources.docs.salesforce.com/204/18/en-us/sfdc/pdf/salesforce_platform_portal_implementation_guide.pdf

I wrote a blog series about building a tempalted web site using this technology at :

http://bobbuzzard.blogspot.co.uk/2012/12/building-templated-web-site-with.html

this is the final entry, so you probably want to follow the links at part 1.



 
Best Answer chosen by binal
NagendraNagendra (Salesforce Developers) 
Hi Binal,

The best option you have is to contact salesforce support team for details regarding license renewals.You may reach salesforce support here. For more information on terms of use and renewals of licenses please check with below links. Please mark this as solved if this helps.

Regards,
Nagendra.
Apex developer 21Apex developer 21 
trigger NoteOnContentDocument on ContentDocument (before delete) {
    for (ContentDocument c : Trigger.old){
        List<ContentDocumentLink> links = [
            SELECT LinkedEntityId 
            FROM ContentDocumentLink 
            WHERE ContentDocumentId= :c.Id
        ];
        if (Approval.isLocked(links.get(1).LinkedEntityId)){
            c.addError('Approval pending. You do not have the permission to delete this note, Please contact your administrator.');
           }    
    }
}

 
Best Answer chosen by Apex developer 21
sachin sabusachin sabu
Ok try This
@istest
public class NoteOnContentDocument {
    static testmethod void NoteOnContentDoc(){
   ContentVersion contentVersion = new ContentVersion(
      Title = 'Penguins',
      PathOnClient = 'Penguins.jpg',
      VersionData = Blob.valueOf('Test Content'),
      IsMajorVersion = true
    );
    insert contentVersion;

    List<ContentDocument> documents = [SELECT Id, Title, LatestPublishedVersionId FROM ContentDocument];
        try{
            delete documents;
        }
        catch(exception e){}
      
  }
}

 
ScottBScottB 
Hi, this code is functional but I think that it needs to be bulkified and improved. Can anyone provide a rewrite using best practices please? Thanks in advance!
 
trigger Results on Results__c (before insert, before update) {
    
    for (Results__c res : Trigger.new) {
        if (res.Name == '4'){
            
            List<Game__c> game = [SELECT Fourth_Place_Award__c
                                 FROM Game__c WHERE Id = :res.Game__c];
            	
            for(Game__c g : game){
                            If (g.Fourth_Place_Award__c == 0)
                            			{
                						res.Bubble__c = TRUE;
            							}
            						}

            				}
            
        }
        
    }

 
Best Answer chosen by ScottB
UC InnovationUC Innovation
Hi Scott,

The only thing I can see that is problematic with your code here is the use of a SOQL query inside of a for loop. This is a pretty big issue if you wish to bulkify code.

Consider the scenario that you are updating 201 Results__c records that all have the name '4'. You will hit a governor limit on the last record and see an error. For more information conscerning governor limits check this link (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_gov_limits.htm). Anyway, with that in mind I went ahead and made some changes to your code and added comments to guide you through it. Added some personal touches as well which you may or may not find useful in future codings.
 
trigger Results on Results__c (before insert, before update) {  
    // Only looking for results that have the name '4' so this list should be
	// at most the same size as the original trigger list.
	// To bulkify this trigger we will need to look through 
	// Trigger.New twice.
	List<Results__c> fourList = new List<Results__c>(); 
		
	// We want to store the Id of the games we wish to query for 
	// instead of querying for every game. This keeps our SOQL
	// count to a minimum.
	Set<Id> gameIdSet = new Set<Id>();
	
	// First look: fill the containers
	for (Results__c result : Trigger.new) {
		if (result.Name.equals('4')){	
			fourList.add(result);
			gameIdSet.add(result.Game__c);
		}
	}
	
	// One query instead of many. Governor limits in mind.
	Map<Id, Game__c> gameMap = new Map<Id, Game__c>([SELECT Fourth_Place_Award__c
													 FROM Game__c 
													 WHERE Id IN :gameIdSet])
	
	// Second look: record results.
	for (Results__c result : fourList) {	
		if (gameMap.get(result.Game__c).Fourth_Place_Award__c == 0) {
			result.Bubble__c = TRUE;
		}
    }       
}

Hope this helps! Good luck and if you have any further questions feel free to ask away.

AM
Dennis Borders 3Dennis Borders 3 
Hi, am getting "Syntax error. Missing ')' on this validation rule but can't see what I'm doing wrong - any help greatly appreciated, thanks!

 AND(  
    ISPICKVAL (Case_Category__c, "Other" ),  
    ISBLANK("Other" Category )
    )
Best Answer chosen by Dennis Borders 3
Akhil AnilAkhil Anil
Hi Dennis,

Your formula would be something like this
 
AND(  
    ISPICKVAL (Case_Category__c, "Other" ),  
    ISBLANK(Other_Category__c)
    )

Use the insert field option to use the right API name of the field in the ISBLANK function. 

Kindly mark it as an answer if that resolves your issue.