• Federico Larsen
  • NEWBIE
  • 40 Points
  • Member since 2006
  • founder
  • Larsen Consulting


  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 28
    Replies

Hi all,

 

We are generating quotes from Salesforce using Visualforce and rendering the page as PDF.

 

We are trying to display discounts only on line items that have a discount using the following code:

 

 

<apex:repeat value="{!Opportunity.OpportunityLineItems}" var="line"> <tr> <td>{!line.PricebookEntry.Product2.ProductCode}</td> <td align="right"><apex:OutputText value="{!ROUND(line.Quantity,0)}"/></td> <td>&nbsp;{!line.Description}</td> <td align="right"><apex:OutputField value="{!line.UnitPrice}"/></td> <td align="right"><apex:OutputField value="{!line.TotalPrice}"/></td> </tr> <apex:outputPanel id="Discounts" rendered="{!IF(AND(ISPICKVAL(Opportunity.Transport_Charges__c, "Producto Level"), line.Discount__c > 0.0), true, false)}"> <tr> <td align="right" colspan="5">Descuento <apex:OutputField value="{!line.Discount__c}"/></td> </tr> </apex:outputPanel> </apex:repeat>

 

 However this is not working properly. I will explain the 2 problems we are facing:

 

  1. Rendered condition - The below formula does not work properly. Even though Transport_Charges__c is a PICKLIST fiel, Visualforce throws up an error when saying it is a text field. If we try to change the expression to Opportunity.Transport_Charges__c == "Product Level" it does not work. Any ideas why?
    IF(AND(ISPICKVAL(Opportunity.Transport_Charges__c, "Producto Level"), line.Discount__c > 0.0), true, false)
  2. Conditional line not displaying correctly - For test purposes, until we solve point 1 above, we have used a condition that always evaluates to true. Now we can see the line speciying the discount level, but the line does not print with the same length as the other lines (see image below). This does not seem to make any sense. Any help much appreciated.
Error Screen Shot

 

Hi all,

When doing a describe metadata, api returns PersonAccount and Account recordtypes mixed all together.

for example (and can be verified with the https://workbench.developerforce.com):

a normal account recordType will return:

fileName: objects/Account.object
fullName: Account.School
type: RecordType

a person account recordtype

fileName: objects/Account.object
fullName: Account.Professor
type: RecordType

therefore, using this information to create a Package.xml for the person account recordType will fail saying:

[sf:retrieve] package.xml - Entity of type 'RecordType' named 'Account.Professor' cannot be found

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>Account.Professor</members>
        <name>RecordType</name>
    </types>
    <version>30.0</version>
</Package>

the same for the normal account will work and xml will be downlaoded under objects/Account.object

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>Account.School</members>
        <name>RecordType</name>
    </types>
    <version>30.0</version>
</Package>

Now, the right way to deploy the personAccount record type is:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>PersonAccount.Professor</members>
        <name>RecordType</name>
    </types>
    <version>30.0</version>
</Package>

this will work and xml will be downlaoded under objects/PersonAccount.object

How can I know if an account recordtype is for Person or Business account, so I can build correctly the Package.xml ?

Thanks for your help in advance.

Hi,

 

I need to generate a two pages pdf file with a VisualForce page.

Is there any way to force a new page?

 

best regards and thanks in advance for any insight.

 

Hi I am writing an Apex Class that updates the currencys exchange rates and I get this error:

 

 DML not allowed on DatedConversionRate

 

I have seen apps, in javascript, and flex that updates the currencies, but why apex can NOT?

 

best regards 

Hi everybody.

I wanted to share this with others Linux users.

The "Mass Update Everything" tools its a cool tool, and I got exited when I saw the screenshots, but, I got dispointed when I saw in the download page, thats only windows and mac where supported. So I downloaded the windows version, to try running it withy wine.... so, I did,

wine setup.exe

And ... when I went to the installation folder ... I realized thats is a java app! The installer, just unzip the files.

So, now I have it running perfect on Linux without any emulator, just a pure java program. BTW is 2.5 Mb zip file (but I migth not be able to distribute it), to unzip an run everywhere, not just linux, windows or mac, any java enabled platform.

So, my question is .... why sfdc guys dont include a zip file with all the jars files in addition to the win and mac installer ???? Its a pitty to have a multi-platform java program limited with to platform-dependent installer

I hope this is usefull for someone.

Best Regards.

Federico.-
Hi everybody,

It is possible to give a specific format to cells on a Report.

I have a matricial report, and cells can have 0, 1, 2, 3, ... decimals.
eg:

1.24  

1.543
2.2


I would like to give a format to all of them, for example:

1.24
1.00
1.54
2.20

Thanks in advance for your help.


Hi everybody,

  I am have developed a multithread service thats has N threads using the same SoapBindingStub binding.

My question is, even thoung I have no concurrency problems, If I have only one binding, all the API calls are being sequencials or in parallel?

Thanks in advance.

Message Edited by Federico Larsen on 01-17-2007 06:44 AM

Hi, I am new with de partner API.
I have this basic problem, with the Enterprise API, I am used to do for example, Boolean b = mysobject.getMyBooleanField__c();
or
Double d = mysobject.getAmount();

but in the partner API, how do I get de Deserialized Values?

Thanks
Hi everybody, I would like to run the AJAX Tookit on a Pocket PC 2003 which has an IE thats supports AJAX, i tryied to run a stand-alone html page with de sforceClient.js but It doesn´t work, even doe the browser supports AJAX.

Do you think that modifying the Toolkit to runs on Pocket PC would be a lot of work, or just a couple of hacks?

Thanks a lot for your help.

ps: i tryed the stand-alone html page and works ok on my desktop over IE and Firefox.
ps2: It does runs on Mozilla minimo neither on the Pocket PC.
Hi,

i am trying to retrieve a document (text/html) and use its content, but i cant do it yet, this is the code i am using.

Code:
function getHeadHTML(){
    var docs = sforceClient.Retrieve("Body","Document",[_tpl_doc_ID]);
    if (docs != null && docs.length > 0){
     var doc = docs[i];
     var body64 = doc.get("Body");
     var body = decode64(body64.textContent);
     return body;
    }
    else{
     alert("Error.");
    }
    
   }

 

Hi there,

I tryied this code to send an Email from a S-Control using the Toolkit AJAX, but even though the EmailMessage is created an associeted with the case, the Email is not processed by the Salesforce mail Server, so the Email Message appears like Sent but is Not.

function sendMail(){
setMsg("Sending Email Message...");
var ts = sforceClient.GetServerTimestamp().timeStamp;
_mail = new Sforce.Dynabean("EmailMessage");
_mail.set("FromAddress", "anyadress@myserver.com");
_mail.set("FromName", "Any Name");
_mail.set("HasAttachment", false);
_mail.set("Incoming", false);
_mail.set("MessageDate", ts);
_mail.set("ParentId", caseId);
_mail.set("FromName", "Any Name");
_mail.set("Subject", "Any Subject");
_mail.set("TextBody", "test envio from sforce-control\ntest envio from sforce-control\ntest envio from sforce-control");
_mail.set("ToAddress", "marcelo@virtualcompanyservices.com");
_mail.set("BccAddress", "federico.larsen@gmail.com");

sforceClient.Create([_mail], mailCallback);
}

function mailCallback(saveResult) {
if (saveResult[0].success == true) {
setMsg("Sending Mail. OK");
closeReload();
} else {
setMsg("Error sending mail: " + saveResult[0].errors[0].message);
}
}


Thanks a lot in advance for your help.

Federico.-
I have created a custom action on a custom object that launches a Visualforce page.  It works great, but I am unable to export the XML behind the action.  In Eclipse if I Add/Remove metadata components it is in the list, but when I select it nothing exports.  I have also tried using the ANT tools and did a bulk retrieve by type "QuickAction" and while it is in the list of records to export I see this message:

[sf:bulkRetrieve] package.xml - Entity of type 'QuickAction' named 'ImagesPage' cannot be found

Are there any tips to getting actions pointed to Visualforce pages to export?  I need to update our source repository with the XML in order to propogate the change from one DE to another.

Thanks,
Ross
Hi all,

When doing a describe metadata, api returns PersonAccount and Account recordtypes mixed all together.

for example (and can be verified with the https://workbench.developerforce.com):

a normal account recordType will return:

fileName: objects/Account.object
fullName: Account.School
type: RecordType

a person account recordtype

fileName: objects/Account.object
fullName: Account.Professor
type: RecordType

therefore, using this information to create a Package.xml for the person account recordType will fail saying:

[sf:retrieve] package.xml - Entity of type 'RecordType' named 'Account.Professor' cannot be found

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>Account.Professor</members>
        <name>RecordType</name>
    </types>
    <version>30.0</version>
</Package>

the same for the normal account will work and xml will be downlaoded under objects/Account.object

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>Account.School</members>
        <name>RecordType</name>
    </types>
    <version>30.0</version>
</Package>

Now, the right way to deploy the personAccount record type is:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>PersonAccount.Professor</members>
        <name>RecordType</name>
    </types>
    <version>30.0</version>
</Package>

this will work and xml will be downlaoded under objects/PersonAccount.object

How can I know if an account recordtype is for Person or Business account, so I can build correctly the Package.xml ?

Thanks for your help in advance.

Hi,

 

I need to generate a two pages pdf file with a VisualForce page.

Is there any way to force a new page?

 

best regards and thanks in advance for any insight.

 

Hi I am writing an Apex Class that updates the currencys exchange rates and I get this error:

 

 DML not allowed on DatedConversionRate

 

I have seen apps, in javascript, and flex that updates the currencies, but why apex can NOT?

 

best regards 

Hello,

 

I have a future callout from a time-based trigger. This callout in turn calls a Visualforce page.

On the trigger, UserInfo.getSessionId() returns null, hence the page does not get invoked; the Http callout hits the Salesforce.com login page. Please suggest a way to obtain the sessionid on a Apex trigger invoked by a Time based workflow?

 

What is the validity time for a SFDC sessionid?

 

Andi Giri

Softsquare

www.softsquare.biz

Hi all,

 

We are generating quotes from Salesforce using Visualforce and rendering the page as PDF.

 

We are trying to display discounts only on line items that have a discount using the following code:

 

 

<apex:repeat value="{!Opportunity.OpportunityLineItems}" var="line"> <tr> <td>{!line.PricebookEntry.Product2.ProductCode}</td> <td align="right"><apex:OutputText value="{!ROUND(line.Quantity,0)}"/></td> <td>&nbsp;{!line.Description}</td> <td align="right"><apex:OutputField value="{!line.UnitPrice}"/></td> <td align="right"><apex:OutputField value="{!line.TotalPrice}"/></td> </tr> <apex:outputPanel id="Discounts" rendered="{!IF(AND(ISPICKVAL(Opportunity.Transport_Charges__c, "Producto Level"), line.Discount__c > 0.0), true, false)}"> <tr> <td align="right" colspan="5">Descuento <apex:OutputField value="{!line.Discount__c}"/></td> </tr> </apex:outputPanel> </apex:repeat>

 

 However this is not working properly. I will explain the 2 problems we are facing:

 

  1. Rendered condition - The below formula does not work properly. Even though Transport_Charges__c is a PICKLIST fiel, Visualforce throws up an error when saying it is a text field. If we try to change the expression to Opportunity.Transport_Charges__c == "Product Level" it does not work. Any ideas why?
    IF(AND(ISPICKVAL(Opportunity.Transport_Charges__c, "Producto Level"), line.Discount__c > 0.0), true, false)
  2. Conditional line not displaying correctly - For test purposes, until we solve point 1 above, we have used a condition that always evaluates to true. Now we can see the line speciying the discount level, but the line does not print with the same length as the other lines (see image below). This does not seem to make any sense. Any help much appreciated.
Error Screen Shot

 

Hi all,

   This one puzzles me..plain and simple, the code works but I'm getting null for UserInfo.getSessionId(). Someone tell me why?! :robotmad: Thanks. 

public class AccountUpdater {

//Future annotation to mark the method as async.
@Future(callout=true)
public static void updateAccount(String id, String name) {

//construct an HTTP request
HttpRequest req = new HttpRequest();
User currentUser = [select ServerURL__c from User where id = :UserInfo.getUserId()];
req.setEndpoint('https://example.com/dbaccess/connect.php?sessionid=' + UserInfo.getSessionId() +
'&serverurl=' + currentUser.ServerURL__c + '&module=test&id=' + id);
req.setMethod('GET');

//send the request
Http http = new Http();
HttpResponse res = http.send(req);

//check the response
if (res.getStatusCode() == 200) {
//update account
Account acc = new Account(Id=id);
acc.Description = res.getBody();
update acc;
} else {
System.debug('Callout failed: ' + res);
}
}
}

 

 

I have some Territory Assignment rules based on Account fields that are filled in by a trigger execution. The problem is that the assignment rules never apply in that way, but if the field is modified through Salesforce interface they are applied. I know that there is a SOAP header I have to use when inserting Accounts through API Web services in order to get assignment rules executed, but what about that in Apex?
I haven't found any reference that states that Apex doesn't trigger Territory Assignment rules, but my tests lead me to think so, and it is a very big problem in our org.
Hi everybody,

  I am have developed a multithread service thats has N threads using the same SoapBindingStub binding.

My question is, even thoung I have no concurrency problems, If I have only one binding, all the API calls are being sequencials or in parallel?

Thanks in advance.

Message Edited by Federico Larsen on 01-17-2007 06:44 AM

I notice in the v8 api developers guide under "Outbound Messaging" there is a code snippet for building a "listner" in .Net 2.0.
 
Does anyone know of a java version of this code, maybe with a little more detail? 
 
I consumed the wsdl for my outbound message using axis and the resulting java classes don't seem to resemble the .Net class names referenced in the example.
 
anyone?
  • December 27, 2006
  • Like
  • 0
Hi, I am new with de partner API.
I have this basic problem, with the Enterprise API, I am used to do for example, Boolean b = mysobject.getMyBooleanField__c();
or
Double d = mysobject.getAmount();

but in the partner API, how do I get de Deserialized Values?

Thanks
Hi everybody, I would like to run the AJAX Tookit on a Pocket PC 2003 which has an IE thats supports AJAX, i tryied to run a stand-alone html page with de sforceClient.js but It doesn´t work, even doe the browser supports AJAX.

Do you think that modifying the Toolkit to runs on Pocket PC would be a lot of work, or just a couple of hacks?

Thanks a lot for your help.

ps: i tryed the stand-alone html page and works ok on my desktop over IE and Firefox.
ps2: It does runs on Mozilla minimo neither on the Pocket PC.
Hi,

i am trying to retrieve a document (text/html) and use its content, but i cant do it yet, this is the code i am using.

Code:
function getHeadHTML(){
    var docs = sforceClient.Retrieve("Body","Document",[_tpl_doc_ID]);
    if (docs != null && docs.length > 0){
     var doc = docs[i];
     var body64 = doc.get("Body");
     var body = decode64(body64.textContent);
     return body;
    }
    else{
     alert("Error.");
    }
    
   }

 

Does anybody have a formula for calculating the week number of a given date?
  • March 03, 2006
  • Like
  • 0
Hi,

I am looking for the way to retrieve default value from Member Status Values. thanks.

regards,
sq
Hello DevAngel,

Would it be possible to have records sorted with an option into the query by as many fields (at least two) as we want when we wake sforceclient.Query

for example sforceclient.Query(SOQL_Query,sorting_field1,sorting_field2) or
sforceclient.Query(SOQL_Query,sorting_field) with sorting field being an array.

or something like sforceclient.Querysorted(SOQL,sorting_field)


I have some recursive quick sort scripting in javascript if you want them

contact me chumbert at odyssey-group dot com

Regards

Does anyone know of a best practice for locking down an opportunity after it is closed won? We want to prevent our sales people from changing the amount or name of the opportunity. Security suggests that I change the record owner but that will mess up our reports. I also thought about using record types and creating a read only page layout but it does not appear that I can make all of the fields read only.

My best idea right now is to create an sforce control that would change the record type and write the opportunity name and amount to a text field on the opportunity. Then display a page layout with that text field as read only and no other fields. Sounds like a lot steps. Any other ideas?

Thanks,

Eric