• Mitesh Sura
  • NEWBIE
  • 219 Points
  • Member since 2012
  • Salesforce Architect


  • Chatter
    Feed
  • 5
    Best Answers
  • 7
    Likes Received
  • 2
    Likes Given
  • 36
    Questions
  • 169
    Replies

 

I created a custom button for the standard Opportunity object and it works fine when I put it on a standard page layout on the opportunity, but it's not working when trying to use it in my VF page. (Action doesn't perform and I get sent to a "URL no longer exists" page).

 

Button action is essentially to check / uncheck a custom checkbox field, "RFQ_Receipt_Sent__c".

 

Any help is appreciated, hopefully just a small fix?

 

 

Custom Button (Yes_Send) Code:

{!REQUIRESCRIPT("/soap/ajax/19.0/connection.js")} 
var v=new sforce.SObject("Opportunity");
v.RFQ_Receipt_Sent__c="{!Opportunity.RFQ_Receipt_Sent__c}";
v.id = "{!Opportunity.Id}";
v.RFQ_Receipt_Sent__c=="1"

if(v.RFQ_Receipt_Sent__c=="0")
{
v.RFQ_Receipt_Sent__c='1';
result=sforce.connection.update([v]);
alert("Success! The RFQ Receipt has been sent. Click OK to return to the opportunity");
}
else if(v.RFQ_Receipt_Sent__c=="1")
{

result=sforce.connection.update([v]);
alert("Oops! It looks like an RFQ Receipt has previously been sent, so we better not send another automatically. Click OK to return to the opportunity.");
}
window.location.reload();

 

 

 

Simple VF Page:

 

<apex:page standardcontroller="Opportunity" extensions="SendRFQReceiptControl" showHeader="true" sidebar="false">
 <apex:form >

    <apex:sectionHeader title="RFQ Receipt" subtitle="Would you like to send an RFQ Receipt to {!primcontact.Name}?"/>
     <apex:commandButton action="{!URLFOR($Action.Opportunity.Yes_Send)}" value="Yes Send Email Now"/>
      <apex:commandButton action="{!cancel}" value="No - Return to Opportunity"/>

 </apex:form>
</apex:page>

 

 

Controller (used to grab oppty's primary contact info)

 

public class SendRFQReceiptControl {
    public final Contact primContact {get; set;}
    public final Opportunity o {get; set;}
    public SendRFQReceiptControl(ApexPages.StandardController controller) {
        this.o=(Opportunity)controller.getrecord();
        try{
            ID primContactid = [select id,contactid from opportunitycontactrole where opportunityid=:o.id and isprimary=true LIMIT 1].contactid;
            primContact = [select id,name from contact where id=:primContactid limit 1];
        }catch(QueryException qe){
            system.debug('ERROR Querying contact:'+qe.getmessage());
        }
    }

}

 

Hello All,

 

  A very simple question: How are the AccountContactRole records inserted? I mean right now in our system I see that there accounts and contacts, but no AccountContactRole records generated. Creating a new AccountContactRole through the related list on Account, is that the only way?

 

Greatly appreciate your inputs on this issue.

 

Regards,

KB

i created  field in Opportunity object    i.e Renewal Date.

 

once Product is added  to Particual Opportunity record  then automatically updated Renewal Date with Today Date .using workflow. please help me.......................................

  • February 10, 2012
  • Like
  • 0
If you are just getting started with CTI , I would recommend reading this article https://developer.salesforce.com/forums/?id=906F00000009BAOIA2

I have got unique situation and wondering is someone can help. We are using softphone in Salesforce classic in sidebar panel using 3rd party connector form AppExchange. This works, but now we need to intercept the call for custom search (We are not using Console) and business logic. 3rd party conector does not support classic Salesforce. 

I would think Salesforce Open CTI has javascript libraries to intercept the call and continue with business logic. But under "Methods for CTI" I do not see them: https://developer.salesforce.com/docs/atlas.en-us.api_cti.meta/api_cti/sforce_api_cti_methods_cti.htm

End goal is to use connector to connect Salesforce and call center and then use Open CTI framework to intercept incoming and outgoing calls. 
Salesforce classic had dedicated URL to "Choose Priceook" but not in  Lightning. We have custom VF page to add products and wondering what is best way to route users to select pricebook if one does not exist in Lightning.

Flow
- Click custom "Add Products" button
- Check if Pricebook is attached to opportunity
- Redirect to "Choose Pricebook"
- User selects the pricebook and then redirect back to custom VF page

Above flow is working in classic and need to make it workin in Lighrning. 
Need some help with images on PDF. There are few posts on developer forum but none seem to be help. I have a image stored on external server which is showing in Salesforce UI, but not on PDF. 
 
Here are the scenarios I tested
- VF render as PDF and image on static resource - WORKS
- VF render as HTML and image on external server - WORKS
- VF render as PDF and image on external server - DOES NOT WORK
 
Image size is 26kb and external domain is stored under remote site settings. Has anyone come across this? 
Hi,

When connecting to endpoint , I was seeing below error message, it turns out they were not sending response back to Salesforce in correct format. Now they fixed that , but I am seeing "Access Denied" error message. It does not give any other information. My gut feeling tells me that the response is still not sent in the format acceptable to Salesforce. Any idea what is going on? 

Initially error message: org.xml.sax.SAXException: Value not valid for type xsd:boolean, should be '0', '1', 'true' or 'false' Value not valid for type x
New error message: Access Denied
 
We have API connection with external system. They cannot use same session and hence will be requesting new session (previous session will still be active) each time they connect with Salesforce.

Can someone please explain:
- What happens to previous sessions?
- Do they expire automatically after 120 minutes?
- At a given time, how many active session there can be?
- What are the implications of multiple open sessions at given point in time? 

regards
Mitesh
Hi,

We have a custome webservice in Salesforce which needs to integrated with our middleware. Is below best way to communicate?
Step 1: pass the custom webservice wsdl and enterprise wsdl to middleware
Step 2: middleware can get the session id using enterprise wsdl
Step 3: use this session to call custom web service wsdl

Is there any other way to call custome wsdl from middleware? 

regards
Mitesh
Hi, 

We have need to create Quote PDF documents upon apprval. The flow is trigger ==> @Future Class ==> REST (HTTP Post) . While this works for internal users, community users get below error. The user is the opportunity and quote owner. Also the profile has access to all apex classes. 

Error: 
EXCEPTION_THROWN|[23]|System.DmlException: Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary.: [NetworkId]

REST Class
@RestResource(urlMapping='/savePDF/*')
global class savePDF{
    
    @HttpPost
    global static void savePDF(list<string> quote_template_id) {
        system.debug('quote_template_id ' + quote_template_id);
        string quoteId, templateId;
        PageReference pageRef;
        Blob pdf;
        list<QuoteDocument> docs = new list<QuoteDocument>();
        
        for(string q : quote_template_id){
            if(q.contains('::')){
                quoteId = q.split('::')[0];
                templateId = q.split('::')[1];
                pageRef = new PageReference('/quote/quoteTemplateDataViewer.apexp?id=' +quoteId+ '&headerHeight=109&footerHeight=10&summlid=' +templateId+ '#toolbar=1&navpanes=0&zoom=90');
                pdf = pageRef.getContentAsPdf();         
                docs.add(new QuoteDocument(Document=pdf, QuoteId=quoteId));
            }
        }
        
        if(docs.size() > 0)
            insert docs;
    }
}



Hi,

I have a custom VF page that adds products to opportunity and quote. The page defination is something like this. 
<apex:page controller "Opportunity" extensions="AddController">

</apex:page>

While adding products works, it does not do default scheduling like standard "Add Product" button. I am ssuming the standard controller on the page should be "OpportunityLineItem" instead of "Opportunity" Is that true? 

Any other pointers? 
I am doing simple alert and the id in the alert does not match with actual id of "prodSalePrice" input field. I have highlighted the difference ( 7 vs 9) above.

Any clue why the id does not match. I think {!$Component} tag is not used correctly
<apex:repeat value="{!fieldSet}" var="f">
                                
   !-- Product quantity -->     
   <apex:column headerValue="{!f.Label}" rendered="{!f.fieldPath=='Quantity'}" width="50px"> 
      <apex:inputText id="prodQuantity" value="{!wP.quantity}" onchange="alert('{!$Component.prodSalePrice}');" />
   </apex:column>   
       
   /// Above alert: j_id0:form:j_id233:j_id241:j_id242:sectionProducts:0:j_id252:7:prodSalePrice ///
			        			
   <!-- Product sale price -->
   <apex:column headerValue="{!f.Label}" rendered="{!f.fieldPath=='UnitPrice'}" width="100px">
      <apex:inputText id="prodSalePrice" value="{!wP.salePrice}" />
   </apex:column>   

   /// Actual id: j_id0:form:j_id233:j_id241:j_id242:sectionProducts:0:j_id252:9:prodSalePrice ///

</apex:repeat>


Need some guidance on private key for Visual Force pages that are generated as PDF. We have a VF page that generates quotes and proposals from Quote object. Our need is to digitally sign the document before sending it to customer using "private key" to discourage forging.

Any pointers? I found this crypto class documentation https://developer.salesforce.com/page/Apex_Crypto_Class Am I heading in right direction?

regards
Mitesh
I am in catch 22 situation. Need to delete custom object from managed package which is not referenced anywhere but as global variable in apex class. That variable itself is not needed, but cannot delete it because it is global variable.

I found this post, but neither solution is possible. https://developer.salesforce.com/forums/ForumsMain?id=906F000000090VqIAI

Any thoughts?

regards
Mitesh
what is most easiest way to override standard edit page with VF page in edit mode? I know there is old school way where you need to define all the fields and markup. Is there anything new in newer versions which makes it little simpler? 

regards
Mitesh
I am building custom VF page for "Add Products". For most part it works fine, but it does create "OpportunityLineItemSchedule" records like standard "Add Products" screen.

What am I missing? Is there a way to set certain parameters to parent OpportunityLineItem object to achieve this? I found few examples on creating "OpportunityLineItemSchedule" records manually, but I would like to avoid that if Salesforce can do that automatically for me.

Thank you for your time.

regards
Mitesh
Hello! all,

I have most simple VF page and still renderAs="PDF" and alternatte row style (table tr:nth-child) wont work in Chrome and FF. If I replace PDF with HTML, it works just fine.

I tried both background and background-color. Thank you in advance.

------------------------------------------------VF Markup --------------------------------------------

<apex:page showHeader="false" title="Quote PDF" cache="true" renderAs="pdf">

<head>
    <style>
        table tr:nth-child(even) {
            background: #C6C6C6;
        }
        table tr:nth-child(odd) {
            background: #FF00FF;
        }
    </style>
</head>

<apex:form >

    <table style="border-collapse: collapse;">     
        <tr>
            <td>
                Row 1 Td 1
            </td>
            <td>
                Row 1 Td 2
            </td>          
        </tr>

        <tr>
            <td>
                Row 2 Td 1
            </td>
            <td>
                Row 2 Td 2
            </td>

Need help displaying HTML table as tooltip. I got below code from other thread. It works fine, but it displays HTML as OutputText. 

 

Any idea how I can modify this to show HTML as mouseover? Thanks. 

 

Class

public Component.Apex.OutputText getGadgetHTMLContent(){
           Component.Apex.OutputText oppText = new Component.Apex.OutputText(escape = false);
           oppText.value = gadgetContent;       //gadgetcontent is the variable which holds the HTML content
           return oppText ;
}

VF Page

<apex:outputPanel rendered="{!gadgetHTMLContent!= null}" layout="none">
          <apex:dynamicComponent componentValue="{!gadgetHTMLContent}"/>
</apex:outputpanel>

is there a way to bulkify field.getDescribe?

 

for(Schema.SObjectField sfield : fieldMap.Values()){
  schema.describefieldresult dfield = sfield.getDescribe();
  if(dfield.isCalcualted()){ 
    //some code
  } 
  else {
    //some code
  }
}

 

I just want to bypass formula fields for certain sObject. If the object has more than 100 fields, this will fail. What are my options?

I have a simple VF page that is rendered as PDF. I am able to page break, but it is not consistent. Please see below link. All highlighted part is just one line and it should be shown next to description. But it does not and make it difficult to read for end customer as description is on next page, but pricing, and other details are on previous page. 

 

PDF image: https://docs.google.com/file/d/0B78Ci2ATrMf8UjZCdXkwWFFpQk0/edit?usp=sharing

 

VF page

     <apex:outputPanel rendered="{!columns.size>0}">
                <table style="width:100%; -fs-table-paginate: paginate; background-color:#C6C6C6;">                     
                    <!-- Column Headers -->
                    <thead>
                        <tr>    
                            <apex:repeat value="{!columns}" var="c">
                                <th>{!c.Name}</th>                          
                            </apex:repeat>
                        </tr> 
                    </thead>

                    <!-- Rows -->  
                    <apex:repeat value="{!pdf_items}" var="i"> 
                    	<!-- Item -->
                        <tr>  
                            <td>
                                {!i.lineNumber}
                            </td>
                            <apex:repeat value="{!columns}" var="c">
                                <td>                                    
                                    <!-- Item -->            
                                    <apex:outputPanel layout="block" >
			                        	<apex:outputText value="{!i.sObj[c.Quote_line_item_API_name__c])}" escape="false" />
                                    </apex:outputPanel>  
                                </td>
                            </apex:repeat>   
                        </tr>
                    </apex:repeat> 
                </table>  
            </apex:outputPanel>

 

 

I found one article that describes the issue http://cloud-computing-expert.blogspot.com/2012/04/generating-salesforcecom-quotes-pdf_11.html 

 

Any suggestions what can be done? Thank you for your time. 

Looks like I am missing the name attribute for outputLinks, but there is no such thing as name fot the tag.

 

Like you see in the code I tried "link.expressions.Value" too.

 

public Component.Apex.OutputPanel getLinks(){
		Component.Apex.OutputPanel pnl = new Component.Apex.OutputPanel();
		for(string id : recentItems) {
			
			Component.Apex.outputLink link = new Component.Apex.outputLink(value='/'+id, title=id);		
			//link.expressions.Value = '/{!id}';	This does not work either
			pnl.childComponents.add(link);	
		}
		return pnl;
    } 

 I see the links if I do inspect element, but they are not displayed on the page.

 

<span id="j_id0:j_id1:j_id6_0">
  <a href="https://na9.salesforce.com/001E000000iWHSLIA4" title="001E000000iWHSLIA4"></a>
  <a href="https://na9.salesforce.com/001E000000iWHSMIA4" title="001E000000iWHSMIA4"></a>
</span>

 

What am i missing here?

 

Thanks in advnace.

 

 

Here is the thing, I have few required fields and country and state picklist. I would like country and state to function irrepctecive of values in required fields.

 

I see some posts which says to remove requires=true for the fields and move the validation in the controller. I really do not want to do that. Below is the snippet, what esle can be done?

 

 

<apex:selectList value="{!country}" size="1"> 
  <apex:selectOptions value="{!Countries}" /> 
  <apex:actionSupport event="onchange" rerender="states" immediate="true" /> 
</apex:selectList> 

<apex:outputPanel id="states" > 
  <apex:selectList value="{!state}" size="1"> 
    <apex:selectOptions value="{!States}" /> 
  </apex:selectList> 
</apex:outputPanel> 

 Above code will work if have required=false and all required fields have a value.

 

Thank you for your time.

 

 

 

Looks like a bug to me unless someone tells me I am doing something wrong.

 

Cannot add straight HTML to outputText if the value is dynamic. On other hand if it same value, but provided as static value it works fine. Please see below:

 

Component.Apex.outputText txt = new Component.Apex.outputText(value=dynamicValue, escape=false); // DOES NOT WORK
			
Component.Apex.OutputText txt = new Component.Apex.OutputText(value='<b>A Heading</b>', escape=false); //WORKS FINE

//dynamicValue is same as "<b>A Heading</b>", but it won't work. 

 

 

We have API connection with external system. They cannot use same session and hence will be requesting new session (previous session will still be active) each time they connect with Salesforce.

Can someone please explain:
- What happens to previous sessions?
- Do they expire automatically after 120 minutes?
- At a given time, how many active session there can be?
- What are the implications of multiple open sessions at given point in time? 

regards
Mitesh
I am building custom VF page for "Add Products". For most part it works fine, but it does create "OpportunityLineItemSchedule" records like standard "Add Products" screen.

What am I missing? Is there a way to set certain parameters to parent OpportunityLineItem object to achieve this? I found few examples on creating "OpportunityLineItemSchedule" records manually, but I would like to avoid that if Salesforce can do that automatically for me.

Thank you for your time.

regards
Mitesh
Hello! all,

I have most simple VF page and still renderAs="PDF" and alternatte row style (table tr:nth-child) wont work in Chrome and FF. If I replace PDF with HTML, it works just fine.

I tried both background and background-color. Thank you in advance.

------------------------------------------------VF Markup --------------------------------------------

<apex:page showHeader="false" title="Quote PDF" cache="true" renderAs="pdf">

<head>
    <style>
        table tr:nth-child(even) {
            background: #C6C6C6;
        }
        table tr:nth-child(odd) {
            background: #FF00FF;
        }
    </style>
</head>

<apex:form >

    <table style="border-collapse: collapse;">     
        <tr>
            <td>
                Row 1 Td 1
            </td>
            <td>
                Row 1 Td 2
            </td>          
        </tr>

        <tr>
            <td>
                Row 2 Td 1
            </td>
            <td>
                Row 2 Td 2
            </td>

Need help displaying HTML table as tooltip. I got below code from other thread. It works fine, but it displays HTML as OutputText. 

 

Any idea how I can modify this to show HTML as mouseover? Thanks. 

 

Class

public Component.Apex.OutputText getGadgetHTMLContent(){
           Component.Apex.OutputText oppText = new Component.Apex.OutputText(escape = false);
           oppText.value = gadgetContent;       //gadgetcontent is the variable which holds the HTML content
           return oppText ;
}

VF Page

<apex:outputPanel rendered="{!gadgetHTMLContent!= null}" layout="none">
          <apex:dynamicComponent componentValue="{!gadgetHTMLContent}"/>
</apex:outputpanel>

Dear Users,

 

If you must buildi a dynamic SOQL query, something like below, 

qryString += 'AND ' +filterField+ ' LIKE \'' +filterValue+ '%\' ';

 atleast have getter and setter methods defined something like this

    public String filterValue {
        get{return filterValue;}
        set{
        	if(value!=null)
            	filterValue = String.escapeSingleQuotes(value);
        	else
            	filterValue='';            
        }
    }
    public String filterField {
        get{return filterField;}
        set{
        	if(value!=null)
            	filterField = String.escapeSingleQuotes(value);
        	else
            	filterField ='';          
        }
    }

 This would prevent SOQL injection if user enters something like ' OR 1==1;/*  in the VF page. 

 

Feedback / Comments welcome. 

 

regards

SF Partner

how to fecth data in map collection ?
Hi,

The bulk API example code: https://developer.salesforce.com/docs/atlas.en-us.200.0.api_asynch.meta/api_asynch/asynch_api_code_set_up_client.htm

The documentation says you need only partner.jar and wsc.jar.
Yet, when I compile the code I get the error...related to some JSON parsing library

Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/jackson/ObjectCodec
at BulkExample.getBulkConnection(BulkExample.java:177)
at BulkExample.runSample(BulkExample.java:28)
at BulkExample.main(BulkExample.java:19)
Caused by: java.lang.ClassNotFoundException: org.codehaus.jackson.ObjectCodec
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 3 more

Any help would be greatly appreciated...
 
Hi everyone,
I'm developping an automatic email in an apex class.

I'm trying to link my email to a quote with the methode setWhatId, but it don't work with quote...

Can you help me or give me another solution plese ?

This is my code:
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
List<String> sendTo = new List<String>();
sendTo.add('XXXX@XXXX.XXX');
mail.setToAddresses(sendTo);
mail.setTargetObjectId(quote.ContactId);
mail.setReplyTo('XXXX@XXXX.XXX');
mail.setTemplateId('XXXXXXXXXXXX');
mail.setwhatid(quote.Id);
mail.setSaveAsActivity(true);
Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});

Thanks.
Hello expert,

I am displaying all attachment on vf page, vf page set as render as pdf. It is displaying all 
the attachment if attachment is image but it doesn't displaying attached pdf. I am using iframe
for showing pdf but it is not working with render as pdf.

Please provide some solution. Thanks in advanced.
We have API connection with external system. They cannot use same session and hence will be requesting new session (previous session will still be active) each time they connect with Salesforce.

Can someone please explain:
- What happens to previous sessions?
- Do they expire automatically after 120 minutes?
- At a given time, how many active session there can be?
- What are the implications of multiple open sessions at given point in time? 

regards
Mitesh
Hello All,

I currently have an APEX trigger which (when an opportunity has a QUOTE and is closed won), creates a second quote (which will be used as an invoice)

I was wondering if anyone can help me with possibly editing this code to also pull the Opportunity Line Items and add a quote line item for each one in the new automatically generated quote?

For example, If I have the Opportunity Line Item "Dog" from the "Animals" Pricebook at "$100" how can I change the code to not only automatically create the quote but also add a Quote Line Item for a $100 Dog?

Here is my code:

trigger InvoicefromQuote on Opportunity (after insert, after update) {
Map<Quote, Id> quoteMap = new Map<Quote, Id>();
for (Opportunity o : Trigger.new) {
if(o.isWon == true && o.HasQuote__c == true ){
Quote q = new Quote();
q.name = 'Quote-' + o.name;
q.opportunityId = o.id;
insert q;
quoteMap.put(q, o.accountId);
}
}
}

Any help you can provide would be great!


Thank you!


I am building custom VF page for "Add Products". For most part it works fine, but it does create "OpportunityLineItemSchedule" records like standard "Add Products" screen.

What am I missing? Is there a way to set certain parameters to parent OpportunityLineItem object to achieve this? I found few examples on creating "OpportunityLineItemSchedule" records manually, but I would like to avoid that if Salesforce can do that automatically for me.

Thank you for your time.

regards
Mitesh
I have a regular old PDF file on my desktop, and that same PDF file is attached to a record in Salesforce.  Now, when I change the PDF's extension on my computer to ".txt", I can then open it and read the texttual data that makes up the file.  I need to extract some data at the beginning of the ".txt" version of the file that details how many pages the PDF consists of, but I need to do this for many PDF files that are already in Salesforce.

I discovered the "String pdf = System.EncodingUtil.base64Encode(a.Body)" method, which apparently converts the base64 blob representation of the file into an unencoded string... but when I looked at the actual output, I realized that it was totally different compared to the ".txt" version of the PDF on my desktop.  It seems that I'm not encoding/decoding the attachment Body blob to the correct format, but I'm totally clueless as to what to convert it to, or what method I would need to use to convert it.

Does anyone have any ideas as to how I would convert the PDF data to whatever format it gets converted to when I just change the extension on my computer and view it in notepad?

Thanks!


Hi

I am trying to read the content of an attachment from an apex class. 

 Attachment att=   [Select Id,a.ParentId, a.Name,a.body,a.ContentType From Attachment a where ParentId=:contactId limit 1];
           System.debug('Attachment body : '+ att.body);
        System.debug('Attachment body : '+ att.ContentType);

 the attachment body  content is displayed as :Blob[176680].
the body of the attachment is base64. I want to see the content of the body in plain english.

 

Thanks

Hi,

 

Is there a way to get the namespace prefix of the organization in apex?  

 

Thanks in advance.

 

Regards,

Dipak

  • September 14, 2012
  • Like
  • 0

 If @isTest(SeeAllData=false) working for anyone?

I have annotated the class as well as the method but the testmethod can see the existing data.

Here is simple code snippet. Assertion is getting failed for me...

@isTest(SeeAllData=false)
private class testAnnotationSeeAllData {

static testmethod void myUnitTest()
{
Test.startTest();
List<User> lstUsers = [Select Id, Name From User Where IsActive= true Limit 100];
System.assert(lstUsers.size() == 0);
Test.stopTest();
}
}

tried in api version 24 and 25 both. and Developer Org and Sandbox.


is there anyone who is experiencing the same problem?

Hi;

 

I've been googling all over the place and found that you can supposedly mass delete reports using the IDE.  Since I used it a month ago to blow up some Apex classes, I decided to give it a try and "destructively remove" a bunch of garbage reports and dashboards my org inherited ( thinking I'd try views  right after :-?  )

 

After waiting almost an hour for the query so finish polling the selected metadata (about halfway through the list of reports), I selected a couple and hit DELETE.  The IDE asks if I want them deleted on both sides, I select yes and the report folders are not listed in the IDE anymore.  -So far, right as the couple blogs I googled state it works.

 

Then I'd go to my org in the browser, search for the report folders.... and there they are !

I selected  just one and hit Delete. Nothing either.

 

So it didn't delete. Alright, perhaps I should save the src folder with the server ??? Nope. Doesn't do anything but show useless prompts.

 

Perhaps sync with server ? That takes me to the Sync Team screen, where I delete again,   re-sync and .... Nothing. My indestructible SFDC reports are still there.

 

So I finally read that the forcecom literature states that the 'package.xml'  file must be renamed to 'destructive changes.xml'... Right.... "Renaming not supported in this IDE, go use Salesforce" !!!

 

It might be extremely evident how frustrating this is for me. I would apreciate it a lot if someone shows me what the correct procedure is nowadays since what I found in the web posts doesn't work at all.

 

Thanks in advance

 

 

 


I know we can format with the apex:outputText component, and the documentation refers to some java documentation:

 

"Use with nested param tags to format the text values, where {n} corresponds to the n-th nested param tag. The value attribute supports the same syntax as the MessageFormat class in Java. See the MessageFormat class JavaDocs for more information." (http://www.salesforce.com/us/developer/docs/pages/index_Left.htm#CSHID=pages_compref.htm|StartTopic=Content%2Fpages_compref.htm|SkinName=webhelp

 

Disregarding the move of that javadocs page, you can easily find the current documentations. But I can't seem to find any references on how to build patterns, or which patterns are possible to use. 

 

I've got a currency field in a  non SObject, so I can't use an outputfield to display it. I've been using a outputText with reasonable luck, see below.

 

<apex:outputText value="€ {0, number, ###,###.##}">
        <apex:param value="{!someCurrencyField}"/>
</apex:outputText> 

 

The only remaining issue, is to go from American decimal notation, to European,  atm it will display 10,000.55 , while my requirements are that to be 10.000,55.  I know a lot can be done with string functions, subtitute if contains etc. I know how to use those, I want to learn how to use format patterns appropriately and can not locatie information. Is there any ? 

 

Thanks to anyone who can provide some references, url's or a solution pattern for the above case.

 

 

Hi Apex experts,

Looking at Attachment declaration I noticed that Body field is of type Base64.

The Body is an encoded data of a file.

Now, How can I decode the Body data? So I'll get the original contents of the file (it may be in bytes because I can use convert).

 

Another question.

Lets' say that I have the files data. How can I pass its data to me WebService written in C#? (what kind of type shall I use?)

 

Thank you so much!

 

 

Who has experience with this app? I am using it to sychronize opportunity product custom fields with quote item custom fields. It works fine however I as soon as the custom fields work with default values, validation rules, workflows I get error messages...  Can anybody help? - Thanks in advance. Reto

Ok, I know there are a lot of posts on this topic, and I am familiar with the two Visualforce techniques for doing this (using an outputField bound to an SObject currency field, and using the outputText value="{0,number,###,##0.00}" ). However, in my use case, I'm trying to display a currency value in the title of a pageBlock:

 

 

<apex:pageBlock title="Refund Amount: {!refundAmount}" >

 

I can't really use the outputText or outputField options here, so I think I need to do the formatting in my controller. The Apex documentation states that String.format(String, List<String>) works "in the same manner as apex:outputText." Has anyone actually used this method to format a Decimal value into a properly formatted currency String in Apex code?

  • November 17, 2010
  • Like
  • 0

Hi All,

 

:smileysad::smileysad:

 

I am trying to use Bulk API instead of dataloader for loading bulk data into salesforce.
In Bulk API Developer's Guide , The following steps are mentioned to create a JAR file
of partner wsdl using wsc-18.jar file and to include both the jar files in library.

 

To download the Salesforce.com WSC toolkit:

1. Browse to http://code.google.com/p/sfdc-wsc/
2. Click the Downloads tab.
3. Click the wsc-18.jar link and save the file to a local directory.
The Bulk API does not provide a login operation, so you must use the SOAP Web services API to login.

To download the partner WSDL and compile it to Java classes with the WSC toolkit:
1. Log in to your Developer Edition Salesforce.com account. You must log in as an administrator or as a user who has the
“Modify All Data” permission. Logins are checked to ensure they are from a known IP address. For more information,
see “Setting Login Restrictions” in the Salesforce.com online help.
2. Navigate to Setup ? Develop ? API.
3. Right-click Partner WSDL to display your browser's save options, and save the partner WSDL to a local directory. For
information about the partner WSDL, see Using the Partner WSDL.
4. Compile the partner API code from the WSDL using the WSC compile tool:
java -classpath pathToJar\wsc.jar com.sforce.ws.tools.wsdlc pathToWSDL\wsdlFilename
.\wsdlGenFiles.jar


For example, if wsc.jar is installed in C:\salesforce\wsc, and the partner WSDL is saved to
C:\salesforce\wsdl\partner:
java -classpath C:\salesforce\wsc\wsc-18.jar com.sforce.ws.tools.wsdlc
C:\salesforce\wsdl\partner\partner.wsdl .\partner.jar
wsc.jar and the generated partner.jar are the only libraries needed in the classpath for the code examples in the
following sections.

 

Now when i try running the wsc-18 jar file in jdk1.6 using commandprompt or eclipse , its throwing the exception -
java.lang.ClassFormatError: LVTT entry for 'ent' in class file com/sforce/ws/transport/JdkHttpTransport does not match any LVT entry
at java.lang.ClassLoader.defineClass1(Native Method)

(JdkHttpTransport is a class in com.sforce.ws.transport package of wsc-18 jar)
 
if i run the wsc-18 jar in jdk1.5 , its throwing the exception - java.lang.unsupportedclassversionerror.

Please help me in solving this issue.

:smileysad:

 

TIA

- Sushupsi 

Hi,

is it possbile to delete custom fields from a custom objects by using the metadata api in eclipse ? 

Currently when I do this, the .object files is refreshed with the previous content.

 

Thanks in advance

Hi - hopefully a simple question.

 

I'm trying to create a custom button to send a template email to the lead.

 

I've found some relevant board posts but they all seem for more complicated uses - I'm simply looking for a button that would mimic the following:

 

Activity:Send An Email

Select Template

[template id]

Send

 

Does that make sense?  I'm familiar with how to create buttons, I just can't figure out the syntax.   

Hi Developers,

I am attempting to make a request to the endpoint /oppitm/lineitemsort.jsp from a visual force page to sort OLIs. However, it is my understanding that in order to make post request like this I will need the CSRF token present in the request. I am trying to do this but I am having difficutly getting the correct token. I try to retrieve the token with the following ajax request:
$j.ajax({
                 url:"./oppitm/lineitemsort.jsp?id={!oppId}",
                 contentType:"text/html",
                 xhrFields:{withCredentials:true},
            }).done (function(data){
                key_start='csrfToken="';
                key_end='"';
                pos_start=data.indexOf(key_start);
                pos_end=data.indexOf(key_end,pos_start+key_start.length);
                var token=data.substring(pos_start+key_start.length,pos_end);
            });
});

But I continually get redirected to "Unable to access page." when using the CSRF token that is returned.  My understanding is that Visual Force will store the CSRF token in the form under an input with id "com.salesforce.visualforce.ViewStateCSRF" following a post, so I have been trying to get the token that way. But all attempts to do so result in an empty value in that element. Any ideas when that is appending to the form and how I can get it?
  • April 29, 2015
  • Like
  • 1
I wanted to reach out and see if the following two projects we'd like help with are feasible and if so, what it might cost us.

First-we would love a custom clone button that clones the existing record along with the related records on the record's related list. The record is basically kind of a middle child in the hierarchy-it has a parent but it also has child records associated with it. When we clone it, we'd like to clone the record and its child records. 

Second-we'd love to automate some record creation based on when a new Contact record is created. What records would be created would be dependent on contact record type. Whenever we have certain contacts created, we will always need certain child records. Right now I am manually creating them (they're just basic records that house other related child records like "Medical Information" which has related lists for Medications, Appointments, etc.), but I'd like to not have to remember to do this for every new contact created. 

I am happy to give more detail about what we're specifically looking for, but wanted to first throw this out there and see if anyone was interested in helping out. We are a non-profit agency so our budget is small. We may not be able to make it work financially but wanted to see what it may cost. We do not have a developer on staff-I have learned a lot and am pretty handy with Salesforce but don't know Apex, etc. So you'd be working with someone who has strong administrative knowledge, just no coding experience.

Thanks,

Blair