-
ChatterFeed
-
18Best Answers
-
0Likes Received
-
0Likes Given
-
1Questions
-
165Replies
Trigger help,Campaign Member Status
trigger ai_WebToCaseLead on Case (after insert) { List<CampaignMember> listCm = [SELECT Id,Lead.Email,CampaignId FROM CampaignMember WHERE CampaignId = '701190000001F5l']; for(Case caso : Trigger.new){ System.debug('caso'); for(CampaignMember cm : listCm){ System.debug('caso'); if(cm.Lead.Email == caso.SuppliedEmail && caso.ChaveCampanha__c == '701190000001F5l'){ cm.Status = 'Respondido'; caso.ParentId = cm.Lead.Id; update cm; update caso; System.debug(cm); System.debug(caso); } } } }
Regards!
Lucas
- SolidLucas
- June 30, 2015
- Like
- 0
- Continue reading or reply
Explain the syntax of Apex: ! , $, ", {, (, Etc.
I've gotten by largely by modding existing free GitHub and forum provided code.
But I've still got basic questions regarding what some of these symbols mean and when they are used.
For example: the ! sign.
The $ sign (I think is to call universal components, as I've used it in the $User context).
The " should convey direct text, but I'm not so sure.
The { and the ( are pretty interchangeable to me, but I know that that can't be right. When would you use one over the other?
Any other advice much appreciated.
- Matt Folger
- September 16, 2014
- Like
- 0
- Continue reading or reply
Ascending Order for a User-Generated SOQL query
- Matt Folger
- September 16, 2014
- Like
- 0
- Continue reading or reply
Display values in two columns
Can anyone tell me how to display the 10 values in two column?
my code:
<apex:pageBlock title="My Contact">
<apex:pageBlockTable value="{!account.Contacts}" var="item" columns="2">
<apex:column value="{!item.name}"/>
</apex:pageBlockTable>
The above code display in one coumn
Please Help!
- SS Karthick
- August 22, 2014
- Like
- 0
- Continue reading or reply
newbie apex code question
basically, the trigger automatically changes the stage of the opportunity depending on actions the sales rep are doing (calling, sending emails, receiving prospects in the sales office)
so here's the deal.
existing code :
if (e.Type != null && e.Type == 'Walk-In')
walkin++;
id like to modify it so the walkin+++ occurs not only when there is a event named ''walk-in", but also for all those containing "Meeting".
the event type "walk-in" is for when a prospect visits a sales office unnanounced. we added 1st meeting, 2nd meeting, 3rd meeting, 4th+ meeting as event types to log when the prospects visits after they have talked to a sales rep.
so i guess something like
If (e.Type !=null && (e.Type == ‘Walk-In’ || e.Type.contains(‘Meeting’))
Walkin++
??
thanks for the help, i'm new at apex development and it's a bit overwhelmong at first.
since i'm modifying an existing trigger, can i just change it in the dev console and save?
thank you!
- Gab Silvermotion
- April 07, 2014
- Like
- 0
- Continue reading or reply
Finding the latest SystemModStamp
"how to write a query to find the most recent SystemModStamp on object".
- Dinesh1617
- April 04, 2014
- Like
- 0
- Continue reading or reply
OnClick Javascript custom button creating Tasks
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
var t = new sforce.SObject("Task");
t.OwnerId = '{!Custome_Object.User_Id}';
t.Subject = "Task With Jscript";
...
t.What = '{!Custome_Object.Id}';
var result = sforce.connection.create([t]);
if(result[0].getBoolean("success")){
window.location = "/" + result[0].id;
}else{
alert('Could not create record '+result);
}
I can't figure out how to set the t.What (Related To) field. I get the following error:
{errors:{message:'The external foreign key reference does not reference a valid entity: What', statusCode:'INVALID_FIELD', }, id:null, success:'false', }
My searches tuned out nothing. :(
Any suggestion would be appreciated.
btw, I don't want to use the URL hack or the URLFOR function.
Thank you
- DeLi
- March 30, 2014
- Like
- 0
- Continue reading or reply
Not Pulling the Right Value
Any ideas how to get the max value?
<pre>
trigger Update_Latest_Enrollment_Date_v02 on SD_Mbr_Enroll_Cycles__c (after insert, after update) {
Map<id,SD_Member__C> SDM = New Map<id,SD_Member__C>();
List<id> sdId = New List<id>();
For (SD_Mbr_Enroll_Cycles__c sdec : Trigger.new) {
sdid.add(sdec.SD_Member_Stakeholders__c);}
System.debug(sdid);
SDM = New Map<id,SD_Member__C>([Select Id, Name, Enrollment_Date_Latest_OnTrak__c,
(select SD_Member_Stakeholders__c, Enrollment_Status__c, Enrollment_Status_Date__c
From SD_Mbr_Enroll_Cycles__r
Where Use_Me__c = True
and Enrollment_Status__c = 'Enrolled'
ORDER BY Enrollment_Status_Date__c DESC LIMIT 1)
From SD_Member__c
Where ID IN : sdid ]);
For(SD_Mbr_Enroll_Cycles__c EC: Trigger.new){
SD_member__c sd1 = sdm.get(ec.SD_Member_Stakeholders__c);
sd1.Enrollment_Date_Latest_OnTrak__c = ec.Enrollment_Status_Date__c;
System.debug(ec.Enrollment_Status_Date__c);
}
Update sdm.values();
}
</pre>
- Todd B.
- March 03, 2014
- Like
- 0
- Continue reading or reply
Need RegEx to replace 1234567890 with (123) 456-7890
I can do it in PHP like this:
if( preg_match( '/^\d(\d{3})(\d{3})(\d{4})$/', $data, $matches ) )
{
$result = '('.$matches[1] . ') ' .$matches[2] . '-' . $matches[3];
return $result;
}
- MoreThanWYSIWYG
- February 28, 2014
- Like
- 0
- Continue reading or reply
Record type issue
i dont have any workflow or trigger active for this
- dasari123
- February 18, 2014
- Like
- 0
- Continue reading or reply
Apex Trigger To Update Opportunity Owner ID Based On Picklist Value
I am attemping to write a simple Apex Trigger that updates the owner ID based on a picklist value.
Picklist contains the aliases of our account managers and based on this I want to update the owner ID on insert.
Reason for this is because we have administrators entering opportunities and it will save them time rather than having to create the record then change it owner.
I have the following:
trigger UpdateOwnerID on Opportunity (after insert) {
for (Opportunity objOpportunity : Trigger.new)
{
if (objOpportunity.Owner.Alias <> objOpportunity.Account_Manager__c)
{
objOpportunity.Owner.Alias = objOpportunity.Account_Manager__c;
}
}
}
But I keep getting this error:
Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger UpdateOwnerID caused an unexpected exception, contact your administrator: UpdateOwnerID: execution of AfterInsert caused by: System.NullPointerException: Attempt to de-reference a null object: Trigger.UpdateOwnerID: line 7, column 1
Any help would be appreciated.
Thanks
- Jiriteach
- February 17, 2014
- Like
- 0
- Continue reading or reply
Visualforce Save Command Button Redirect
Here is my VF page code
<apex:page standardController="Lead" recordSetVar="leads" id="thePage" showHeader="true" sidebar="false" extensions="extContactApprovalPage" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!leads}" var="l">
<apex:column >
<apex:outputField value="{!l.Name}"/>
<apex:facet name="header">Registrant Name</apex:facet>
</apex:column>
<apex:column >
<apex:outputField value="{!l.Approve_Picklist__c}"/>
<apex:facet name="header">Approve Picklist</apex:facet>
</apex:column>
<apex:column >
<apex:outputField value="{!l.Approve_Checkbox__c}"/>
<apex:facet name="header">Approve Checkbox</apex:facet>
</apex:column>
<apex:inlineEditSupport event="onClick" showOnEdit="saveButton, cancelButton"/>
</apex:pageBlockTable>
<apex:pageBlockButtons >
<!--<apex:commandButton value="Edit" action="{!save}" id="editButton" />-->
<apex:commandButton value="Save" action="{!save}" id="saveButton" reRender="none" />
<apex:commandButton value="Cancel" action="{!cancel}" id="cancelButton" />
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
<!-- Begin Default Content REMOVE THIS -->
<h1>Congratulations</h1>
This is your new Page: ContactApprovalPage
<!-- End Default Content REMOVE THIS -->
</apex:page>
and here is my extension:
public class extContactApprovalPage {
public extContactApprovalPage(ApexPages.StandardSetController controller) {
}
public PageReference save(){
PageReference reRend = new PageReference('/003');
return reRend;
}
}
Any assistance would be great thanks.
- ericmonte
- February 04, 2014
- Like
- 0
- Continue reading or reply
Validation Rule Help Please
This validation rule works as is. Does not limit department. Only requires we pick from reason lost/dead picklist if opportunity stage is dead/lost.
AND (
OR (
ISPICKVAL( StageName, "Closed Lost"),
ISPICKVAL( StageName, "Dead")),
ISPICKVAL( Reason_Lost_or_Dead_2__c , ""))
Tried adding department picklist to this and it doesn't work the way it should. Networks and Distribution need to follow the validation rule, the others don't need to worry about it. It's times like this I wish I had Enterprise.
AND(
ISPICKVAL( Reason_Lost_or_Dead_2__c , ""),
AND(
OR(
ISPICKVAL( CCI_Division_Region__c ,"CCI Networks"),
ISPICKVAL( CCI_Division_Region__c ,"CCI Distribution"),
AND(
OR (
ISPICKVAL( StageName, "Closed Lost")),
ISPICKVAL( StageName, "Dead")))))
Any assistance is appreciated. Thank you.
- KimberlyJ
- February 04, 2014
- Like
- 0
- Continue reading or reply
custom VisualForce page for task
I've tried all sorts of things hobbled together from research online, but so far, no luck.
(I'm a newbie at VF and apex)
Here's my current VF Page code:
<apex:page standardController="Task" extensions="extension_task">
<apex:form >
<apex:pageBlock mode="edit">
<apex:pageblockButtons >
<apex:commandButton value="Save" action="{!save}" />
</apex:pageblockButtons>
<apex:pageBlockSection title="Quick Edits" columns="1">
<apex:inputField value="{!Task.Whatid}"/>
<apex:inputField value="{!Task.Subject}"/>
<apex:inputField value="{!Task.Representative__c}"/>
<apex:inputField value="{!Task.Category__c}"/>
<apex:inputField value="{!Task.Comments__c}" style="width:400px; height:200px"/>
<apex:inputField value="{!Task.Perceived_Call_Value__c}"/>
<apex:inputField value="{!Task.Referred_To__c}"/>
<apex:inputField value="{!Task.Interaction__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Here's the apex class extension:
public class extension_task{
Task task = new Task();
public extension_task(ApexPages.StandardController controller) {
this.task = (Task)controller.getRecord();
}
}
**************************
I think a problem is that Task cannot be used as a StandardController. I tried setting the StandardController="ACA_Member__c", but that gives me an error (Error: Unknown property 'ACA_Member__cStandardController.Task'). It seems I should be able to use my custom object with standardController based on this page (http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_std_associate.htm).
Thanks any advance for any help!
- megmooPDX
- February 04, 2014
- Like
- 0
- Continue reading or reply
Can i use workflow to update lookup field
- ai501.3910110299805757E12
- January 30, 2014
- Like
- 0
- Continue reading or reply
Referencing Account Field
The below comes up with 'Error: Invalid field ShippingAddress for SObject Account'
<apex:outputtext Value="Address: {!Contact.account.ShippingAddress}"/>
But when i use a custom field such as NOC__c instead of ShippingAddress it works fine!!
Please help
- Bryn Jones
- January 26, 2014
- Like
- 0
- Continue reading or reply
Adding cancel button Test
I have recently added a cancel button to a record creation page running with an extension. The extension currently is used for saving and cloning, I placed a cancel method into the extension, but I am not sure how to test for it. My test code tests every one of my custom object save and clone buttons, how do I add a test for a cancel method.
My extension with new method Added highlighted:
public class extSaveSerButton {
public Service__c ser {get;set;}
public extSaveSerButton(ApexPages.StandardController controller) {
this.ser = (Service__c)controller.getRecord();
}
Public PageReference saveDestinyService(){
if(System.currentPageReference().getParameters().get('clone') == '1'){
//Set record id to null
ser.Id = null;
}
insert ser;
// Send the user to the detail page for the new account.
PageReference pageRef= new PageReference('/apex/DestinyAccount?id='+ser.account__c+'&Sfdc.override=1');
pageRef.getParameters().put('tab','Destiny Services');
return pageRef;
}
Public PageReference cancelDestinyService(){
PageReference pageRef = new PageReference('/apex/DestinyAccount?id='+ser.account__c+'&Sfdc.override=1');
pageRef.getParameters().put('tab','Destiny Services');
return pageRef;
}
}
and my test class with relevent section highlighted:
@isTest
private class TestExtSaveButton {
static testMethod void TestExtSaveButton(){
//Based on your code and what you give me, Fact Finder is a child of the Account and when you //attach fact finder it needs to be reference into an account.
// create a test account that will be use to reference the Fact Finder Record
Account acc = new Account(Name = 'Test Account');
insert acc;
//Now lets create Fact Finder record that will be reference for the Standard Account
Fact_Finder__c facTest = new Fact_Finder__c(Account__c = acc.id);
//call the apepages stad controller
Apexpages.Standardcontroller stdFac = new Apexpages.Standardcontroller(facTest);
//now call the class and reference the standardcontroller in the class.
extSaveButton ext = new extSaveButton(stdFac);
//call the pageReference in the class.
ext.saveFactFinder();
}
static testMethod void TestExtSaveProButton(){
Account acc = new Account(Name = 'Test Pro Account');
insert acc;
//Now lets create Destiny Products record that will be reference for the Standard Account
Destiny_Products__c proTest = new Destiny_Products__c(Account__c = acc.id);
//call the apepages stad controller
Apexpages.Standardcontroller stdPro = new Apexpages.Standardcontroller(proTest);
//now call the class and reference the standardcontroller in the class.
extSaveProButton extPro = new extSaveProButton(stdPro);
//call the pageReference in the class.
extPro.saveDestinyProducts();
}
static testMethod void TestExtSaveSerButton(){
Account acc = new Account(Name = 'Test Ser Account');
insert acc;
//Now lets create Destiny Products record that will be reference for the Standard Account
Service__c SerTest = new Service__c(Account__c = acc.id);
//call the apepages stad controller
Apexpages.Standardcontroller stdSer = new Apexpages.Standardcontroller(serTest);
//now call the class and reference the standardcontroller in the class.
extSaveSerButton extSer = new extSaveSerButton(stdSer);
//call the pageReference in the class.
extSer.saveDestinyService();
}
static testMethod void TestExtSaveTraButton(){
Account acc = new Account(Name = 'Test Tra Account');
insert acc;
//Now lets create Destiny Products record that will be reference for the Standard Account
Transaction__c traTest = new Transaction__c(Account__c = acc.id, Date_of_Payment__c = date.today(), Amount__c = 0);
//call the apepages stad controller
Apexpages.Standardcontroller stdTra = new Apexpages.Standardcontroller(traTest);
//now call the class and reference the standardcontroller in the class.
extSaveTraButton extTra = new extSaveTraButton(stdTra);
//call the pageReference in the class.
extTra.saveDestinyTransaction();
}
static testMethod void TestExtSaveComButton(){
Account acc = new Account(Name = 'Test Com Account');
insert acc;
//Now lets create Destiny Products record that will be reference for the Standard Account
Notes__c comTest = new Notes__c(Account__c = acc.id);
//call the apepages stad controller
Apexpages.Standardcontroller stdCom = new Apexpages.Standardcontroller(comTest);
//now call the class and reference the standardcontroller in the class.
extSaveComButton extCom = new extSaveComButton(stdCom);
//call the pageReference in the class.
extCom.saveComplianceNotes();
}
}
Thank you in advanced for your help
- Developer.mikie.Apex.Student
- January 24, 2014
- Like
- 0
- Continue reading or reply
Apex Integration Services module instructions
• The 'getAnimalNameById' method must call https://th-apex-http-callout.herokuapp.com/animals/:id, using the ID passed into the method. The method returns the value of the 'name' property (i.e., the animal name).
If someone physically copies that link, removes id but leaves in : then the challenge review will not pass because the request link will post as
https://th-apex-http-callout.herokuapp.com/animals/:99
instead of the correct
https://th-apex-http-callout.herokuapp.com/animals/99
The first incorrect link will still perform get for the request, but just blank values in the json response.
- Phillip Southern
- December 31, 2016
- Like
- 0
- Continue reading or reply
how to work with chatter on visualforce page?
could any one tell me how to do chatter .
- smita jha 8
- March 28, 2016
- Like
- 0
- Continue reading or reply
problem on calculating total price in opportunitylineitem
Actually my scenario is to display the total price,list price,quantity,discount in VF page. I want to perform dynamic operation for those field that is before saving itself i want to display the total price. I tried that in java script but its not working. Can any one help me out to solve this issue.
I want to display like this
Thanks in advance
- divya divya
- March 28, 2016
- Like
- 0
- Continue reading or reply
Apex Integration Services module instructions
• The 'getAnimalNameById' method must call https://th-apex-http-callout.herokuapp.com/animals/:id, using the ID passed into the method. The method returns the value of the 'name' property (i.e., the animal name).
If someone physically copies that link, removes id but leaves in : then the challenge review will not pass because the request link will post as
https://th-apex-http-callout.herokuapp.com/animals/:99
instead of the correct
https://th-apex-http-callout.herokuapp.com/animals/99
The first incorrect link will still perform get for the request, but just blank values in the json response.
- Phillip Southern
- December 31, 2016
- Like
- 0
- Continue reading or reply
after insert and after update in apex class
I have a Requirement please help me out
I have account with 5 checkbox fields and contact objects with 5 checkbox fields ,on contacts their is a vf overrided ,when i check the checkboxes whenever i insert and updates in contact then it has to be updated in account with according to checkboxes automatically?
please help me out!!!
Thanks ,
Ram
- Board salesforce
- December 19, 2015
- Like
- 0
- Continue reading or reply
Trying to Create a Button to Bypass Flow script Button in Contacts to Create a New Case
- Glenn Nyhan 26
- December 19, 2015
- Like
- 0
- Continue reading or reply
Process Builder : how to create automated opportunities related to an account?
Hi,
I have many opportunities named as "opportunity 2015" related to an account.
Example :
- Account A : has one opportunity named "opportunity 2015"
- Account B : has one opportunity named "opportunity 2015"
I want to create a process builder to create an automated opprtunity for those accounts for 2016 :
- Account A : process builder will create an opportunity named "opportunity 2016"
- Account B : process builder will create an opportunity named "opportunity 2016"
Do you know want kind of criteria i can enter to create automated oppotunities for 2016 related to the same account?
Thanks.
- Karim BAHAJI
- December 18, 2015
- Like
- 0
- Continue reading or reply
Invocable Method Failure
Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, The record couldn’t be saved because it failed to trigger a flow. <br>A flow trigger failed to execute the flow with version ID 301d0000000LHot
Here is the method
@InvocableMethod(label='Count_Characters_In_Function' description='')
public static void processType(KeyValueInv[] kvLst){
//some basic code
//even changed to just putting system.debug
}
I've got an inner class which is basic
public class KeyValueInv {
@InvocableVariable(label='key1' required=true)
public String key1;
}
I can select everything as normal in the PB but it fails
Please help?
- steven.fouracre
- July 04, 2015
- Like
- 0
- Continue reading or reply
Update Opportunity Field with Product custom Fields
How to update opportunity field with product custom field (using trigger).
Thanks
Srikanth.
- sreekanth reddy
- July 03, 2015
- Like
- 0
- Continue reading or reply
How do I hide a component on some layouts but still perform work?
I need this refresh functionality now on all layouts for this object, but I do not want to display anything on the actual page in the layouts that do not need it.
What I have tried is to put a public boolean on the controller that says whether or not to render the controls. What this does is hide the controls but leaves a large white space on the page where the controls would be. Of course I do not want this space to show.
Here is a simplified version of my page :
<apex:component controller="CustomQuoteMetrics" allowDML="true" > <apex:form id="customQuoteMetrics"> <apex:actionPoller action="{!queryQuote}" rerender="metrics" interval="90" /> <apex:outputPanel rendered="{!refreshQuoteNow}"> <script> window.top.location='/{!quoteID}'; </script> </apex:outputPanel> <apex:pageBlock id="metrics" rendered="{!showCustomComponent}"> </apex:pageBlock> </apex:form> </apex:component>
Any ideas on what I could do differently?
I am a (c#, c++, JavaScript...) developer, but have only been writing apex code on the salesforce platform for about 8 months, so I realize I may not be headed in the right direction.
- Maggie Longshore
- July 01, 2015
- Like
- 0
- Continue reading or reply
Trigger help,Campaign Member Status
trigger ai_WebToCaseLead on Case (after insert) { List<CampaignMember> listCm = [SELECT Id,Lead.Email,CampaignId FROM CampaignMember WHERE CampaignId = '701190000001F5l']; for(Case caso : Trigger.new){ System.debug('caso'); for(CampaignMember cm : listCm){ System.debug('caso'); if(cm.Lead.Email == caso.SuppliedEmail && caso.ChaveCampanha__c == '701190000001F5l'){ cm.Status = 'Respondido'; caso.ParentId = cm.Lead.Id; update cm; update caso; System.debug(cm); System.debug(caso); } } } }
Regards!
Lucas
- SolidLucas
- June 30, 2015
- Like
- 0
- Continue reading or reply
18 Digit ID to Data
We are trying to integrate SFDC with our system and while trying to fetch an information from a field in SFDC through API , the values are getting fetched in 18 digits instead of hte actual name.
The filed which we are trying is called as Projects which should have names like RBC , Royal Bank of Scotland etc but it shows like this 006w000000XweAaAAJ ( 18 digits) in my application instead of the actual data.
How do we get this sorted.
Kindly help.
- Meetesh Jain
- October 29, 2014
- Like
- 0
- Continue reading or reply
Before Trigger Referencing Custom Setting Not Updating Properly
When I run my trigger, the bolded system.debug show that the Contact Owner values is being set correctly (i.e. the User Id is the User Id mapped to the Billing Country in the Custom Setting), but the field is ulitmately not updated with the correct User Id. Based on field history tracking, it does not look like its being updated at all.
Am I missing something on this trigger?
trigger AssignContact on Contact (before insert, before update) {
Set<String> accountSet = new Set<String>();
Set<Id> contactIdSet = new Set<Id>();
List<Lead_Assignment__c> lstBillingOwner = [Select ID,Country__c, New_Owner_ID__c FROM Lead_Assignment__c];
Map<String,String> mpCountryOwner = new Map<String,String>();
for(Lead_Assignment__c l1 : lstBillingOwner) {
mpCountryOwner.put(l1.Country__c, l1.New_Owner_ID__c);
}
Map<Id,User> mpUser = new Map<Id,User>([Select ID FROM User Where ID IN :mpCountryOwner.values()]);
Set<Id> accIds = new Set<Id>();
for(Contact con : trigger.new){
accIds.add(con.AccountId);
}
Map<Id,Account> mpAcc = new Map<Id,Account>([Select ID, Name, BillingCountry FROM Account Where ID IN :accIds]);
for(Contact con : trigger.new){
Account act = mpAcc.get(con.AccountId);
if(con.AccountId != null && act.BillingCountry != null){
if(mpCountryOwner.get(act.BillingCountry) != null){
con.owner = mpUser.get(mpCountryOwner.get(act.BillingCountry) );
System.debug('***** - Updating Owner - New Owner - '+con.owner);
}
}
}
}
- Marie Kagay
- October 28, 2014
- Like
- 0
- Continue reading or reply
Transferring value to next page through controller
I want to build a form in which title of next page and name of record should increment by one. i dont know how to save the value in the controller because every time we direct to new vf page. controller value are getting null .
Example to explain situation:
Page1 :
some detail
Button1: Next Button2: add another house
If you click on Next it redirects to new page and its value should be 1 which is not a problem
IF you click on add another house the next page title should be house 2 and name of record should be house2 and it direct to same page to create new record.
If he clicks again than it should go to house 3 .
And if he click to next it redirect to another form which starts from 1.
Can anyone help me how should i approch this ?
Thanks
- NikunjVadi
- October 28, 2014
- Like
- 0
- Continue reading or reply
Explain the syntax of Apex: ! , $, ", {, (, Etc.
I've gotten by largely by modding existing free GitHub and forum provided code.
But I've still got basic questions regarding what some of these symbols mean and when they are used.
For example: the ! sign.
The $ sign (I think is to call universal components, as I've used it in the $User context).
The " should convey direct text, but I'm not so sure.
The { and the ( are pretty interchangeable to me, but I know that that can't be right. When would you use one over the other?
Any other advice much appreciated.
- Matt Folger
- September 16, 2014
- Like
- 0
- Continue reading or reply
RecordTypeId not valid for the user
Record Type ID: this ID value isn't valid for the user: 012E000000023tjIAA
Yet when I query the RecordType with SELECT ID, isactive FROM RecordType where sobjecttype = 'Case' and developername='Complaint_Case' and isactive = true it returns me the following:
true 012E000000023tjIAA.
Stepping through the code, I made sure that the correct id is being returns and it is.
What am I missing? Any insight will be greatly appreciated.
- pcroadkill
- September 16, 2014
- Like
- 0
- Continue reading or reply
List has no rows for assignment to SObject (VF Page & controller extension)
I am trying to display opportunity products on the standard case page layout (The case is related to an opportunity using a look-up)
I am getting the error "Content cannot be displayed: List has no rows for assignment to SObject" I am not a developer and any help would be much appreciated in completing this. I'll owe you some beers at Dreamforce :)
Controller Extension
Public With Sharing Class crossObjectOpportunityInfo {
Public Opportunity o {get; private set;}
Public Case c {get; private set;}
Public List<Schema.FieldSetMember> getFields() {
return SObjectType.OpportunityLineItem.FieldSets.Display_On_Case.getFields();
}
Public crossObjectOpportunityInfo(ApexPages.StandardController sc) {
this.o = [SELECT Id, AccountId FROM Opportunity WHERE RELATED_OPPORTUNITY__C = :sc.getId() LIMIT 1];
String queryString = 'SELECT Id';
List<Schema.FieldSetMember> querySet = SObjectType.OpportunityLineItem.FieldSets.Display_On_Case.getFields();
for(Schema.FieldSetMember f : querySet) {
queryString += ', '+ f.getFieldPath();
}
Id cid = [SELECT Id FROM Contact WHERE AccountId = :o.AccountId LIMIT 1].Id;
queryString += ' FROM Opportunity WHERE id = \''+ cid +'\' LIMIT 1';
}
}
VF Page
<apex:page standardController="Case" extensions="crossObjectOpportunityInfo">
<apex:pageBlock title="Opportunity Products">
<apex:pageBlockSection columns="1">
<apex:pageBlockTable value="{!Case.Related_Opportunity__c}" var="line">
<apex:column headerValue="Product">
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>
- Joanne Butterfield
- September 16, 2014
- Like
- 0
- Continue reading or reply
Ascending Order for a User-Generated SOQL query
- Matt Folger
- September 16, 2014
- Like
- 0
- Continue reading or reply