Skip to main content
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
Results tagged with
Search options not deleted user 10491

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.

-1 votes

How to Reference Other Classes in Apex, like a typical Java import statement

You can download and package it and install in you Salesforce org using this you can communicate between two code base, yours and packaged.
San's user avatar
  • 488
0 votes

Lead Status set to closed

trigger testTrigger on Account (before insert, before update) { List<String> company = new List<String>(); List<String> website = new List<String>(); for(Lead com : trigger.new){ …
San's user avatar
  • 488
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 }
San's user avatar
  • 488
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 …
San's user avatar
  • 488
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 …
San's user avatar
  • 488
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.
San's user avatar
  • 488
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); } …
San's user avatar
  • 488
0 votes

In use Field Restriction Trigger

Can you try this: trigger validate on Contact (before update) { SET<String> ids = new SET<String>(); for(contact c : trigger.new){ ids.add(c.AccountId); …
San's user avatar
  • 488
0 votes
1 answer
592 views

Default value is null always,Schema.DescribeFieldResult [duplicate]

I am trying to describe a field and get the default value but the following always outputs null. Schema.DescribeFieldResult dfr = Account.SLASerialNumber__c.getDescribe(); system.debug('res '+dfr.get …
San's user avatar
  • 488
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 …
San's user avatar
  • 488
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.
San's user avatar
  • 488
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 …
San's user avatar
  • 488
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 …
San's user avatar
  • 488
0 votes

Automatically map Account Look up field on Lead in Salesforce

trigger AccName on Lead (before insert, before update) { List<String> leadCompanyNames = new List<String>(); Map<String, Id> matchingAcctNames = new Map<String,Id>(); for (Lead newLead : t …
San's user avatar
  • 488
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 …
San's user avatar
  • 488

15 30 50 per page