-
ChatterFeed
-
2Best Answers
-
0Likes Received
-
0Likes Given
-
7Questions
-
28Replies
remoteFunction call on Visualforce page does not work with IE
-
- agab
- July 14, 2008
- Like
- 0
- Continue reading or reply
Searching Text in Files Uploaded to CRM Content
I was hoping one of you bright people could answer a question regarding SOSL and
Content. In the standard Document object, there is a field called
IsBodySearchable that allows SOSL to search within the file contents of an
uploaded file. I also know that in the latest release, the ContentVersion
object is now searchable with SOSL, and I know that feature was implemented due
to this
idea in the IdeaExchange which specifically asks for searching file content.
However, I don't see that same field on the ContentVersion object and cannot find any
documentation that specifically states that Content file contents can be
searched. I don't want to promise to a client that we can do this
programmatically without seeing it in documentation or getting an
"official" verification from someone internal to SFDC. Thanks community!
-
- Dogen Zenji
- April 13, 2011
- Like
- 0
- Continue reading or reply
Second upsert statement within same Apex transaction does not fire trigger
Good morning everyone! Since one cannot create a lookup field to the standard OpportunityLineItem object, you cannot create a parent child relationship between OLIs as you cannot create a lookup to itself. I am mimicking this relationship by using wrapper classes and setting a text(18) custom field called Parent_OLI_Id__c on the OLI. Naturally, I have to save the parents first to get back their IDs, then save the children using the returned IDs. The following method accomplishes this beautifully...
public static void upsertOLIsFromOLIMs(OpportunityLineItemModel[] olims)
{
OpportunityLineItem[] oliParentsToUpsert = new OpportunityLineItem[0];
//Loop thru incoming OLIMs and extract parents only to upsert array
for(OpportunityLineItemModel olim : olims)
{
if(olim.isParent)
oliParentsToUpsert.add(olim.record);
}
try
{
//Upsert parents
upsert oliParentsToUpsert;
//Loop thru incoming OLIMs again and set parent Id of child records
//which has now been returned from previous upsert call
//Extract children to upsert array
OpportunityLineItem[] oliChildrenToUpsert = new OpportunityLineItem[0];
for(OpportunityLineItemModel olim : olims)
{
if(olim.isParent)
{
for(OpportunityLineItemModel childOLIM : olim.childRecords)
{
childOLIM.record.Parent_OLI_Id__c = olim.record.Id;
oliChildrenToUpsert.add(childOLIM.record);
}
}
}
//Upsert children
upsert oliChildrenToUpsert;
}
catch(DmlException dmle)
{
...
}
}
This method is called from a Save button on a VisualForce page. Enough background, now let's get to the problem. I have a trigger that runs after insert and after update of OLIs but is only firing on the first upsert statement of the method above, when upserting the parents. To prevent infinite recursion I am using the usual trick of setting a static Boolean to true the first time the trigger is run. While grasping at straws, I thought this might be causing the problem so I removed the static Boolean condition and let the trigger run ad infinitum. Every single System.debug statement outputted still showed that only parent OLIs were ever being passed to the trigger. Has anyone seen anything like this? I hope it's just because it's late and I'm doing something wrong...
-
- Dogen Zenji
- March 12, 2010
- Like
- 0
- Continue reading or reply
Web Service Callout Request/Response Size Governor Limit
-
- Dogen Zenji
- August 12, 2009
- Like
- 0
- Continue reading or reply
Web Service Request & Response Size Limit
-
- Dogen Zenji
- March 10, 2009
- Like
- 0
- Continue reading or reply
WSDL2Apex - Unable to find complexType
Hello community! I just wanted to start by saying thanks for all your help in previous posts and for posting such handy chunks of knowledge in general. We've been trying to import what I thought was a straightforward WSDL (see below) with no luck. The error returned is...
Error: Unable to find complexType for {http://www.hmco.com/EAI/OTS/Customer}customerID_element
I found the definition for that element and noticed it was defined as a simpleType and though I know the simpleTypes are now supported, just in case, I changed all occurences of simpleType to xsd:string as in this thread. That then got me this error...
Error: Unable to find schema for element; {http://www.w3.org/2001/XMLSchema}string
This last one really stumped me since string is a base type definitely in the W3 schema. Any ideas?
<?xml version="1.0" encoding="UTF-8"?> <!--Created by TIBCO WSDL--> <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.hmco.com/EAI/OTS/Customer/createSundryCustomerImpl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns0="http://www.hmco.com/EAI/OTS/Customer" xmlns:ns1="http://www.hmco.com/EAI" xmlns:ns2="http://www.hmco.com/EAI/OTS/Material" name="Untitled" targetNamespace="http://www.hmco.com/EAI/OTS/Customer/createSundryCustomerImpl"> <wsdl:types> <xsd:schema xmlns="http://www.hmco.com/EAI" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.hmco.com/EAI" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xsd:complexType name="eaiException"> <xsd:sequence> <xsd:element ref="ns1:errorList"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="error"> <xsd:sequence> <xsd:element name="errorCategory" type="xsd:string"/> <xsd:element name="errorCode" type="xsd:string"/> <xsd:element name="errorMessage" type="xsd:string"/> </xsd:sequence> </xsd:complexType> <xsd:element name="asyncRequestId"> <xsd:complexType> <xsd:sequence> <xsd:element ref="ns1:requestId"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="asyncRequestStatus"> <xsd:complexType> <xsd:sequence> <xsd:element name="isReady" type="xsd:boolean"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="error" type="ns1:error"/> <xsd:element name="errorList"> <xsd:complexType> <xsd:sequence> <xsd:element ref="ns1:error" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="requestId" type="xsd:string"/> </xsd:schema>
-
- Dogen Zenji
- March 10, 2009
- Like
- 0
- Continue reading or reply
pageBlockTable or dataTable not formatting
<apex:pageBlockTable value="{!eventOLIs}" var="eventOLI" width="100%">
<apex:column width="15%" headerValue="Brand" value="{!eventOLI.productName}"/>
<apex:column width="15%" headerValue="Product Code" value="{!eventOLI.productCode}"/>
<apex:column width="30%" headerValue="Date"><apex:inputField value="{!eventOLI.oli.ServiceDate}"/></apex:column>
<apex:column width="10%" headerValue="Sales Price"><apex:inputField value="{!eventOLI.oli.UnitPrice}"/></apex:column>
<apex:column width="10%" headerValue="Total Sq Footage"><apex:inputField value="{!eventOLI.oli.Total_Square_Footage__c}"/></apex:column>
<apex:column width="10%" headerValue="Booth #"><apex:inputField value="{!eventOLI.oli.Booth__c}"/></apex:column>
<apex:column width="10%" headerValue="# of Attendees"><apex:inputField value="{!eventOLI.oli.of_Attendees__c}"/></apex:column>
</apex:pageBlockTable>
Regardless of whether I use percentages or pixels for the widths, how many columns are specified or whether I sprecify formatting attributes on the columns themselves, all columns are displayed in a single row making the table too wide and causing a horizontal scroll bar to appear as below...

Even more odd, the HTML seems to be generated correctly for when the rendered code is inspected, the colgroup is there for number of columns and the width attributes are there, they just have no effect in both Firefox 3 and IE7.
-
- Dogen Zenji
- June 20, 2008
- Like
- 0
- Continue reading or reply
Messages component not displaying errors
Page
<apex:page controller="OpportunityController" tabStyle="Opportunity"> <apex:sectionHeader title="Brand Selection" subtitle="Step 1 of 2"/> <apex:messages id="msgs" layout="list"/> <apex:form > <apex:pageBlock id="pbSearch" title="Search Criteria" mode="edit"> <apex:pageBlockButtons > <apex:commandButton value="Search" action="{!searchProducts}" rerender="pbResults" status="status"/> </apex:pageBlockButtons> <apex:pageBlockSection columns="2"> <apex:inputField id="picklistLOB" value="{!product.LineofBusiness__c}"/> <apex:inputField id="textName" value="{!product.Name}" required="true"/> <apex:inputField id="textPosition" value="{!product.Product__c}" required="false"/> <apex:inputField id="textPositionDetail" value="{!product.Product_Sub_Category__c}" required="false"/> </apex:pageBlockSection> </apex:pageBlock> <apex:pageBlock id="pbResults" title="Matching Results" mode="detail"> <apex:pageBlockButtons > <apex:commandButton value="Select"/> </apex:pageBlockButtons> <apex:actionStatus id="status" startStyle="font-weight:bold; color:green;" startText="Loading..."> <apex:facet name="stop"> <apex:pageBlockTable value="{!Products}" var="prod"> <apex:column value="{!prod.Name}"/> <apex:column value="{!prod.ProductCode}"/> <apex:column value="{!prod.LineofBusiness__c}"/> </apex:pageBlockTable> </apex:facet> </apex:actionStatus> </apex:pageBlock> <apex:pageBlock id="pbSelected" title="Selected Brands" mode="edit"> <apex:pageBlockButtons > <apex:commandButton value="Remove"/> <apex:commandButton value="Next"/> <apex:commandButton action="{!Cancel}" value="Cancel"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </apex:page>
Controller
public class OpportunityController { private final Opportunity opp; private Product2 product; private Product2[] productArray = new Product2[0]; public OpportunityController() { this.opp = [select Id, Name from Opportunity where Id = :ApexPages.currentPage().getParameters().get('id')]; } public PageReference Cancel() { PageReference oppPage = new PageReference('/' + this.opp.id); oppPage.setRedirect(true); return oppPage; } public Product2 getProduct() { if(product == null) product = new Product2(); return product; } public void setProduct(Product2 p) { product = p; } public Product2[] getProducts() { return productArray; } public PageReference searchProducts() { productArray.clear(); String searchName = product.Name == null— '%': product.Name; String searchPosition = product.Product__c == null– '%': product.Product__c; String searchPositionDetail = product.Product_Sub_Category__c == null˜ '%': product.Product_Sub_Category__c; if(searchName.length() < 3 || searchPosition.length() < 3 || searchPositionDetail.length() < 3) { ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR, 'Please enter a minimum of 3 characters and click Search again.'); ApexPages.addMessage(msg); System.debug(LoggingLevel.ERROR, 'Please enter a minimum of 3 characters and click Search again.'); } for(Product2 p : [select p.Product__c, p.Product_Sub_Category__c, p.ProductCode, p.Name, p.LineofBusiness__c, (select Id from PricebookEntries) from Product2 p where p.LineofBusiness__c = :product.LineofBusiness__c and p.Name like :('%' + searchName + '%') and p.Product__c like :('%' + searchPosition + '%') and p.Product_Sub_Category__c like :('%' + searchPositionDetail + '%') order by p.Name, p.Product__c, p.LineofBusiness__c]) { productArray.add(p); } return null; } }
-
- Dogen Zenji
- June 17, 2008
- Like
- 0
- Continue reading or reply
Simulate Cybersource Hosted Order Page in Apex
Hi All,
I have requirement where I have to implement Cybersource payment gateway in Salesforce.com. I am trying to use Cybersource Hosted Order Page approach to implement this functionality.
Cybersource has provided me some sample JSP pages which I can use in any java based web application and implement the payment gateway within that application and I am able to do that.
Now I have to simulate the same functionality in Salesforce.com using Visualforce and Apex. I am able to simulate most of the code in Apex but got stuck while simulating Message Authentication code and secret key. Below is the code written in java which I need to simulate in Apex.
public String getPublicDigest(String customValues) throws Exception{ String pub = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC2L8taoXQvBV5xddZp58JE2i3rQauaBe1U1lEQCIYNYlIQSt4J6++F6NBgmCx1vnSCX2s4O0FI3S5b/No7QTfKkO19ofJVYBB6hdlcPStHsnYLV9mDmHuFfiR8Ebk3dUWYVCQX+eyZj99WQmYiTPIEZSAuB54jTMRQwyAE5GsVwIDAQAB"; BASE64Encoder encoder = new BASE64Encoder(); Mac sha1Mac = Mac.getInstance("HmacSHA1"); SecretKeySpec publicKeySpec = new SecretKeySpec(pub.getBytes(), "HmacSHA1"); sha1Mac.init(publicKeySpec); byte[] publicBytes = sha1Mac.doFinal(customValues.getBytes()); String publicDigest = encoder.encodeBuffer(publicBytes); return publicDigest.replaceAll("\n", ""); }
Here is the code which I simulated in Apex but the key generated is still invalid.
public String getPublicDigest(String customValues){ String secretKey = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC2L8taoXQvBV5xddZp58JE2i3rQauaBe1U1lEQCIYNYlIQSt4J6++F6NBgmCx1vnSCX2s4O0FI3S5b/No7QTfKkO19ofJVYBB6hdlcPStHsnYLV9mDmHuFfiR8Ebk3dUWYVCQX+eyZj99WQmYiTPIEZSAuB54jTMRQwyAE5GsVwIDAQAB'; //Blob blobDigest = Crypto.generateDigest('hmacSHA1', Blob.valueOf(pub)); Blob sha1Mac = Crypto.generateMac('hmacSHA1', Blob.valueOf(customValues), EncodingUtil.base64Decode(secretKey)); String publicDigest = Encodingutil.convertToHex(sha1Mac); return publicDigest; }
Any help is appreciated.
- ajitverma
- April 28, 2011
- Like
- 0
- Continue reading or reply
Searching Text in Files Uploaded to CRM Content
I was hoping one of you bright people could answer a question regarding SOSL and
Content. In the standard Document object, there is a field called
IsBodySearchable that allows SOSL to search within the file contents of an
uploaded file. I also know that in the latest release, the ContentVersion
object is now searchable with SOSL, and I know that feature was implemented due
to this
idea in the IdeaExchange which specifically asks for searching file content.
However, I don't see that same field on the ContentVersion object and cannot find any
documentation that specifically states that Content file contents can be
searched. I don't want to promise to a client that we can do this
programmatically without seeing it in documentation or getting an
"official" verification from someone internal to SFDC. Thanks community!
- Dogen Zenji
- April 13, 2011
- Like
- 0
- Continue reading or reply
Checking if user is system admin
I want to check if user is system administrator in visual force page. if not then redirect to another page.
Please help me.
- tulikam
- October 26, 2010
- Like
- 0
- Continue reading or reply
Second upsert statement within same Apex transaction does not fire trigger
Good morning everyone! Since one cannot create a lookup field to the standard OpportunityLineItem object, you cannot create a parent child relationship between OLIs as you cannot create a lookup to itself. I am mimicking this relationship by using wrapper classes and setting a text(18) custom field called Parent_OLI_Id__c on the OLI. Naturally, I have to save the parents first to get back their IDs, then save the children using the returned IDs. The following method accomplishes this beautifully...
public static void upsertOLIsFromOLIMs(OpportunityLineItemModel[] olims)
{
OpportunityLineItem[] oliParentsToUpsert = new OpportunityLineItem[0];
//Loop thru incoming OLIMs and extract parents only to upsert array
for(OpportunityLineItemModel olim : olims)
{
if(olim.isParent)
oliParentsToUpsert.add(olim.record);
}
try
{
//Upsert parents
upsert oliParentsToUpsert;
//Loop thru incoming OLIMs again and set parent Id of child records
//which has now been returned from previous upsert call
//Extract children to upsert array
OpportunityLineItem[] oliChildrenToUpsert = new OpportunityLineItem[0];
for(OpportunityLineItemModel olim : olims)
{
if(olim.isParent)
{
for(OpportunityLineItemModel childOLIM : olim.childRecords)
{
childOLIM.record.Parent_OLI_Id__c = olim.record.Id;
oliChildrenToUpsert.add(childOLIM.record);
}
}
}
//Upsert children
upsert oliChildrenToUpsert;
}
catch(DmlException dmle)
{
...
}
}
This method is called from a Save button on a VisualForce page. Enough background, now let's get to the problem. I have a trigger that runs after insert and after update of OLIs but is only firing on the first upsert statement of the method above, when upserting the parents. To prevent infinite recursion I am using the usual trick of setting a static Boolean to true the first time the trigger is run. While grasping at straws, I thought this might be causing the problem so I removed the static Boolean condition and let the trigger run ad infinitum. Every single System.debug statement outputted still showed that only parent OLIs were ever being passed to the trigger. Has anyone seen anything like this? I hope it's just because it's late and I'm doing something wrong...
- Dogen Zenji
- March 12, 2010
- Like
- 0
- Continue reading or reply
Web Service Callout Request/Response Size Governor Limit
- Dogen Zenji
- August 12, 2009
- Like
- 0
- Continue reading or reply
Format Number with comma and decimal
Hi all:
I was wondering if anyone knew how to format a number in VF so that it has a comma and decimal...
for example
40000 would be 40,000.00
So far I have this:
<apex:outputText value="{0}.{1}"> <apex:param value="{!SUBSTITUTE(TEXT(FLOOR(item.Unit_Price__c)), ',', '.' )}"/> <apex:param value="{!RIGHT(TEXT(ROUND((item.Unit_Price__c * 100), 2)),2)}"/> </apex:outputText>
The second one gets the digits after the decimal. but the number shows up as 40000.00
How do I get the comma in there now...
Someone pleaseeee help with any ideas...
- MMA_FORCE
- April 26, 2009
- Like
- 0
- Continue reading or reply
WSDL2Apex - Unable to find complexType
Hello community! I just wanted to start by saying thanks for all your help in previous posts and for posting such handy chunks of knowledge in general. We've been trying to import what I thought was a straightforward WSDL (see below) with no luck. The error returned is...
Error: Unable to find complexType for {http://www.hmco.com/EAI/OTS/Customer}customerID_element
I found the definition for that element and noticed it was defined as a simpleType and though I know the simpleTypes are now supported, just in case, I changed all occurences of simpleType to xsd:string as in this thread. That then got me this error...
Error: Unable to find schema for element; {http://www.w3.org/2001/XMLSchema}string
This last one really stumped me since string is a base type definitely in the W3 schema. Any ideas?
<?xml version="1.0" encoding="UTF-8"?> <!--Created by TIBCO WSDL--> <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.hmco.com/EAI/OTS/Customer/createSundryCustomerImpl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns0="http://www.hmco.com/EAI/OTS/Customer" xmlns:ns1="http://www.hmco.com/EAI" xmlns:ns2="http://www.hmco.com/EAI/OTS/Material" name="Untitled" targetNamespace="http://www.hmco.com/EAI/OTS/Customer/createSundryCustomerImpl"> <wsdl:types> <xsd:schema xmlns="http://www.hmco.com/EAI" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.hmco.com/EAI" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xsd:complexType name="eaiException"> <xsd:sequence> <xsd:element ref="ns1:errorList"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="error"> <xsd:sequence> <xsd:element name="errorCategory" type="xsd:string"/> <xsd:element name="errorCode" type="xsd:string"/> <xsd:element name="errorMessage" type="xsd:string"/> </xsd:sequence> </xsd:complexType> <xsd:element name="asyncRequestId"> <xsd:complexType> <xsd:sequence> <xsd:element ref="ns1:requestId"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="asyncRequestStatus"> <xsd:complexType> <xsd:sequence> <xsd:element name="isReady" type="xsd:boolean"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="error" type="ns1:error"/> <xsd:element name="errorList"> <xsd:complexType> <xsd:sequence> <xsd:element ref="ns1:error" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="requestId" type="xsd:string"/> </xsd:schema>
- Dogen Zenji
- March 10, 2009
- Like
- 0
- Continue reading or reply
Create a New Task with Record Type
[retURL=URLFOR( $Action.Contact.View, Contact.Id)]
)} &recordtype='01280000000EpvVAAS'";
- MRutter
- January 19, 2009
- Like
- 0
- Continue reading or reply
Problem with PageMessages Component?
Save error: Expression Error: Named Object: core.apexpages.components.cdk.ApexComponentRefHandler not found.
Is anyone is experiencing the same thing?
- jonathanrico.
- August 26, 2008
- Like
- 0
- Continue reading or reply
Visualforce standardController methods
Folks,
I am working on a VisualForce page that would list all the Leads with a subset of the fields displayed.
I am using Group Edition hence do not have the luxury of Apex classes (hence controller extensions).
This is the code.
<apex:page standardController="Lead" tabStyle="Lead">
<apex:dataList value="{!view}" var="each" onclick="alert(event);">
{!each.name}, {!each.phone}
</apex:dataList>
</apex:page>
I am aware that view() is the method to view an object. What is the standardController method to list the objects (Lead)?
Andi Giri
- softsquare
- July 25, 2008
- Like
- 0
- Continue reading or reply
ApexPages.addMessage throws Exception in Test Methods
When writing test methods for visualforce page extensions, if there's a section of code inside the extension that creates an error message like the following:
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL, 'Custom Error Message'));
Then salesforce throws the following exception:
System.Exception: ApexPages.addMessage can only be called from a Visualforce page, for now I'm getting arround it by wrapping it in a try catch and asserting that the error message is the expected one for ApexPages.addMessage, but I think it should be able to be called during a test.
- Scott.M
- July 15, 2008
- Like
- 0
- Continue reading or reply
remoteFunction call on Visualforce page does not work with IE
- agab
- July 14, 2008
- Like
- 0
- Continue reading or reply
Deploying CustomField changes for standard objects using Force.com IDE
For the User object, I'm getting the following error message:
unable to obtain exclusive access to this record
For the Task object, I'm getting the following error messages:
Field 'Subject' in 'Task' is not a picklist field
Entity Enumeration Or ID: bad value for restricted picklist field: Task
I have been able to deploy changes on the Account and Opportunity, but have been unsuccessful in deploying to User and Task objects.
Thanks
- Scott Fraser
- April 03, 2008
- Like
- 0
- Continue reading or reply