-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
18Questions
-
30Replies
CREATE Event access for user
Can any one suggest what I am missing?
-
- Sapana W
- May 26, 2016
- Like
- 0
- Continue reading or reply
Not able to add inline VF inspite of using object as standard controller in Prod
I have created a VF page with Account as Standard Controller and have added the page as inline VF in sandbox. But when I tried to do same in the Production, I cannot see the required VF page under VisualForce Pages in edit layout. Is it becuase my Prod is at lower version and I had to decrement the version of code to lower version before deploying to Prod? I do have access to the page in Prod and could see it in setup also.
.
I could not the see the VF page am looking here for.
Also here is the code snippet:
<apex:page StandardController= "Account" extension="TestControllerExtn" recordSetVar="Accounts">
-
- Sapana W
- February 14, 2016
- Like
- 0
- Continue reading or reply
Email delivery fail
"This message was created automatuically by the mail system.
A message that you sent could not be delivered to one or more recipients. This is a permanent error. The following address failed>>:
******@***.com(Undelivered) 504."
I suppose I have all the required setting configured or am I missing something?
Thanks in advance.
-
- Sapana W
- December 14, 2015
- Like
- 0
- Continue reading or reply
change inactive owners to active owners for records
I am trying to update the owners of contact records to owner of parent account record. But for records where contact owner is inactive I am unable to change its owner. I have written a batch class but it does not work. Could anyone let me know whats the issue?(I have all the required permission to update the inactive owner records)
Here is my code:
global class BatchUpdateCon implements Database.Batchable<sObject>
{
global Database.QueryLocator start(Database.BatchableContext BC)
{
String query = 'Select Id, owner.Isactive, OwnerId, Account.OwnerId from Contact where owner.isactive = False';
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC,List<Contact> scope)
{
List <Contact> contactToUpdate = new list<Contact>();
Set<Id> accIds = new Set<Id>();
for(Contact con : scope)
{
accIds.add(con.AccountId);
}
Map<Id, Account> mapAccount = new Map<Id, Account>([select id, ownerId from Account where id in:accIds]);
for(Contact con : scope)
{
if(con.AccountId != null && con.OwnerId != mapAccount.get(con.AccountId).OwnerId)
{
System.debug('Inside--->'+con.Accountid);
con.OwnerId = mapAccount.get(con.AccountId).OwnerId;
contactToUpdate.add(con);
}
}
update contactToUpdate;
}
global void finish(Database.BatchableContext BC)
{
}
}
-
- Sapana W
- November 19, 2015
- Like
- 0
- Continue reading or reply
Refer parent name in url for custom button
I want to create a custom button on parent record to add records in child object. I created the custom button with url for new child record on parent object but the parent name does not auto populate in the new child record edit mode and I have to enter it manually and then save the record. Is their a way to get this working.
-
- Sapana W
- August 03, 2015
- Like
- 0
- Continue reading or reply
How to enable chatter desktop for organization
I am not able to install chatter desktop on my machine. Being a system administrator I have 'API Enabled', 'Chatter Internal User' permission too. It shows me insufficient privileges error.
-
- Sapana W
- December 29, 2015
- Like
- 0
- Continue reading or reply
formatted xml
620 SW 5th Avenue Suite 400 Portland, Oregon 97204United States 345 Shoreline Park Mountain View,CA USA USA
I want xml output as:
<Street>620 SW 5th Avenue Suite 400</Street>
<City>Portland</City>
<State>Oregon</State>
<PostalCode>97204</PostalCode>
<Country>USA</Country>
and so on..
Heres my code:
<apex:page StandardController="Account" recordSetVar="Accounts" contentType="text/xml" showHeader="true" sidebar="false" cache="false">
<?xml version="1.0" encoding="UTF-8" ?>
<response>
<apex:repeat value="{!Accounts}" var="eachAccount" >
<Account id="{!eachAccount.id}" name="{!eachAccount.name}">
<Address type="Billing">
<Street><stri>{!eachAccount.billingStreet}</stri></Street>
<City>{!eachAccount.billingCity}</City>
<State>{!eachAccount.billingState}</State>
<PostalCode>{!eachAccount.billingPostalCode}</PostalCode>
<Country>{!eachAccount.billingCountry}</Country>
</Address>
</Account>
</apex:repeat>
</response>
</apex:page>
-
- Sapana W
- December 23, 2014
- Like
- 0
- Continue reading or reply
Calculate values on the fly using actionSupport
Have already coded this thing. But its not working and am not not getting what the issue is.
Heres my code:
<apex:page standardController="Opportunity" extensions="OppAutoPopulateCTRL" id="page">
<apex:form id="myForm" >
<apex:pageBlock mode="edit" >
<apex:pageblocksection title="LMS Lookup" id="Contractsec1">
<apex:pageblocksectionItem >
<apex:inputfield value="{!Opp.AccountId}" >
<apex:actionSupport event="onchange" action="{!autoPopulate}" reRender="panelConType"/>
</apex:inputfield>
</apex:pageBlockSectionItem>
</apex:pageblocksection>
</apex:pageBlock>
<apex:pageBlock title="Popup">
<apex:pageblocksection >
<!-- Added to auto populate -->
<apex:pageblocksectionItem id="popup1" >
<apex:outputLabel value="{!$ObjectType.Opportunity.fields.MainCompetitors__c.label}" />
<apex:outputPanel id="panelConType" >
<apex:inputfield value="{!Opportunity.MainCompetitors__c}" />
</apex:outputPanel>
</apex:pageblocksectionItem>
<apex:inputfield value="{!Opportunity.CloseDate}" />
<apex:inputfield value="{!Opportunity.StageName}" />
<apex:inputfield value="{!Opportunity.Name}" />
</apex:pageblocksection>
<apex:pageblockbuttons >
<apex:commandButton action="{!save}" value="Save" id="theButton"/>
</apex:pageblockbuttons>
</apex:pageBlock>
</apex:form>
</apex:page>
public class OppAutoPopulateCTRL {
public Opportunity opp{get;set;}
public String PAccountNumber{set;get;}
public ApexPages.StandardController stdController;
public OppAutoPopulateCTRL (ApexPages.StandardController controller)
{
stdController = controller;
opp= new Opportunity();
}
//Added to autopopulate the values
public void autoPopulate()
{
Opportunity opp = (opportunity) stdController.getRecord();
List<Account> acc = new List<Account>();
Acc = [
SELECT Id, Name, AccountNumber,Zip_Code__c
FROM Account
WHERE id =: opp.AccountId
];
System.debug('@@'+acc.size() );
Opp.MainCompetitors__c = acc[0].Name;
}
}
-
- Sapana W
- October 10, 2014
- Like
- 0
- Continue reading or reply
Pros and cons of Single Community vs Multiple Communities
Hi All,
I want to know if there are any pros and cons of Single Community vs Multiple Communities. I searched in documents but could not find anything relevant to this.
Thanks in advance!!
-
- Sapana W
- December 02, 2013
- Like
- 0
- Continue reading or reply
Make only "user" option visible in a User lookup field
Hi folks,
On my custom object I have created a lookup to user. This field shows a picklist with 3 options namely "User", "Partner User", "Customer Portal User". I want only "User" option to be visible in the picklist. Is this possible? If yes please tell me how could I do this.
Thanks in advance!!
-
- Sapana W
- September 04, 2013
- Like
- 0
- Continue reading or reply
Clear Row function resets input values of whole table
I am facing a problem here that when I click on "Clear" link for a row the whole datatable values get reset. I am using javascript and am not getting how to pass id of particular row since its datatable in apex and rows repeat. Here's my code
<apex:page controller="ENT_EXT_CommunitiesFRMultipleUpload">
<script>
function clearLine()
{
var reset1 = document.getElementById("partnerselect").value;
var reset2 = document.getElementById("look-partner").value;
var reset3 = document.getElementById("yearselect").value;
var reset4 = document.getElementById("masterselect").value;
var reset5 = document.getElementById("fileselect").value;
var reset6 = document.getElementById("filename").value;
var reset1 = '';
var reset2 = '';
var reset3 = '';
var reset4 = '';
var reset5 = '';
var reset6 = '';
}
</script>
<apex:form id="form1">
<apex:pageblock >
<apex:pageblockbuttons location="bottom" style="margin:0 auto; width:50%;">
<apex:commandButton onclick="" value="Upload" action="{!UploadAll}"/>
<apex:commandButton immediate="true" value="Add More Rows" action="{!AddLine}" onclick="$.blockUI({ css: { border: 'none', padding: '15px', backgroundColor: '#000', 'webkit-border-radius': '10px', 'moz-border-radius' :' 10px',opacity: .5, color: '#fff'} });" />
</apex:pageblockbuttons>
<br/>
<apex:pagemessages id="upload-msg" escape="false"/> <br/>
<apex:pageblockSection collapsible="false" title="Contact Information for Uploaded Documents" columns="1">
<apex:pageBlockSectionItem HelpText="{!$ObjectType.ContentVersion.fields.PortalUserName__c.inlineHelptext}"></apex:pageBlockSectionItem>
<apex:inputfield id="cname" value="{!ProjectInserted[0].UploadedContent.PortalUserName__c}" required="true" />
</apex:pageblockSection>
<apex:pageblockSection collapsible="false" columns="1">
<apex:pageBlockSectionItem HelpText="{!$ObjectType.ContentVersion.fields.PortalUserEmail__c.inlineHelptext}"></apex:pageBlockSectionItem>
<apex:inputfield id="cemail" value="{!ProjectInserted[0].UploadedContent.PortalUserEmail__c}" required="true"/>
</apex:pageblockSection>
<apex:pageblockSection collapsible="false" columns="1">
<apex:pageBlockSectionItem HelpText="{!$ObjectType.ContentVersion.fields.PortalUserPhone__c.inlineHelptext}"></apex:pageBlockSectionItem>
<apex:inputfield id="cphone" value="{!ProjectInserted[0].UploadedContent.PortalUserPhone__c}"/>
</apex:pageblockSection>
<apex:dataTable columns="5" value="{!ProjectInserted}" var="pi" cellspacing="2" cellpadding="2" width="100" id="tbl">
<apex:column >
<apex:facet name="header">Choose Partnership or LLC</apex:facet>
<apex:outputPanel rendered="{!IF($Profile.Name=='FR Portal_Customer Portal Manager Custom',true,false)}">
<apex:selectList onchange="DuplicateDocument(this.name);" id="partnerselect" style="width:300px; overflow:visible;" size="1" value="{!pi.CPAPartner}">
<apex:selectOptions Value="{!PartnershipList}">
</apex:selectOptions>
</apex:selectList>
</apex:outputPanel>
<apex:outputPanel rendered="{!IF($Profile.Name!='FR Portal_Customer Portal Manager Custom',true,false)}">
<apex:inputField id="look-partner" value="{!pi.UploadedContent.CPA_Portal_Partnership__c}" />
</apex:outputPanel>
</apex:column>
<apex:column >
<apex:facet name="header">Year</apex:facet>
<apex:selectList id="yearselect" size="1" onchange="DuplicateDocument(this.name);" value="{!pi.UploadedContent.Year__c}" >
<apex:selectOptions value="{!YearSelectList}">
</apex:selectOptions>
</apex:selectList>
</apex:column>
<apex:column >
<apex:facet name="header">Document Type</apex:facet>
<apex:selectList onchange="DuplicateDocument(this.name);" id="masterselect" size="1" value="{!pi.SelectedMasterDocument}" >
<apex:selectOptions value="{!MasterDocumentList}">
</apex:selectOptions>
</apex:selectList>
</apex:column>
<apex:column >
<apex:facet name="header">Select a File</apex:facet>
<apex:inputFile id="fileselect" title="Please click Browse to select or replace a file." fileName="{!pi.PathOnClient}" value="{!pi.FileBody}" />
</apex:column>
<apex:column >
<apex:outputPanel id="filename"></apex:outputPanel>
</apex:column>
<apex:column >
<apex:commandLink id="clearlink" title="Please click Clear to clear the contents of the fields on this row." onclick="clearLine()" styleClass="cancel">Clear</apex:commandLink>
</apex:column>
</apex:dataTable>
</apex:pageblock>
</apex:form>
</apex:page>
-
- Sapana W
- August 20, 2013
- Like
- 0
- Continue reading or reply
Need help with Apex error message
I have created a VF page to display Funds records related to current portal user. In the controller I have written a query to return records, which is working fine but I am not able to return error message if no records exist for that user.Here's the code for VF and apex.
=======VF Page======
<apex:page controller="CTRL_FundTab" tabStyle="ENT_Fund__c" title="ENT_Fund__c" >
<apex:form id="form" >
<apex:sectionHeader title="Fund" />
<apex:pageBlock title="Recent Funds">
<apex:pagemessages />
<apex:pageBlockTable value="{!funds}" var="row">
<apex:column >
<apex:facet name="header">Fund Name</apex:facet>
<apex:outputLink title="" value="/{!row.id}" >{!row.Name}</apex:outputLink>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
=======Controller====
public class CTRL_FundTab
{
public CTRL_FundTab()
{
}
public List<ENT_Fund__c> getFunds()
{
ID contactId = [Select contactid from User where id =: Userinfo.getUserid()].contactId;
ID AccID = [Select AccountID from Contact where id =: contactid].AccountId;
list<ENT_Closing_Phase_Entity__c> cpeLst = [select Id,Name, Account__r.Name,Fund__c,Fund__r.Name from ENT_Closing_Phase_Entity__c where Account__c =:AccID];
String ff = cpeLst[0].Fund__r.Name;
list<ENT_Fund__c> funLst = [select Id,Name from ENT_Fund__c where Name =: ff];
system.debug('$$$$$$$'+funLst.size());
system.debug('$$$$$$$'+funLst[0].name);
return funLst;
}
}
When I try to return Apex.Message object in getFunds() it shows me an error saying return type does not match
Thanks in advance!!
-
- Sapana W
- July 19, 2013
- Like
- 0
- Continue reading or reply
Issue with Conga Merge button on VF
Hi,
I am using Conga Composer app to generate a report in word format. On my vf page I have created a custom link that takes me to Conga Composer window but the problem is that it generates a blank report without any value(blank template). I am not able to get what the problem might be. Any help would be appreciated. Thanks in advance!!
-
- Sapana W
- July 03, 2013
- Like
- 0
- Continue reading or reply
-
- Sapana W
- June 26, 2013
- Like
- 0
- Continue reading or reply
Display radio button on a visualforce page to be rendered as pdf
Hi,
I want to create a VF page would be generated as pdf with "renderAs" attribute. Generated pdf should be the visual match of the source VF page(i.e it should display even radio button watsoever value is selected.) In my case the pdf page shows only the labels of radio button and not the actual circles ( o ). Basically I am displaying data from an object in dataTable with radio buttons adjacent to each row showing yes/no value. And in VF pdf I want to show the value selected.Please guide me.
(Note:Following code is just for source VF page out of which VF pdf would be generated with renderAs attribute)
<=============VF Page===========>
<apex:page controller="GreenCertificate" id="thePage">
<apex:dataTable value="{!items}" var="item" id="theTable" rowClasses="odd,even"
styleClass="tableClass" border="2">
<apex:facet name="caption">Online Criteria </apex:facet>
<apex:facet name="header"> table header</apex:facet>
<apex:facet name="footer">table footer</apex:facet>
<apex:column >
<apex:facet name="header">Certfication Template Item</apex:facet>
<apex:facet name="footer">column footer</apex:facet>
<apex:outputText value="{!item.name}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Certfication Template</apex:facet>
<apex:facet name="footer">column footer</apex:facet>
<apex:outputText value="{!item.Certfication_Template__r.Name}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Required</apex:facet>
<apex:facet name="footer">column footer</apex:facet>
<apex:outputText value="{!item.Required__c}"/>
</apex:column>
</apex:dataTable>
</apex:page>
<=============Apex Controller===========>
public class GreenCertificate
{
String yesno = null;
public String getCreatePDF()
{
return null;
}
public PageReference CreatePDF()
{
return Page.GreenCertificatePDF;
}
public List<SelectOption> getYesOrNo() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('YES','Yes'));
options.add(new SelectOption('NO','No'));
return options;
}
public String getyesno()
{
return yesno;
}
public void setyesno(String yesno)
{
this.yesno = yesno;
}
List<Certfication_Template_Item__c> items;
public List<Certfication_Template_Item__c> getItems() {
if(items == null) items = [select name, Certfication_Template__r.Name, Required__c from Certfication_Template_Item__c where Required__c=true ];
return items;
}
}
-
- Sapana W
- June 25, 2013
- Like
- 0
- Continue reading or reply
Inserting record with particular record type
trigger ENT_Trigger_insertNonQEIDisbursements on ENT_NMTC_Non_QLICI_Disbursement__c (after insert)
{
//List<ENT_NMTC_QEI_Non_QEI_Disbursements__c> DisbList = new List<ENT_NMTC_QEI_Non_QEI_Disbursements__c>();
if (Trigger.isInsert)
{
//Id rtId = [select Id,name from RecordType where name='Non-QEI' and SObjectType='ENT_NMTC_QEI_Non_QEI_Disbursements__c' limit 1].id;
for(ENT_NMTC_Non_QLICI_Disbursement__c NonDisb : trigger.new)
{
List<ENT_NMTC_QEI_Non_QEI_Disbursements__c> DisbListToInsert = new List<ENT_NMTC_QEI_Non_QEI_Disbursements__c>();
ENT_NMTC_QEI_Non_QEI_Disbursements__c InsertDisb = new ENT_NMTC_QEI_Non_QEI_Disbursements__c(NMTC_Non_QLICI_Disbursement__c=NonDisb.Id,RecordType.name=Non_QEI);
InsertDisb.Deal_Exit_Date__c = NonDisb.Deal_Exit_Date__c;
//InsertDisb.RecordTypeId = rtId;
RecordType.Name = 'Non-QEI';
InsertDisb.Deal_Originated_Date1__c = NonDisb.Deal_Originated_Date__c;
InsertDisb.Disbursement_Date__c = NonDisb.Disbursement_Date__c;
InsertDisb.Disbursement_ID__c = NonDisb.NMTC_NonQLICI_Disbursement_ID__c;
InsertDisb.Disbursement_Source__c = NonDisb.NMTC_Non_QEI_Contribution__c;
InsertDisb.Not_Yet_Disbursed_Projected_QEI__c = NonDisb.Not_Yet_Disbursed_Projected_QEI__c;
InsertDisb.Originator_Transaction_ID__c = NonDisb.Product_Originator_Transaction_ID__c;
InsertDisb.Source_Amount__c = NonDisb.Amount__c;
InsertDisb.Total_Disbursement_Amount__c = NonDisb.Amount__c;
DisbListToInsert.add(InsertDisb);
if(DisbListToInsert.size()>0)
{
insert DisbListToInsert;
}
}
}
}
Everything else is working fine accept that I am not able to set a record type for newly inserted record. I have tried many ways and later commented them all. Please guide me through this
-
- Sapana W
- February 18, 2013
- Like
- 0
- Continue reading or reply
Multiselect Picklist for Multiple Objects
Hi
I have a multiselect picklist say "Programs" which is to be used in multiple object. So to avoid the stuff of adding the picklist field to number of objects, I was thinking to create a object say "Programs " and add the picklist values as records to it and make Lookup relationship with all other objects.But in this case it wont allow me to enter multiple values from lookup dialog for a single child
Is there a way I can still implement this thing in salesforce
-
- Sapana W
- August 23, 2012
- Like
- 0
- Continue reading or reply
Change the 'New' and 'Edit' mode for a record
I have an object say A containing 15 fields , when I add a new record to object A only 10 fields out of 15 should be visible and I must be able to enter values into it and save the record.Now after I open this saved record ,all the 15 fields should be visible to me and I should be able to enter values into it.
Is this possible using standard functionality of salesforce and how?If not how can it be done using Visualforce page?
-
- Sapana W
- August 20, 2012
- Like
- 0
- Continue reading or reply
Not able to add inline VF inspite of using object as standard controller in Prod
I have created a VF page with Account as Standard Controller and have added the page as inline VF in sandbox. But when I tried to do same in the Production, I cannot see the required VF page under VisualForce Pages in edit layout. Is it becuase my Prod is at lower version and I had to decrement the version of code to lower version before deploying to Prod? I do have access to the page in Prod and could see it in setup also.
.
I could not the see the VF page am looking here for.
Also here is the code snippet:
<apex:page StandardController= "Account" extension="TestControllerExtn" recordSetVar="Accounts">
- Sapana W
- February 14, 2016
- Like
- 0
- Continue reading or reply
Email delivery fail
"This message was created automatuically by the mail system.
A message that you sent could not be delivered to one or more recipients. This is a permanent error. The following address failed>>:
******@***.com(Undelivered) 504."
I suppose I have all the required setting configured or am I missing something?
Thanks in advance.
- Sapana W
- December 14, 2015
- Like
- 0
- Continue reading or reply
How to enable chatter desktop for organization
I am not able to install chatter desktop on my machine. Being a system administrator I have 'API Enabled', 'Chatter Internal User' permission too. It shows me insufficient privileges error.
- Sapana W
- December 29, 2015
- Like
- 0
- Continue reading or reply
formatted xml
620 SW 5th Avenue Suite 400 Portland, Oregon 97204United States 345 Shoreline Park Mountain View,CA USA USA
I want xml output as:
<Street>620 SW 5th Avenue Suite 400</Street>
<City>Portland</City>
<State>Oregon</State>
<PostalCode>97204</PostalCode>
<Country>USA</Country>
and so on..
Heres my code:
<apex:page StandardController="Account" recordSetVar="Accounts" contentType="text/xml" showHeader="true" sidebar="false" cache="false">
<?xml version="1.0" encoding="UTF-8" ?>
<response>
<apex:repeat value="{!Accounts}" var="eachAccount" >
<Account id="{!eachAccount.id}" name="{!eachAccount.name}">
<Address type="Billing">
<Street><stri>{!eachAccount.billingStreet}</stri></Street>
<City>{!eachAccount.billingCity}</City>
<State>{!eachAccount.billingState}</State>
<PostalCode>{!eachAccount.billingPostalCode}</PostalCode>
<Country>{!eachAccount.billingCountry}</Country>
</Address>
</Account>
</apex:repeat>
</response>
</apex:page>
- Sapana W
- December 23, 2014
- Like
- 0
- Continue reading or reply
How to Filter / Restrict Custom Lookup Relationships based on criteria
Is there a way to filter lookup dialog results based on certain criteria?
So for example:
I have a lookup relationship field for Products on a custom object for a Contact Product Association custom object. When I click to lookup a product, I am shown all of our products. I am trying to find a way to restrict the lookup dialog to only show me products in a certain pricebook. Does anyone know how I could do that?
Thanks!
- Eric Fortenberry
- September 25, 2013
- Like
- 0
- Continue reading or reply
Filtering on a Lookup filter
How can a filter be applied to a lookup field for the following:
There are 4 object
object A: Product
object B: Allowed Product
object C: Configuration
object D: Quote
For a configuration(A), allowed product(B) are used to define which product(A) are allowed for a configuration(C).
When you create a quote, a configuration is used.
Assuming that a lookup to Product(A) exist on either the quote or the quote line item.
How is it possible to display only the product in allowed product(B) for that configuration in the quote?
Thanks
- hsthierry
- September 25, 2013
- Like
- 0
- Continue reading or reply
Need Sollution for this task?
Contact : on contact page i have a field "Annuity user ". this field has lookup to Territory object.
so "Annuity User" field is populated from the Territory field.
contact has relationship with policy .
on policy object i have a field wholesaler.
so now the requirement is if policyId='3213' then this "Annuity User" data should display on policy record's "wholesaler" field.
can any one suggest trigger or any sollution pls.
- Tillu
- September 25, 2013
- Like
- 0
- Continue reading or reply
help on code coverage for below method
public void getcount()
{
if(opp.provider1__c!=null)
{
Score_Count__c scr = [select id,name from Score_Count__c where id = :opp.provider1__c];
scorecnt= scr.name;
}
}
- forcecloud20
- September 25, 2013
- Like
- 0
- Continue reading or reply
How to write a custom DML Exception Error Message
I have an After Update trigger that updates the fields on a parent object, and that object has several validation rules that have the potential to fire if they're met when the After Update trigger runs.
Instead of the normal DML exception though where it reads like gibberish and sends me an error email and leaves the user scratching their head, how would I display a custom error message, prevent the DML insert, and have the system NOT clog my email with exception messages?
The section of my code that triggers the DML is as follows:
try{ update processedOpportunitiesList; } catch(DMLException e){ if(e.getMessage().contains('FIELD_CUSTOM_VALIDATION_EXCEPTION, Please enter Shipping Address, City, State and Zip')){ e.addError('You can\'t select this stage until you first enter the Shipping Address info on the opportunity.'); } }
In the above code, I'm trying to say that, if running the DML update with the list "processedOpportunitiesList" results in a DML exception that contains the sentence "FIELD_CUSTOM_VALIDATION_EXCEPTION, Please enter Shipping Address, City, State and Zip", then I want to instead display "You can't select this stage until you first enter the Shipping Address info on the opportunity." to the user, prevent salesforce from inserting the record, and have it not email me about the exception.
However, I seem to not be grasping how this particular class is structured or how I'm supposed to write it. I keep getting "Method does not exist or incorrect signature" errors as I fiddle around with the code and I'm realizing that I'm not "getting" this and I should probably ask on here for help. Can someone please tell me how I would need to write or structure this trigger properly?
Thanks.
- Chris760
- September 24, 2013
- Like
- 0
- Continue reading or reply
Need help with Apex error message
I have created a VF page to display Funds records related to current portal user. In the controller I have written a query to return records, which is working fine but I am not able to return error message if no records exist for that user.Here's the code for VF and apex.
=======VF Page======
<apex:page controller="CTRL_FundTab" tabStyle="ENT_Fund__c" title="ENT_Fund__c" >
<apex:form id="form" >
<apex:sectionHeader title="Fund" />
<apex:pageBlock title="Recent Funds">
<apex:pagemessages />
<apex:pageBlockTable value="{!funds}" var="row">
<apex:column >
<apex:facet name="header">Fund Name</apex:facet>
<apex:outputLink title="" value="/{!row.id}" >{!row.Name}</apex:outputLink>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
=======Controller====
public class CTRL_FundTab
{
public CTRL_FundTab()
{
}
public List<ENT_Fund__c> getFunds()
{
ID contactId = [Select contactid from User where id =: Userinfo.getUserid()].contactId;
ID AccID = [Select AccountID from Contact where id =: contactid].AccountId;
list<ENT_Closing_Phase_Entity__c> cpeLst = [select Id,Name, Account__r.Name,Fund__c,Fund__r.Name from ENT_Closing_Phase_Entity__c where Account__c =:AccID];
String ff = cpeLst[0].Fund__r.Name;
list<ENT_Fund__c> funLst = [select Id,Name from ENT_Fund__c where Name =: ff];
system.debug('$$$$$$$'+funLst.size());
system.debug('$$$$$$$'+funLst[0].name);
return funLst;
}
}
When I try to return Apex.Message object in getFunds() it shows me an error saying return type does not match
Thanks in advance!!
- Sapana W
- July 19, 2013
- Like
- 0
- Continue reading or reply
Associating radio button with controller wrapper class..?
I need to get the associated record. i.e with the radio button.I am using input type radio button for the same.please someone help with the code...
<apex:column > <apex:facet name="header"> Action </apex:facet> <input type="radio" name="selection" value="{!m.isSelected}" /> </apex:column> <apex:column value="{!m.meet.Subject__c}"> <apex:facet name="header"> Subject </apex:facet> </apex:column>
<apex:commandButton value="Invite To Meeting" action="{!inv}"/>
wrapper class
public list<meetInviteWrapper> meetwrapperlist{get;set;} public class meetInviteWrapper { public meeting__c meet{get;set;} public Boolean isSelected{get;set;} public meetInviteWrapper(meeting__c m) { meet=m; isSelected=false; } public void inv() { List<meeting__c> mList=new List<meeting__c>(); for(meetInviteWrapper miw:meetwrapperlist) { if(miw.isSelected) { mList.add(miw.meet); } } System.debug('------------------------'+mList); }
- mike1051
- May 06, 2013
- Like
- 0
- Continue reading or reply
Creating Mailmerge Templates with custom related objects
Hi,
I'm hoping someone can help me with this because I can't seem to find any real documentation on Mailmerge templates in Salesforce nor can I find any samples.
In the past I've built Mailmerge templates for Opportunities that show all the Line Items for the opportunity. I have custom objects related to an opportunity and I want to do a Mailmerge template that shows all the child records for an opportunity in a manner similar to Line Items.
I've tried doing this through Word and it returns the Opportunity items but it doesn't return the child object items. So if anyone's got a sample Word document they'd be happy to pass along or tell me how I can address parent-child relationships in Mailmerge, I'd appreciate it.
Also I'm wondering if I can do a mailmerge for an Opportunity and show Line Items and also show Quotes and also show the records of custom child objects all in the same template.
Thanks in advance!!
- Ron-LON
- February 03, 2011
- Like
- 0
- Continue reading or reply