Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Questions relating to Apex, the native programming language for the Force.com platform. Use it for general questions on syntax, errors, constructs, and rules of use. Most questions should include a code *excerpt* to help answerers understand specifically what has gone wrong or why you need help.
3
votes
SOQL Dynamic Query building using Map.get(List)
Try this
Map<String, List<String>> acntIdMap = new Map<String, List<String>>{'ids' => accountIds};
String key = 'ids';
List<String> keys = acntIdMap.get(key);
query = ' Select ID, Name From Account W …
3
votes
1
answer
2k
views
What is the minimum length of SOSL search expression
While performing SOSL for one character I got exception
"search term must be longer than one character", with more than one characters query is working fine.
Is there any document from Salesforce wh …
3
votes
2
answers
4k
views
How to get list of Objects Master detail with account
I want to get a list of all Custom Object which are master detail with Account object. how can i get it with SQQL or through Apex.
Thanks …
2
votes
2
answers
3k
views
OpportunityLineItem in test classes
I am trying to insert OpportunityLineItem record in my test class but unable to insert.
Account acc = new Account(Name = 'Test');
insert acc;
Opportunity oppObj = new Opportunity(Name = 'TestOpp',Ac …
2
votes
1
answer
5k
views
Uploading files to SFDC attachment object using REST call
I have requirement to upload files to SFDC attachments object.
I am making REST call from my Java code to SFDC with required details.
curl -X POST \
https://ap.salesforce.com/services/data/v29.0/so …
2
votes
Whenever I run the test class I see this error: "Apex Error: Field is not writeable"
To insert priceBookEntry you can use below code
Product2 newProd = new Product2(Name = 'test product', family = 'test family');
insert newProd;
PriceBookEntry pbEntry = new PriceBookEn …
1
vote
Validation Rule To Allow Only One Checked Record
You can check like this
List<Object__x> objList = [SELECT ID,Activate__c WHERE Activate__c = true];
if(objList.size()>0){
here you can insert new record in Object__x
}
1
vote
Delete Apex Job submitted by User
List<AsyncApexJob> lstJobs = [SELECT Id FROM AsyncApexJob WHERE Status = 'Queued' AND CreatedById = : userId];
for(AsyncApexJob job : lstJobs) {
try {
System.abortJob(job.Id);
} catch(Exce …
1
vote
Accepted
Number of times contacted/Viewed
You can try this :
trigger ContactedRecord on Lead (before insert, before update) {
for(Lead li : Trigger.new) {
li.No_of_Times_Contacted__c = li.No_of_Times_Contacted__c!=null ? li.N …
1
vote
Accepted
Restrict Field from other Children
Can you try below trigger
trigger validate on Contact(before insert){
SET<String> ids = new SET<String>();
for(contact c : trigger.new){
ids.add(c.AccountId);
}
…
1
vote
0
answers
56
views
How to check whether an org is beta org or Managed package org
isPackageInstance() helps us to differentiate between dev and beta/Managed package org but I am unable to distinguish between Beta and Managed package org.
0
votes
0
answers
402
views
FIELD_INTEGRITY_EXCEPTION Read All on account
While assigning permission to objects i am getting FIELD_INTEGRITY_EXCEPTION,The user license doesn't allow the permission: Read All Account: []
What is this Read All and how to solve this error.
0
votes
2
answers
454
views
Call Duration field of Task object throwing error Illegal assignment from Double to Integer
I am parsing all the number fields as Double.valueOf(value) and storing in Task fields. If the value is Integer then the result of Double.valueOf(value) will be value.0 which is obvious.
This case i …
0
votes
1
answer
4k
views
Delete multiple records using REST Api
I am trying to delete multiple records using REST Api.
using below url https://xxx.salesforce.com/v43.0/composite/sobjects?ids=00P0K000016YabaUAG,00P0K000016YabaUAG
but in response I am getting 405 …
0
votes
Need test class for this method
Can you put Community URL in any class level public variable and then compare in your if statement. This will help you setting community URL from test class and you can move inside the if block.