• georg
  • NEWBIE
  • 130 Points
  • Member since 2013

  • Chatter
    Feed
  • 4
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 38
    Replies

Hi

 

i am trying to override the new button for Opportunity so when user save the opportunity he is redirected to a custom VF page.

but when i create an new opportunity and select an record type i am getting Error due to URLFOR method, below is code as well as error message.

 

Visualforce Error:


Invalid parameter for function URLFOR

Error is in expression '{!URLFOR($Action.Opportunity.Edit, opportunity.id, [saveURL='/apex/oppRedirect', retURL='/'+opportunity.id, cancelURL='/'+opportunity.id], TRUE)}' in component <apex:page> in page oppurl

 

<apex:page standardController="Opportunity">
<script> 
window.top.location.replace("{!URLFOR($Action.Opportunity.Edit, opportunity.id, [saveURL='/apex/oppRedirect', retURL='/'+opportunity.id, cancelURL='/'+opportunity.id], TRUE)}");
</script>
</apex:page>

Hi,

 

I am not able to rerender my pageBlockButtons.Initially i will disable the button using apex variable on change of picklist in javascript iam calling action function and setting the value to false and rerenderin the pageblock button id.

 

It is not at all reflecting .I Apperciate your help.

 

below is my code

 

<apex:pageBlockButtons id="pageBlockButtons1" location="both" rendered="true">
<apex:actionRegion id="ButtonsRegion">
<apex:commandButton action="{!UpdatePriority}" disabled="{!submitflag}" id="SubmitButton" value="Update" rendered="true"/>
</apex:actionRegion>
</apex:pageBlockButtons>

 

<apex:pageBlockSection title="{!$Label.Update_Priority_Duedate}" id="EditPriorfieldsPB" collapsible="true" rendered="true">
<apex:repeat id="repeat1" value="{!$ObjectType.temp__c.FieldSets.EditPriority}" var="stdR0">
  <apex:inputfield id="userval" value="{!con[stdR0]}" required="{!OR(stdR0.required, stdR0.dbrequired)}" onChange="DateValidation(this.value,'{!stdR0.fieldPath}');" rendered="true"/>
  </apex:repeat>
</apex:pageBlockSection>

 

<apex:actionFunction name="jsDateValidation" action="{!actionFunDateValidations}" rerender="pageBlockButtons1" immediate="true">
 <apex:param assignTo="{!dateDetails}" value="" id="DateDetails" name="dateVal"/>
</apex:actionFunction>

 

 

 

Hi

 

I am pretty new to apex and have had a good few goes at trying to get my head around bulkyfying this trigger.  I know I need to use a map & an aggregateresult loop but just cant seem to get the syntax right.

 

any help appreciated

 

for(Course_Application__c c:Trigger.new)      
        {
        Course__c c = [select id, Confirmed_applications__c  from Course__c where Id =:c.id];
        Integer u = [select Count() from Course_Application__c where course_del__r.Id =:crsId and status__c='Ordered'];
        c.Confirmed_applications__c=u;
        update c;
}

 thanks

les

 

 

Hi all,

I'm currently working on a trigger for preventing duplicate Leads from being inserted during the mass data upload. The trigger should treat two leads equal if their Company and Email fields are equal. Since the trigger would fire during the mass data upload (custom), I had to minimize the number of executed SOQL queries in order to cope with SF limits.

Here's how the code looks like atm:

trigger MyTrigger on Lead (before insert) {

Map<String, Lead> leadMap = new Map<String, Lead>();

List<String> fieldNames = new List {'Email', 'Company'}; // it will actually be obtained from somewhere else, but I'm hardcoding it atm

String leadQueryString = '';
String leadDupeError = 'A Lead with the same {0} already exists: {1}';
String fieldSet = '';
Integer i = 0;

List<Set<String>> leadValues = new List<Set<String>>(); // referencing a set by its index in the list doesn't work in dynamic query

for (String fieldName : fieldNames)
{
	Set<String> thisFieldValues = new Set<String>();
	
	for (Lead lead : System.Trigger.new)
	{
		if(String.isNotBlank((String)lead.get(fieldName))) thisFieldValues.add((String)lead.get(fieldName));
	}
	// keeping a corresponding set of values for this field
	leadValues.add(thisFieldValues);
	
	// constructing my query filters
	leadQueryString += (leadQueryString == '' ? '' : ' AND ') + fieldName + ' IN :leadValues[' + i + ']'; // this index doesn't work	
	fieldSet += (fieldSet == '' ? '' : ', ') + fieldName;
	
	i++;
}

List<Lead> possibleDupes = Database.query('SELECT Id, ' + fieldSet + ' FROM Lead WHERE ' + leadQueryString);

List<Lead> dupes = new List<Lead>();

for (Lead lead : System.Trigger.new)
{
	for (Lead pd : possibleDupes)
	{
		boolean match = true;
		
		for(String fieldName : fieldNames)
		{
			if (((String)lead.get(fieldName)) != (String)pd.get(fieldName)) {
				match = false;
				break;
			}
		}
		if (match) {
			lead.addError(String.format (leadDupeError, new List<String> { fieldSet, pd.Id})); // this will prevent the insert
			dupes.add(lead);
			break;
		}
	}
}

}

 Actually, referencing leadValues[i] in query doesn't work :( It gives me the following error:  System.QueryException: unexpected token: '['
To get it work, I had to remove the [] clauses from the query and add two additional lists: 

leadValues0 = leadValues[0]
leadValues1 = leadValues[1]

This way it does work, but it's not dynamic (I want the number of filter fields be more flexible).

So, the question is: is there a way to bypass this error without having to keep the exact number of field values sets?

I would also appreciate any other suggestions on improving my trigger :)

Hi All,

       I have an image on my visualforce page (which is rendered as pdf as well). I want that image to redirect me to a link say : google  when it;s clicked. This redirection should also work when the page is rendered as pdf. This is what i have tried so far and itt doesnt work. Request you all to help.

 

    <script type="text/javascript">
    function popupwindow(){
        var newwindow = window.open("http://www.google.com/");
        newwindow.focus();
    }
    </script>

 

<apex:image url="{!$Resource.PDFImage}" onclick="popupwindow" width="550" height="50"/>

 

I  have also tried to use <a></a> tags , just outside <apex:image> but even that doesn't seem to work.

 

Regards

Shrey Tyagi

Hi All,

 

I need your attention for unknown functionality for me of Salesforce.com/Force.com platform. I am doing UPSERT without External ID on an object. I have a custom object "Sales Order Summary" which is a child object of Account via Master-Detail relationship.

 

I am doing UPSERT with standard Name field of custom object "Sales Order Summary". Before this, Only thing which I knew was doing UPSERT with an External ID on an object. It is working Perfect !!! for me. I am just confirming from you guys (Guru's of Force.com platform) that whether it is ok to do it or I should query the records and perform INSERT / UPDATE based on condition. Please help me out in it.

 

Note: Following things I already know about the UPSERT.

1) UPSERT with External ID (I cannot create External ID on this object due of some reasons).

2) Query records and perform INSERT / UPDATE based on condition.

________________________________________________________________________________________

//Sample Order Summary Code for UPSERT in Apex

 

//List of Sales Order Summary for UPSERT
List<Sales_Order_Summary__c> listOfSalesOrderSummaryToUpsert = new List<Sales_Order_Summary__c>();

//Created a new Account "Test Sales Order Summary" with JDE Address Number = 1001

//JDE Address Number is an External ID on an Account. I am getting particular record.
Account a = new Account (JDE_AddressNumber__c = 1001);

//Create Sales Order Summary records
for(integer i=0; i<=13; i++){
    Sales_Order_Summary__c salesOrder = new Sales_Order_Summary__c();
    salesOrder.Account__r = a;
    salesOrder.Name = 'Sales Order Summary'+'---'+i;
    salesOrder.Amount__c = 300 + i;
    salesOrder.Date__c = System.today() + i;
    listOfSalesOrderSummaryToUpsert.add(salesOrder);
}

//The External_ID_Field is of type Schema.SObjectField, that is, a field token.
Schema.SObjectField schemaField = Sales_Order_Summary__c.Fields.Name;

 

//Creates new sObject records or updates existing sObject records within a single statement, using an optional custom field to determine the presence of existing objects.
Database.UpsertResult[] upsertResult = Database.upsert(listOfSalesOrderSummaryToUpsert, schemaField, false);
System.Debug('>>> Sales Order Summary UPSERT Result <<<'+upsertResult);

 
/*
Note: You cannot use custom fields as a parameter of Schema field.
Schema.SObjectField schemaField = Sales_Order_Summary__c.Fields.Date_c;
Note: If you use then you will get an error
System.SObjectException: Invalid field for upsert, must be an External Id custom or standard indexed field: Date__c
*/

I am trying to create this VF page and the following errors appear:

 

Error: salesinvoicebulkprint line 13, column 10: The markup in the document following the root element must be well-formed   Error: The markup in the document following the root element must be well-formed.

 

What am I missing?  Here is the beginning of my code:

 

<apex:page standardController="c2g__codaInvoice__c" recordSetVar="invoices" extensions="ffps_scnbtnb.PrintInvoicesController" action="{!preCheck}" renderAs="{!IF(isError,null,'pdf')}" showHeader="{!IF(isError,true,false)}" sidebar="{!IF(isError,true,false)}" standardStylesheets="{!IF(isError,true,false)}" >

<apex:outputPanel rendered="{!NOT(isError)}">
<apex:repeat value="{!InvoiceList}" var="invoice">
<apex:repeat value="{!invoice.invoice}" var="salesInvoice">
<!-- CONTENT -->
</apex:repeat>
</apex:repeat>
</apex:outputPanel>

</apex:page>

<apex:variable var="styleFontColor" value="#000000" />
<apex:variable var="styleHeaderBGColor" value="#E4EAF4" />
<apex:variable var="styleHeaderFontColor" value="#000000" />
<apex:variable var="styleLineColor" value="#3B5E91" />
<head>
<style type="text/css">

Hi friends,

 

I have list of records,when i click the particular records it display the details of records.some records not display it's loading too long time after that am getting err like this.. Apex CPU time limit exceeded and An unexpected error has occurred. Your development organization has been notifiedwhy this err occur how to resolve this please can anyone help me..thanks in advance..

 

Regards,

kathir

On a standard page layout, (It's a detail page layout), I am trying to show/hide a custom field which is a text field based on a check box field.

 

I realize I would have to inject some code within the standadard page layout but not sure how to go about doing this.

 

Any suggestions?

 

Thanks.

 

Hi,

 

 Please help me to achieve the following functionality,

 

1) I want to remove the standard "New account " button for a specific record type under account for a specific user.

 

 

Please let me know how to achieve it.

 

Thanks in Advance

Hi,

 

I have a webform which creates opportunity on Salesforce. Once Opportunity is created we are making an asynchronous call (via @future callout) to external web service to fetch the Account number based on the passed telephone number. After receiving we are updating the Opportunity with that Account owner and in case no account number received from web service we are not performing anything.

 

There is a formula field on the Opportunity which displays the Department and division of the opportunity owner.

 

So the problem is when we are updating the opportunity with the account number from the @future callout, the formula field is not updating correctly as it is showing incorrect department and division name.

 

If we manually edit the opportunity and saves with or without modifying anything. The formula field is displaying correctly.

 

Any suggestion would be helpful.

 

Thanks,

Mr. Singh

My requirement is display the queues names for current loginuser.

 

can anybody help me for this query ?

 

Thanks in advance

Hi,

 

I have a requirement where I have to navigate to Visual force pages i.e. from page 1 to 2 on button click.

 

On the second page I have command link where it gets me back to the previous page

 

now when I filter the data and click on command button and again get back the to original page the by clicking command link I want the data to remembered on 1 st page 

 

Thank You,

I have written a method in controller class to pass two ids in the URL to the next vf page ... but it is not going properly in the URL..

 

public pagereference upload()
{
Id so ;
Id oppId = ApexPages.CurrentPage().getParameters().get('OpId');
for(SOWrap sw :wrapper)
{
so = sw.SOID;
}
return new pagereference('/apex/DocumentUploader?Id=' +so+ '&OppId =' + oppId);

}

 

 

The URL it is passing is :

 

https://cs16.salesforce.com/apex/DocumentUploader?+OppId+=006f0000003aqzUAAQ&Id=a39f00000004IKtAAM

 

I am not able to use OppId in the new page, page not loading .. any help here

hai all

guys help me with this issue...

how to write a trigger that has to fire only once at life time......

 

thanks

Hi,

 

I'm receiving the following error for code that has existed in our org for several years - I've only changed the reference from Estimated_Volume__c to Estimated_Annual_Volume__c.

 

Method does not exist or incorrect signature: EncodingUtil.urlEncode(Decimal, String)

 

Original lines:

        if(rec.Estimated_Volume__c != null){
            url += '&' + '00N600000029OCc=' + EncodingUtil.urlEncode(rec.Estimated_Volume__c,'UTF-8');

 

 

Revised lines:

        if(rec.Estimated_Annual_Volume__c != null){
            url += '&' + '00N600000029OCc=' + EncodingUtil.urlEncode(rec.Estimated_Annual_Volume__c,'UTF-8');

 

Any help would be greatly appreciated! 

 

Thanks!

Set Tracking History can not maintaine the old ans new values , to maintain the old and new values and user name etc ... what i have to do ?

 

ple if  u konw , tel me how  do this ............ thank u .

Hello Folks,

 

What is the sequence while deployment from sandbox to Production?

 

Lets say, I've  Custom Objects /Roles / Profiles/VF Pages/Classes/Triggers.Which one to be moved first to Production? -

 

What is the Sequence of it.

 

Appreciate your help.