• Alok_Nagarro
  • SMARTIE
  • 980 Points
  • Member since 2010
  • Sr. Salesforce Consultant
  • Nagarro Inc.

  • Chatter
    Feed
  • 37
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 23
    Questions
  • 234
    Replies

Hi ,

     When I am Deleting Account records as Bulk Data Deletion.. My trigger will fire. that time my first Query will execute. and if the size of Query list Have 200. this time  i want to Execute second Query as 200 times . Because of Governar limits it will showing Exception as:Too many SOQL queries: 101” .But i want to execute Second query 200 times  because of Batch size 200 as default . so my requirement is second query has to execute 200 times.   

I am posting my code here pls look once  and give suggestions.

 

 

trigger OnAccountDeleteHandleSecondaryAccountsTrigger on Account (before delete) {

List<Account> accountList = [SELECT Id, Primary_Account__c, Zyme_Id__c, Zyme_AKA__c, Partner_Reporting__c, Partner_Level__c FROM Account WHERE Primary_Account__c = NULL AND Id IN :Trigger.oldMap.keySet()];
System.debug(Logginglevel.INFO,'accountList size : '+accountList.size());
List<Account> secondaryAccountsForUpdate = new List<Account>();
List<Account> accountsForUpdate = new List<Account>();
if(trigger.isBefore) {
if(trigger.isDelete) {
if(accountList.size() > 0) {
for(Account acct: accountList) {
//System.debug(Logginglevel.INFO,'in for : '+accountList.size());
try {
Account[] secondaryAccounts = [SELECT Id, Primary_Account__c, Zyme_Id__c, Zyme_AKA__c, Partner_Reporting__c, Partner_Level__c FROM Account WHERE Zyme_Id__c = NULL AND Primary_Account__c = :acct.Id AND Zyme_AKA__c = :acct.Zyme_Id__c ORDER BY CreatedDate ASC LIMIT 1];
if(secondaryAccounts != null && secondaryAccounts.size() > 0) {
Account secondaryAccount = secondaryAccounts[0];
System.debug(Logginglevel.INFO,'got sec account : '+secondaryAccount.Id);
if (secondaryAccount != null) {
secondaryAccount.Primary_Account__c = null;
secondaryAccount.Zyme_Id__c = acct.Zyme_Id__c;
secondaryAccount.Zyme_AKA__c = acct.Zyme_AKA__c;
secondaryAccount.Partner_Reporting__c = acct.Partner_Reporting__c;
secondaryAccount.Partner_Level__c = acct.Partner_Level__c;

acct.Zyme_Id__c = null;
acct.Zyme_AKA__c = null;

accountsForUpdate.add(acct);
secondaryAccountsForUpdate.add(secondaryAccount);
}
}
} catch(Exception e) {
System.debug(Logginglevel.ERROR,'got exception in fetching sec account : ');
}
}
}
}
}
System.debug(Logginglevel.INFO,'secondaryAccountsForUpdate size : '+secondaryAccountsForUpdate.size());
if(secondaryAccountsForUpdate.size() > 0) {
SetSecondaryAsPrimaryHelper.setExternalUpdate();
update accountsForUpdate;
update secondaryAccountsForUpdate;
}
}

 

 

 

          is There any way to do  this .  please suggest some some solutions.

 

 

How to replace null or empty value with 0.

I am passing 12 number fields to a Google chart.
If one of my fields is blank the chart does not render.
In my Visualforce page I what to replace the null value with 0.
Both of the following lines of code always return false even though one is ==null and the other is !=null.
['January',  {!if(Contact.Sales_01__c==null, 0, Contact.Sales_01__c}],
['January',  {!if(Contact.Sales_01__c!=null, 0, Contact.Sales_01__c}],

How do I do this in Visualforce without using a controller extension?
Another question: can I use a static Apex method and pass in the value and get back 0 if null, or the passed value not null?

Thanks.

  • August 17, 2012
  • Like
  • 0
<apex:page sidebar="false" showheader="true">
<script type="text/javascript">
function link()
{
window.location= 'https://c.ap1.visual.force.com/apex/helloworld';
}
</script>
<apex:form id="new">
	<apex:commandButton styleClass="groovybutton" onclick="link();" id="button1" value="commond button"/>
	<input type="button" name="groovybtn1" onclick="link()" class="groovybutton" value="HTML button"/>
</apex:form>
</apex:page>

 

 

In the above code snippet


when i click the command button , page redirect is not happening. However, i click HTML button page redirect is happening.

please help me to fix it



 

Hello,

 

I am trying to write a VF Component, in which it has two arrows up-Down to increase and decrease some values.

 

But in VF Page these two arrows are not clickable.

 

Could you pls help, where is the fault.

 

Here is VF Component-

<apex:component >

<!--Attribute Definition-->


<apex:attribute name="myvalue" description="Default value for the component." type="Integer" required="true"/> 
<apex:attribute name="max" description="Maximum Value" type="Integer" required="true"/> 
<apex:attribute name="min" description="Minimum value" type="Integer" required="true"/>

<!--java script description-->

<script>
function increment(valueId)
{
   if(document.getElementById(valueId).value<{!max})
   {
    documnet.getElementById(valueId).value++;
    
   }
   else
   {
     alert("You can not increase the number above" +{!max});
   
   }
   
 }
 
 function decrement(valueId)
 {
   if(document.getElementById(valueId).value>{!min})
   {
      documnet.getElementById(valueId).value--;
   
   }
   
   else
   {
     alert("You can not decrease number below"  +{!min});
   
   }
    
 }

</script>

<!-- Custom Componet definition -->
<table cellspacing='0' cellpadding='0'>
<tr>
<td rowspan="2">
<apex:inputText value="{!myvalue}" size="4" id="theValue"/>
</td>
<td>
<div onclick="increment('{!$Component.theValue}');">&#9650;
</div>
</td>
</tr>
<tr>
<td>
<div onclick="decrement('{!$Component.theValue}');">&#9660;
</div>
</td>
</tr>
</table>
</apex:component>

  VF Page-

<apex:page >
<apex:pageBlock title="increase or decrease the displayed values">
<apex:form >
<c:addSubValue myvalue="10" min="0" max="15"/>
</apex:form>
</apex:pageBlock>
</apex:page>

 

Here is the final output, where up and down arrows are not-clickable.

 

 
These two arrows are not clickable.
 
 
Thanks for you help.
 
Thanks & regards,
jaanVivek

 

 

I am a new bie to trigger. I would like to create a trigger for Contracts. Currently the object existing Object are Opportunity is a Master Relation of two Custom Object Estimate__c and Expense__c and it also has a look up relatioship with Contract.

 

Each Contract can have multiple Estimate__c and Expense__c.

Estimate__c, Expense__c and Contract can be created under Opportunity in an order. When the Contract is Create and new record, I would like to have (Expense and Estimate show under Contract related list because they all share Opportunity id.)

I don't how to insert the Contract.id into Expesen__c.Contract__c or Estimate__c.contract__c. 

 

Thanks so much.

Luong

 

Hi,

 

I have the following data in Long textarea field:

 

***Customer's Financial Summary as of 10/08/2012 ***

--Total Balances--
Net Balance:____ GBP 323,183
Total Credit Balances:____ GBP 76,627
Total Debit Balances:____ GBP 246,556

--Product Balances--
Credit Balance:____ GBP 312
Term Loans:____ GBP 12,321

--Interest and Charges(12 Month)--
Charge Income:____ GBP 312
Debit Interest:____ GBP 123
FX Income:____ GBP 234
Credit Interest:____ GBP 432

 

But when i reference this data in my visualforce PDF, the format changes to this:

 

***Customer's Financial Summary as of 10/08/2012 *** --Total Balances-- Net Balance:____ GBP 323,183 Total Credit Balances:____ GBP 76,627 Total

Debit Balances:____ GBP 246,556 --Product Balances-- Credit Balance:____ GBP 312 Term Loans:____ GBP 12,321 --Interest and Charges(12 Month)--

Charge Income:____ GBP 312 Debit Interest:____ GBP 123 FX Income:____ GBP 234 Credit Interest:____ GBP 432

 

It loses all the carriage return. How do i fix this formating issue?

 

Thanks in-advance

 

 

  • August 10, 2012
  • Like
  • 0

Hi,

 

I have to call to an external webservice everytime a new account is created. My question is, what is the best way to do so?

 

I thougt about creating an after create trigger that will invoke the method in the class that was generated from the WSDL import. Would that make sense?

 

If so, how can I import a class into a trigger to use its methods?

 

Thanks a lot. Regards,

 

Antonio

I want to display list values in visual force page but i want to display in single filed with comma separated values.

For example i have ten contacts in my contact object.I want to display these all contact names or another filed in a text box with comma separated.(ex: Lee,jeff,dogules).

 

Can any one help me how to achieve this.......

 

Help!!!!!!!!!!!!!

Output should be like this..

 

if we select DeptName from dropdown then all the details(deptno,loc) of that particular "dept name" should be displyed by quering the records from the "custom object"....

 

in the below code, "dept" is the custom object..

 

I tried like this  but didnt get the required output.

 

///////////////////////////////////////////////////////

 

public class DeptDropDownCon
{
   string dept;

public List<selectoption> getItems(){

List<selectoption> dept = new List<selectoption>();
dept.add(new selectoption('SPORTS','SPORTS'));
dept.add(new selectoption('SALES','SALES'));

return dept;
}

      public PageReference test() {
            return null;
        }

public void setDept(string dept)
{
   
  this.dept=dept;      

}

public List<dept__c> getDept()
{
   return[select name,loc__c from dept__c];

}
}

 

 

 

//////////////////////////////////////////////////////

 

<apex:page controller="DeptDropDownCon">


      <apex:form >


                  <apex:selectList value="{!dept}" size="1">
                       <apex:selectOptions value="{!items}"/>
                  </apex:selectList><p/>

 

                 <apex:commandButton value="Test" action="{!test}" rerender="out" status="status"/>


       </apex:form>

 

<apex:outputPanel id="out">
         <apex:actionstatus id="status" startText="testing...">
                  <apex:facet name="stop">
<apex:outputPanel >
        <p>You have selected:</p>

<apex:dataTable value="{!dept}" var="d" width="50%" >
             <apex:column VAlue="{!d.ID}" headerValue="dept ID"/>
                    <apex:column VAlue="{!d.name}" headerValue="dept Name"/>
                       <apex:column VAlue="{!d.LOC__c}" headerValue="dept location"/>
                             <!-- <apex:column VAlue="{!d.DEPTNO__c}" headerValue="dept no"/> -->
</apex:dataTable>

<!-- <apex:outputText value="{!dept}"/> -->

</apex:outputPanel>
</apex:facet>
</apex:actionstatus>
</apex:outputPanel>
</apex:page>

 

 

/////////////////////////////////////////////////////////////////

 

with the above controller and the VF page,  the same dept details will be displayed for all deptnames before click on test(immediately after saving).. 

 

dept details should be displayed only after I select the "deptname" and click on test..

 

I will be waiting for ur reply..

tc..

 

 

Is there a method to get a Site's 'Secure Web Address' programmatically? Maybe via an undocumented method call?

 

I want to avoid using a Custom Setting entry to store a system generated value which is already defined by the system out of the box and I also don't want logic in code to programmatically build a URI in a controller.

 

Looking for the secure equivalent of Site.getDomain()

 

Thanks in advance!

Mark

  • March 15, 2012
  • Like
  • 0

I have a VF page that creates work orders when you click a custom button on the opportunities page. I want to transfer opportunity name and account to the work order through the page but it is throwing an error. Any ideas how to retain information from a previous page????

From a visual force page, I return array of strings str[], which contains all the choices selected by the user through selectList with multi-"true". I have a multi-select picklist field in the object. I need to write a query that will return all the records from the object which matches wide variety of criteria. Here is an example:

 

There are five records in the object with values in the multi-select picklist as shown:

 

Type

Car

Car, Van

Car, Van, Jeep

Jeep

Jeep, Car, Bike

 

User selection in the str[] is {Car, Van, Jeep, Bike}

 

I want a SOQL query with filter on Type field which will return all the recrods from that object.

 

[select Name from someObject where Type includes (??)];

 

I would be very grateful if somebody can come up with solution.

 

Right now with my query all I am getting is records which have only single value picked.

Hi..

 

I have a custom Object named as 'Journal' in the detail view of the Journal it shows the related list of custom object 'Line', I want to change the layout of the realted list of 'Line'. Can anyone tell me how can I change the layout of this related list??

  • March 09, 2012
  • Like
  • 0

I have been successful with creating VF pages that are used to override a 'Edit' buttons for a few objects within Salesforce. I would like to do  the same to override the 'New' button. I've used the same code, as a starting point. I find that the standard controller attempts to retrieve a record from the database based on the record Id found in the request, and made it available to the Visualforce page (automatically). And if the retrieval is a success, the page displays as it should. 

 

When using a standard controller and I do not have an Id for the object, as it is when a user clicks 'New', how can I present the same form/layout that one would see with the standard page? Is this possible?

 

Thanks much.

  • March 09, 2012
  • Like
  • 0

Hi,

 

I am able to do test method for this class but I need 100% code coverage for this class.

************* Class *****************

public with sharing class AegisController {

     Account acc;
     Id loggedInUser;
     public boolean errorFlag {get;set;} { errorFlag = false; }
     public AegisController(ApexPages.StandardController controller) {
           acc = (Account)controller.getrecord();
           loggedInUser = UserInfo.getuserId();
     }
     public void RequiredFieldValidation() {
            try {
                    if(acc.Rating == null)
                          errorFlag=true;
            }
            catch(Exception e) {
                    errorFlag=true;
            }
     }
}

 

 

*************** Test Method *******************

@isTest

public class Test_AegisController {
      static testMethod void testAegisController() {
            Account acc = new Account(Name='shravan'); 
            insert acc;
            ApexPages.StandardController sc = new ApexPages.StandardController(acc);
            AegisController aegisController = new AegisController(sc);
            aegisController.RequiredFieldValidation();

            /*
            //-ve test case

            Account acc1 = new Account(); 
            insert acc1;
            ApexPages.StandardController sc1 = new ApexPages.StandardController(acc);
            AegisController aegisController1 = new AegisController(sc);
            aegisController1.RequiredFieldValidation();
            System.debug('****Exception*****');

            */
         }
 }

 

Here code coverage 83%. Plz help me to increase the code coverage.

 

Doubt regarding URL redirect button in force.com sites detail page and how to use that. Can anyone provide me a sample or E.g.,

 

I just give my salesforce site url (sample.ap1.salesforce.com/apex/sitelogin) in source and my company support url in(mycompany.com/support) destination but it doesnt get redirected

 

What to do for redirection to happen ?

 

Plz provide me a help

 

Thanks
Marris

  • March 07, 2012
  • Like
  • 0

We are trying to make a simple employment application with visualforce.

 

We created a custom object for employment application, and made a page and site.

 

The problem is, when I publically insert the data and try to save it—the form directs me to that particular record only signed in  users can see—so the public user will get an error page that says the public user don't have access to that certain page.

 

Here is our simple apex code:

 

<apex:page sidebar="false" showHeader="false" standardController="Staff_Application__c">
<div style="margin: 0 auto; padding: 30px; width: 500px;">
<apex:form >
<label>First Name:</label>
<apex:inputField value="{!Staff_Application__c.First_Name__c}" />
<label>Last Name:</label>
<apex:inputField value="{!Staff_Application__c.Last_Name__c}" />
<apex:commandButton value="Save" action="{!save}" />
</apex:form>
</div>
</apex:page>

 

and here is a link to our application:

http://artandjustice.force.com/employment

 

How can a public user press save button and it directs the public user to a page that I want them to see after they press them?  

 

For example after they insert the data, I want them to go to artandjustice.org/confirmation.php?

How we'll use Custom label in apex code in which we'll  take the label name dynamically???

  • March 05, 2012
  • Like
  • 0

Hi -

 

Is there a way to debug our code. I have a validation which passed the syntax test but it not giving me the right result.

 

I would like to know what values are being passed to the rule and how it is interpreting them.

 

So, is there a way to debug this validation during runtime? I am new to Force.Com and am finding my way through this stuff.

 

Such tools are commonly available in Eclipse IDE, Visual Studio. Just wondering.

 

Any help is appreciated and thanks for your time.

 

Regards,

I have this query,

 

list<Contact> relatedContacts = [select id, AccountId, (Select Id From Cases) from Contact where id IN :contactIds ];

 

The thing is, I want to get the value of the cases Id  so I can use it to update another field.

 

How do I go about getting this value?

 

Thanks,

-K

 

Hi All,
There is a need to implement service cloud with ticket management system. If anyone has done this kind of implementation before then please guide which approach is better of the following:
1.Use Case object for managing all kinds of tickets as different kind of tickets may have different process flow, different SLA and metrics. The advantage is that salesforce updates will be received as case is a standard object but it might burden one object.
2.Use separate custom object for each kind of ticket which will make managing easier but issue is that salesforce updates won’t be updated on custom objects but it will be a distributed object architecture and will not burden single object.

Thanks in advance !!

 

Hi All,

 

We are facing a strange issue while trying to make webservice callout and getting file content as response. Issue is that if file size is greater than 200Kb then callout is failed and throwing the exception as given below ---

 

"Web service callout failed: String length exceeds maximum: 1000000"

 

Also wondering ,it's mentioned in SF doc that max Payload size limit is 3MB for callout request as well as response.

And i am able to send data in request upto 3 MB but not able to get data as response if it's >200KB.

 

Can anyone suggest what need to do, or am i missing something.?

 

Plz help, Its URGENT.

Hi,

 

I want to add person account to campaign as campaign member using apex, but was not able to find out  the way to pass account id in campaign member object.

 

Since i read  through some blogs that person account is treated as contact in SF so i passed accountid to contactId field of CampaignMember object. But got the "FIELD_INTEGRITY_EXCEPTION, Contact ID: id value of incorrect type: 001P000000XhJYkIAN: [ContactId]" error

 

My code is as below -

 

CampaignMember cm=new CampaignMember(CampaignId='701P00000001sWP',contactId='001P000000XhJYk',Status='Sent');
insert cm;

So hw i would pass person account id to CampaignMember object..?

 

Hi,

 

I am making a webservice callout from my sandbox and sending sessionId as well as Enterprise Server Url with the request, since service authenticates the request by callback to server url, whether it is valid or not using this information.

Its working fine in the org.

 

Now When i included that page in site and tried to make callout, its giving message - "Call is not authorised."

 

It might be because of server url since force.com site has its own domain, so server url might be differ here.

 

NOw thw question is what will be the apiServerUrl in case of site so callback can be successfull.

Hi,

 

My requirement is to display the blob content on the page, in fact i am making a callout to external webservice and getting a file content in Base64 string format (now we can covert it to Blob). But not able to display this content in correct format, as i tried with different things like -

 

1. converted Base64 in Blob and tried to display but it's displaying something "core.filemanager.FileBlobValue@bd9997c " on the page

2. Directly tried to display Base64 string then obviously it's displaying raw string (very large)

etc.

 

I want to display that content in original format, it can be of any type (pdf, xls, doc,rtf etc).

 

Any help would be appreciate.

 

Hi,

 

Again i am here with some interesting queries.

My requirement is that i am having thousands of records of particular object and displaying in vF page using pageBlockTable. Now i want to implement searching on those records but similar to search in excel sheet.

(As you must seen in excel sheet there is a drop-down on the header of each field and we can filter the data based on selection in those drop-downs).

 

So i want to implement exact same thing in VF pageBlockTable.

Does anyone have any sugestion or any similar solution...?

Hi,

 

I am trying to make callout to external service from salesforce , getting exception :

 

System.CalloutException: Web service callout failed: Unexpected element.
Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found ':HTML'

 

When i debug the callout, got following response -

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
</HEAD><BODY>
<H1>ERROR</H1>
<H2>The requested URL could not be retrieved</H2>
<HR noshade size="1px">
<P>
While trying to retrieve the URL:
<A HREF="http://dev-usmi.genworth.com/ws/GNWFileUtilsES.Services.FileUtilsSvc/GNWFileUtilsES_Services_FileUtilsSvc_Port">http://dev-usmi.genworth.com/ws/GNWFileUtilsES.Services.FileUtilsSvc/GNWFileUtilsES_Services_FileUtilsSvc_Port</A>
<P>
The following error was encountered:
<UL>
<LI>
<STRONG>
Connection to 206.83.178.91 Failed
</STRONG>
</UL>

<P>
The system returned:
<PRE><I>    (113) No route to host</I></PRE>

<P>
The remote host or network may be down.  Please try the request again.
<P>Your cache administrator is <A HREF="mailto:support@salesforce.com">support@salesforce.com</A>. 

<BR clear="all">
<HR noshade size="1px">
<ADDRESS>
Generated Tue, 17 Apr 2012 08:53:17 GMT by proxy-tyo.net.salesforce.com (squid)
</ADDRESS>
</BODY></HTML>

 After analyzed the response am sure that am getting exception because of response am getting as HTML instead of SOAP. Can anyone tell me wat issue may the cause of this response ? and how to resolve it..?

 

Any help would appreciated..

Hi,

 

I am making a callout to external webservice and getting following exception.

 

System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element ProposalInfoOut

 

I guess i am able to make callout and also getting response but salesforce not able to parse response.

Please help and tell me where is the problem or am i misiing something..?

 

 

Hi,

 

I have a requirement to make SOAP callout with certificate. In fact a webservice that is hosted on client server and client provided us a certificate (.cert file) as well as a password keystore file (.jks file) to implement secure callout. But i couldn't figure out how to use these files in webservice callout.

 

Please help, it's urgent.

 

Any point would appreciated.

Hi,

 

I have a requirement to send a doc (pdf / excel / doc...) from salesforce to ftp server, so i can use HTTP restful services classes but here's a limit 6 MB max of data can be send with HTTP request. In my case doc size can be more than that,

that's why i m thinking to send data using SOAP api but not sure that can pass BLOB data as parameter in callout (pass to external webservice ).

 

Did anyone face this problem before ?

 

Any help would be appreciated.

Hi,

 

Is there any way to create Outbound Message Listener in salesforce org using apex ?

My requirement is that i have configured outbound message in one of my org but i want to create message listener using apex in another salesforce org , i dont want to create it using java/.net.

 

Will appreciate your any help.

Hi,

 

I jst want to use ajax api in my html page, just want to make simple call like login and then query().

I included this api by using url like this....

 

<script language="javascript" src="https://ap1.salesforce.com//soap/ajax/20.0/connection.js"
type="text/javascript"></script>

 

And when i made a login call, it through exception, then i download the connection.js and included it locally but still got exception.

 

It is possible to invoke salesforce ajax api from html page that is not hosted any server (running localhost)?

 

 

Any help must appreciated

Hi,

 

I am stuck to configuration of PHP toolkit with WAMP 5.x.

Actually i followed tutorials and downloaded toolkit, created php page and paste the sample code from tutorials.

Now where i need to have this toolkit and wat setting will make it run.

 

Please help !

 

 

Hi,

I am creating a PDF doc rendered from visual force page, now I want to

display dashboard or graphs (pie chart,etc.) in PDF doc. Is there any way to do this ?

 

I would really appreciate for reply.

 

 

Thanks.

Hi,

I m trying to get all the values of a picklist (custom field) using apex, but still i couldn't.

Is there any way to do it ?

If you have, pls reply......

 

 

Thanks.

Hi All,

 

I have a VF page with specified rerenderAs attribute to 'pdf ' .I am fetching accounts and displaying  within data table in this page. And i want to pagination within PDF. I tried a lot but i couldn't get success.

 

If anyone can, then please guide me.

 

Thanks.

Hi,

 

I created a webservice in apex, then created wsdl and then created stub classes in apex.

Now i m creating a class in which a method with @future annotation is defined.From in this method i m trying to invoke

webservice method, but i got exception.

 

exception: Callout failed: unsupported sessionId.................................

 

Then i realised that i m not doing login in salesforce.Now the problem is how to use login() method in apex.

However i searched many example of login(),but in those examples login() method used in java not in apex.

 

I would appriciate, if anyone can help me .

 

Thanks.

Hi,

 

I used renderas attribute to display VF page as PDF, now i want to set header & footer

for this PDF.However i created header & footer using .css.

 

Is any other way to add header & footer to PDF ?

 

I would appriciate, if anyone could help.

 

Thanks.

Hi,

 

I have a SObject and one VF page.I added this page on the standard layout of Object.

But the problem is that i wanna add this VF page on the edit and new  layout of the SObject as well.

Can anyone help me ?

 

Thanks,

hi,

    i have VF page and want to insert layout of a object .But still could not........

 

  Can someone help me....... 

Hi,

 

My requirement is to display the blob content on the page, in fact i am making a callout to external webservice and getting a file content in Base64 string format (now we can covert it to Blob). But not able to display this content in correct format, as i tried with different things like -

 

1. converted Base64 in Blob and tried to display but it's displaying something "core.filemanager.FileBlobValue@bd9997c " on the page

2. Directly tried to display Base64 string then obviously it's displaying raw string (very large)

etc.

 

I want to display that content in original format, it can be of any type (pdf, xls, doc,rtf etc).

 

Any help would be appreciate.

 

Hi,

 

I have 2 objects, one custom object CustomEvent__c and another salesforce's event object.

I want the objects are same when CustomEvent__c is updated.

 

The trigger can be fired. But the data is not updated.

please help me to write a code for update.

 

the code is below.

 

 

trigger UpdtEvent on CustomEvent__c (before Update) {

    for (CustomEvent__c ce: Trigger.New){
        Event e = [select id from Event where CustomEventID__c =: ce.id];
            e.OWNERID = ce.OWNERID;
            e.SUBJECT = ce.NAME;
            e.ToDoType__c = ce.ToDoType__c;
            e.SubTypeCD__c = ce.SubTypeCD__c;
            e.ParticipationNum__c = ce.ParticipationNum__c;
            e.Description = ce.Note__c;
            e.WHOID = ce.ContactName2__c;
            e.WHATID = ce.AccountName2__c;
            e.CalledStatus__c = ce.CalledStatus__c;
            e.STARTDATETIME = ce.CALLSTARTTM__C;
            e.ENDDATETIME = ce.CALLENDTM__C;   
  }
}

  • September 04, 2012
  • Like
  • 0

i displayed account names in a pageblocktable with outputlink

 

my requirement is

when i  click  one account name(suppose accname1) in pageblocktable

display related record custom edit page in a same visualforce page(not redirect to standard edit page)

 

this is my requirement

if anyone knw this code please post me urgent

 

Hi,

 

Can a normal function send an apex error message to the Visualforce Page.

 

EX : 

public void abc (){

 

 ApexPages.addmessage(new ApexPages.message(ApexPages.severity.error,'Error!!!!!!));

 

}

 

Thanks.

Hi

 

for Account, I need to hide one view.I didn't add my public group to share in that view but it showing the name, when we click  "GO" none of the records showing,  I need to hide that view name

any one help on this plz.


 

Regards,

SRS8.

Hi ,

     When I am Deleting Account records as Bulk Data Deletion.. My trigger will fire. that time my first Query will execute. and if the size of Query list Have 200. this time  i want to Execute second Query as 200 times . Because of Governar limits it will showing Exception as:Too many SOQL queries: 101” .But i want to execute Second query 200 times  because of Batch size 200 as default . so my requirement is second query has to execute 200 times.   

I am posting my code here pls look once  and give suggestions.

 

 

trigger OnAccountDeleteHandleSecondaryAccountsTrigger on Account (before delete) {

List<Account> accountList = [SELECT Id, Primary_Account__c, Zyme_Id__c, Zyme_AKA__c, Partner_Reporting__c, Partner_Level__c FROM Account WHERE Primary_Account__c = NULL AND Id IN :Trigger.oldMap.keySet()];
System.debug(Logginglevel.INFO,'accountList size : '+accountList.size());
List<Account> secondaryAccountsForUpdate = new List<Account>();
List<Account> accountsForUpdate = new List<Account>();
if(trigger.isBefore) {
if(trigger.isDelete) {
if(accountList.size() > 0) {
for(Account acct: accountList) {
//System.debug(Logginglevel.INFO,'in for : '+accountList.size());
try {
Account[] secondaryAccounts = [SELECT Id, Primary_Account__c, Zyme_Id__c, Zyme_AKA__c, Partner_Reporting__c, Partner_Level__c FROM Account WHERE Zyme_Id__c = NULL AND Primary_Account__c = :acct.Id AND Zyme_AKA__c = :acct.Zyme_Id__c ORDER BY CreatedDate ASC LIMIT 1];
if(secondaryAccounts != null && secondaryAccounts.size() > 0) {
Account secondaryAccount = secondaryAccounts[0];
System.debug(Logginglevel.INFO,'got sec account : '+secondaryAccount.Id);
if (secondaryAccount != null) {
secondaryAccount.Primary_Account__c = null;
secondaryAccount.Zyme_Id__c = acct.Zyme_Id__c;
secondaryAccount.Zyme_AKA__c = acct.Zyme_AKA__c;
secondaryAccount.Partner_Reporting__c = acct.Partner_Reporting__c;
secondaryAccount.Partner_Level__c = acct.Partner_Level__c;

acct.Zyme_Id__c = null;
acct.Zyme_AKA__c = null;

accountsForUpdate.add(acct);
secondaryAccountsForUpdate.add(secondaryAccount);
}
}
} catch(Exception e) {
System.debug(Logginglevel.ERROR,'got exception in fetching sec account : ');
}
}
}
}
}
System.debug(Logginglevel.INFO,'secondaryAccountsForUpdate size : '+secondaryAccountsForUpdate.size());
if(secondaryAccountsForUpdate.size() > 0) {
SetSecondaryAsPrimaryHelper.setExternalUpdate();
update accountsForUpdate;
update secondaryAccountsForUpdate;
}
}

 

 

 

          is There any way to do  this .  please suggest some some solutions.

 

 

Hi,

 

my email box redirects the received emails to a Salesforce email service. The original toAddress is modified with the address of the target Salesforce email service in the redirection process

 

Is there a way to obtain the original toAddress of the email received by the Salesforce email service?

 

Thanks,

 

Salvatore

 

put a command button(add account) in pageblock

 

if i click that button that will  open new account page(create an account page)

Hello,

 

I found this article describing how View State works. I would like to reproduce the behavior showed in Figure 1

 

http://wiki.developerforce.com/page/An_Introduction_to_Visualforce_View_State

 

Basically I have a form, with a button.

Once the user clicks on the button, I want to be able to display a message (error or success) on the same page, using a postback

 

Can anyone share the code I need to add to my page/controlle, to accomplish what is described in Figure 1 in the link above?

 

Thanks a lot

Giorgio

Hi......... I have created a vf page for force.com sites In that page I am passing id with page name like.... outputLink value="/apex/childdetail?id={!cont.id}"> Read more

Hi,

 

Is there is anyway i can hide a field in edit mode and not in page layout. its a v-lookup field

 

Thanks

 

Uves

I am trying to delete a master-detail field. It is referenced in 2 apex class files and a test_class file. This field is also a mandatory field. I am unable to delete it. How can I delete it?

 

I am using enterprise edition of salesforce.com.......

 

I tried:

 

1. Commenting the field in the test class, and the 2 apex classes. But the test class is displaying an error msg because required field is missing. So unable to save it.

 

As it is a mandatory field I cannot change the field type from Master-Detail to Look Up field.

 

2. I changed the field type from master-detail to lookup in sandbox and tried deploying the field into Production. But am getting an error msg as:

 

field integrity exception: unknown (must specify either cascade delete or restrict delete for master detail)

 

 


Can anyone help? Pls!

Hello, 

 

I have a trigger afterInsert on attachment . When an attachment is created on contact , it is automatically inserted in a custom object . The id of this custom object is referenced in a custom field of the contact . The file is inserted in the custom object . but when i click on "View file " the file is not viewd .In fact the title and the number of KO is mentioned in the file but it is not seen , i dont now why . Here is the apex code : 

public with sharing class MADEL_TR005CreateAttachment 
{
	
	public static void CreerAttachmentOncontactMADEL(List<Attachment> lstattachment)
    {

		Map<Id,Id> mapgetIdcontactMadelfromContact = new Map<Id,Id>();
		Set<Id> contactIds=new Set<Id>();


		for(Attachment att:lstattachment)
		{
			contactIds.add(att.ParentId);
			
			
		}
		
		List<Contact>lstcontacts=[select Id ,idcontactMADEL__c from Contact where Id IN:contactIds ];
		
		
		for(Contact contact:lstcontacts)
		{
			mapgetIdcontactMadelfromContact.put(contact.Id,contact.idcontactMADEL__c);
		}
		List<Attachment>attachtoInsert=new List<Attachment>();
		
	 for(Attachment a:lstattachment)
		{
			Attachment attach=new Attachment(name = a.name, body = a.body, parentid = mapgetIdcontactMadelfromContact.get(a.ParentId));
			attachtoInsert.add(attach);

		}
		insert attachtoInsert;





    }

}

 I really need your Help , Thanks !

 

Can We change the StandardSetController PageSize?

In Normally PageSize per page is 2000(Default)..

Can we change pagesize from to 2000 to 3000?

if any possible to convert date-time to date field?

 

Example:

 

Date/Time 

Tue Jul 10 00:00:00 GMT 2012

 

Expected Output:(Date output)

Tue Jul 10, 2012

 

Hello,

 

I am trying to write a VF Component, in which it has two arrows up-Down to increase and decrease some values.

 

But in VF Page these two arrows are not clickable.

 

Could you pls help, where is the fault.

 

Here is VF Component-

<apex:component >

<!--Attribute Definition-->


<apex:attribute name="myvalue" description="Default value for the component." type="Integer" required="true"/> 
<apex:attribute name="max" description="Maximum Value" type="Integer" required="true"/> 
<apex:attribute name="min" description="Minimum value" type="Integer" required="true"/>

<!--java script description-->

<script>
function increment(valueId)
{
   if(document.getElementById(valueId).value<{!max})
   {
    documnet.getElementById(valueId).value++;
    
   }
   else
   {
     alert("You can not increase the number above" +{!max});
   
   }
   
 }
 
 function decrement(valueId)
 {
   if(document.getElementById(valueId).value>{!min})
   {
      documnet.getElementById(valueId).value--;
   
   }
   
   else
   {
     alert("You can not decrease number below"  +{!min});
   
   }
    
 }

</script>

<!-- Custom Componet definition -->
<table cellspacing='0' cellpadding='0'>
<tr>
<td rowspan="2">
<apex:inputText value="{!myvalue}" size="4" id="theValue"/>
</td>
<td>
<div onclick="increment('{!$Component.theValue}');">&#9650;
</div>
</td>
</tr>
<tr>
<td>
<div onclick="decrement('{!$Component.theValue}');">&#9660;
</div>
</td>
</tr>
</table>
</apex:component>

  VF Page-

<apex:page >
<apex:pageBlock title="increase or decrease the displayed values">
<apex:form >
<c:addSubValue myvalue="10" min="0" max="15"/>
</apex:form>
</apex:pageBlock>
</apex:page>

 

Here is the final output, where up and down arrows are not-clickable.

 

 
These two arrows are not clickable.
 
 
Thanks for you help.
 
Thanks & regards,
jaanVivek

 

 

I am wondering if and how I can run some custom javascript across all my salesforce pages?   I tried adding my javascript to a Custom Component on the home bar, but when I try and save the component it deletes all my javascript out.  

 

I dont't want to add the javascript to each object with a layout.   I simply want this javascript to be executed onload of every page across my org.

 

Any help is greatly appreciated, and thank you in advance.

 

  • August 03, 2009
  • Like
  • 0