• Dogen Zenji
  • NEWBIE
  • 65 Points
  • Member since 2008

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 28
    Replies
Hello,
 
I am making a sforce.connection.remoteFunction call on a Visualforce page.  This works fine with Firefox, but with IE I get the following error: "Type mismatch".  Has anyone experienced this before?
 
Thanks,
agab-
  • July 14, 2008
  • Like
  • 0

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!

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...

 

Message Edited by Dogen Zenji on 03-12-2010 02:51 AM
Message Edited by Dogen Zenji on 03-12-2010 02:54 AM
Message Edited by Dogen Zenji on 03-12-2010 03:00 AM
The release of Summer 09 increased the governor limit of a SOAP web service callout request/response size to 1MB from 100KB as can be seen in the Apex documentation here.  Can someone please verify that this limit increase also applies to RESTful HTTP request/response web service callouts?  Thanks!
The Apex web services integration documentation states that when making Apex web service callouts, the size of the request and response is limited to 100Kb.  I'm sure the limit applies to the entire SOAP message for SOAP calls and the entire XML payload for HTTP GET/POST but I just wanted to verify.  I'm secretly hoping that the limitation just applies to the actual data being passed back on forth and not the XML markup or the HTTP headers.  Can someone please verify this?

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>

 

 

 

Hello all!  I really appreciate everyone's input on these boards so I just wanted to start by saying thanks.  Perhaps I am missing something but I cannot get a pageBlockTable or dataTable to take any of the formatting attributes like width, columns or columnsWidth.  For example...

Code:
<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.
Message Edited by Dogen Zenji on 07-24-2009 09:21 AM
Message Edited by Dogen Zenji on 07-24-2009 09:23 AM
For the life of me, I can't get error messages to display on an <apex:messages> component.  Neither custom messages nor standard required field messages show in the component though they do show up in the system log.  Any help would be much appreciated!

Page
Code:
<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
Code:
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;
 }
}

 

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.

 

 

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!

I want to check if user is system administrator in visual force page. if not then redirect to another page.

Please help me.

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...

 

Message Edited by Dogen Zenji on 03-12-2010 02:51 AM
Message Edited by Dogen Zenji on 03-12-2010 02:54 AM
Message Edited by Dogen Zenji on 03-12-2010 03:00 AM
The release of Summer 09 increased the governor limit of a SOAP web service callout request/response size to 1MB from 100KB as can be seen in the Apex documentation here.  Can someone please verify that this limit increase also applies to RESTful HTTP request/response web service callouts?  Thanks!

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...

 

 

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>

 

 

 

I am attempting to use an s-control to create a new event (easy enough), but want it to apply to a specific record type.  The following is the code I have tried:
 
<script type="text/javascript">
window.parent.location.href="{!URLFOR($Action.Activity.NewEvent,null,
[retURL=URLFOR( $Action.Contact.View, Contact.Id)]
)} &recordtype='01280000000EpvVAAS'";
</script>
 
This allows me to create a new event, but the default record type is used instead of the one specified in the code.  How do I make this work?
 
Mark
Hello everyone, im getting the following error when inserting the pageMessages component in the sandbox enviornment:

Save error: Expression Error: Named Object: core.apexpages.components.cdk.ApexComponentRefHandler not found.

Is anyone is experiencing the same thing?

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

Hi,

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:

Code:
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.









Hello,
 
I am making a sforce.connection.remoteFunction call on a Visualforce page.  This works fine with Firefox, but with IE I get the following error: "Type mismatch".  Has anyone experienced this before?
 
Thanks,
agab-
  • July 14, 2008
  • Like
  • 0
Has anyone had any success in deploying CustomField changes to the User or Task standard objects using the 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