• ThomasTT
  • SMARTIE
  • 780 Points
  • Member since 2009

  • Chatter
    Feed
  • 29
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 241
    Replies

I need your help. I've a subquery and Im' trying to display it in a visualforce page without any results:

 

My Class:

 

 

	public List<SObject> getOpen()
		{
	
		SObject[] Cuenta = [SELECT Name, 
		         (Select Subject, WhoId, WhatId, Id, IsTask, ActivityDate, Status, Priority, OwnerId FROM OpenActivities  
		          WHERE OwnerID =:USER_ID ORDER BY ActivityDate ) 
		          From Account WHERE id=:RECORD_ID];
		Actividades = Cuenta.get(0).getSObjects('OpenActivities'); 
                //This is just to verify the Actividades list
		for(Integer i=0; i<Actividades.size(); i++)
			{
			System.debug('********Sobject'+Actividades[i]);
			}
		return Actividades;
		}		

 

In my page I want to display the Subject, WhoId, WhatId, etc.

 

If I put:

 

 

	<apex:pageBlock title="Actividades Abiertas" >    
		<apex:dataTable value="{!Open}" var="each" cellpadding="10" border="0" styleClass="list">
			<apex:column headerValue="Acción">{!each}</apex:column>
	</apex:pageBlock>

 

 

I have my 5 id's open activities without a problem.  But if I put:

 

 

	<apex:pageBlock title="Actividades Abiertas" >    
		<apex:dataTable value="{!Open}" var="each" cellpadding="10" border="0" styleClass="list">
			<apex:column headerValue="Acción">{!each.Subject}</apex:column>
	</apex:pageBlock>

 

 

I've got an error ' SObject.Subject Property Unknown'

 

In my debug log I have my list with all the data

 

 

11:10:0.928|USER_DEBUG|[44,4]|DEBUG|********SobjectOpenActivity:{Status=No iniciada, AccountId=001R000000QAo87IAD, WhatId=001R000000QAo87IAD, Subject=Llamada, WhoId=003R000000MurqIIAR, OwnerId=005400000010CwqAAE, IsTask=true, Id=00TR0000008DY1OMAW, ActivityDate=2010-04-09 00:00:00, Priority=Normal}

11:10:0.931|USER_DEBUG|[44,4]|DEBUG|********SobjectOpenActivity:{Status=No iniciada, AccountId=001R000000QAo87IAD, WhatId=a0BR0000002ppkaMAA, Subject=Enviar Encuesta, WhoId=003R000000MurqIIAR, OwnerId=005400000010CwqAAE, IsTask=true, Id=00TR0000008DiZNMA0, ActivityDate=2010-04-26 00:00:00, Priority=Normal}

11:10:0.933|USER_DEBUG|[44,4]|DEBUG|********SobjectOpenActivity:{Status=No iniciada, AccountId=001R000000QAo87IAD, WhatId=001R000000QAo87IAD, Subject=Generar Reporte, WhoId=003R000000MurqIIAR, OwnerId=005400000010CwqAAE, IsTask=true, Id=00TR0000008DY2nMAG, ActivityDate=2010-04-28 00:00:00, Priority=Normal}

11:10:0.936|USER_DEBUG|[44,4]|DEBUG|********SobjectOpenActivity:{AccountId=001R000000QAo87IAD, WhatId=a0BR0000002ppkaMAA, Subject=Reunión, WhoId=003R000000MurqIIAR, OwnerId=005400000010CwqAAE, IsTask=false, Id=00UR0000004Y5fYMAS, ActivityDate=2010-07-20 00:00:00}

11:10:0.939|USER_DEBUG|[44,4]|DEBUG|********SobjectOpenActivity:{AccountId=001R000000QAo87IAD, WhatId=001R000000QAo87IAD, Subject=Reunion, WhoId=003R000000MurqIIAR, OwnerId=005400000010CwqAAE, IsTask=false, Id=00UR0000004Y5cFMAS, ActivityDate=2010-10-19 00:00:00}

 

 

 

 

I know I know, another dumb question.

 

From another system, I get a string that represents a date, ex 03211988, which means March 21, 1988. How to I convert that string into a salesforce date object? I tried the .parse function, but that needs the / to be included in the string, which are not. I suppose I could do a bunch of string manipulation to insert the / but that seems fairly hackish. Any other more elegant ideas?

I have a VF and apex solution that generates a new url and redirects the user to a new create contact page via a button.  In addition, it prepopulates several of the values from the calling record.  When I try to pass the Account id via the con4_lkid field, I get an error that states:

 

Data Not Available The data you were trying to access could not be found. It may be due to another user deleting the data or a system error. If you know the data is not deleted but cannot access it, please look at our support page.

Click here to return to the previous page. 

 

if I remove the reference to the con4_lkid (which is a lookup to the Account master for the contact) then the page displays properly, but the lookup field is not prepopulated.  

Anyone else run into this, and if so, how did you fix it?

TIA

 

 

 

  • December 09, 2009
  • Like
  • 0

Hi All,

 

I know this issue is common... but i really am out of ideas of how to fix this error/limit

I tried numerous variants of code to solve this but nothing works...

 

!! PLEASE HELP   !!

 

Run Failures:
  TestClass2.GenericTestMethod3 System.DmlException: Update failed. First exception on row 0 with id a0R20000000XsgSEAS; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, Sluiten_AF_Taken: execution of BeforeUpdate

caused by: System.Exception: Too many query rows: 516

Trigger.Sluiten_AF_Taken: line 9, column 30: []

 

trigger Sluiten_AF_Taken on Achterstallige_factuur__c (before update) { //haal Id van SYSTEM op User sys = [SELECT Id FROM User WHERE Alias =: 'SYSTE']; //Hulplijst List<Achterstallige_factuur__c> afact=new List<Achterstallige_factuur__c>(); List<Task> toUpdate = new List<Task>(); List<Task> t=new List<Task>([SELECT Id, WhatId FROM Task WHERE CreatedById =: sys.Id and status != 'Afgesloten' ]); for(Achterstallige_factuur__c af: Trigger.new){ if(af.status__c == 'Afgehandeld'){ afact.add(af); } } for(Achterstallige_factuur__c aft: afact){ for(Task tk: t){ if(tk.WhatId==aft.Id){ tk.status = 'Afgesloten'; tk.IsReminderSet = false; toUpdate.add(tk); } } } update toUpdate; }

  

 

 

 

Message Edited by Streepie24 on 11-05-2009 01:28 AM

Hi,

 

Does anybody know how to display a progress bar in VF? The counter would be provided by the controller. actionPoller is very slow (cannot be faster than every 5 sec) so I'm looking for another method. I'm sure something must be possible using actionSupport or actionFunction but I'm not sure how to go about it.

 

Thanks.

Message Edited by asadim on 11-02-2009 03:55 PM
  • November 02, 2009
  • Like
  • 0

I have several pages that contain repeating components (like dataTable) for arrays, which should not be rendered if the array size is zero. Is there a way to accomplish this in VF markup, without having to create a new public property in apex that exposes the size of the array?

 

 

<apex:pageBlockSection title="Assets" rendered="{!renderAssetsForContact}"><apex:dataTable value="{!assetsForContact}" var="asset">

 

public Boolean renderAssetsForContact { get { return assetsForContact.size() > 1; }}

 

 

 

 

 

 

I am new to Apex and have just finished building my first trigger. Before I set up the test code I wanted to make sure that I wasn't going to submit code that was efficient or poorly written. According to an article I read, it is considered poor coding to include a SOQL query within a For loop. I am posting my code in this message and would really appreciate any advice on how to clean up my code so that it works as efficiently as possible.

 

I have highlighted the section I think might be poorly written in red.

 

 

 

 

trigger CreateLGAEvent on LGA__c (after insert, after update){



Map<String, LGA__c> lgaMap = new Map<String, LGA__c>();



List<Event> lgaEvents = new List<Event>();



    if(trigger.isinsert)

    

        for (LGA__c lga : System.Trigger.new){ 



            Event event = new Event(

            

                StartDateTime = lga.LGA_Start_DateTime__c ,

                EndDateTime = lga.LGA_End_Date_Time__c,

                Subject = 'LGA Scheduled',

                IsRecurrence = FALSE,

                Description = lga.Event_Description__c, 

                Location = lga.Event_Subjects__c, 

                Event_ID__c = lga.Event_ID__c,

                IsAllDayEvent = False); 

                

            lgaEvents.add(event);

            

            insert lgaEvents;

              

           }

         

    else

    

        for (LGA__c lga : System.Trigger.New) {

          

            Event event = [Select id, Event_ID__c from Event where Event_ID__c = :lga.Event_ID__c];

              

                event.StartDateTime = lga.LGA_Start_DateTime__c;

                event.EndDateTime = lga.LGA_End_Date_Time__c;

                event.Subject = 'LGA Scheduled'; 

                event.Description = lga.Event_Description__c; 

                event.Location = lga.Event_Subjects__c; 



            lgaEvents.add(event);



            update lgaEvents;

            

            }

              

}

 

 

Thanks in advance.

 

 

JVH

I have created a trigger on  our object LGA__c that will create and insert a new Event. I also want this trigger to update the created Event whenever the LGA__c is updated. To update the correct Event, I created a field called Event_ID__c in both the LGA__c and Event objects. When an LGA is created it auto creates an Event ID and passes that information to the created event. The problem I am having is using a Query to pull up the right event using the Event_ID__c. I have highlighted the exact line of code that is not working in red. I get the following error.

 

Error: Compile Error: unexpected token: 'lga.Event_ID__c' at line 34 column 81

 

Any help on how I can write that query to pull up the correct Event based off the Event_ID__c would be great. Thanks in advance.

 

 

 

trigger CreateLGAEvent on LGA__c (after insert, after update){

Map<String, LGA__c> lgaMap = new Map<String, LGA__c>();

List<Event> lgaEvents = new List<Event>();

    if(trigger.isinsert)
   
        for (LGA__c lga : System.Trigger.new){

            Event event = new Event(
           
                StartDateTime = lga.LGA_Start_DateTime__c ,
                EndDateTime = lga.LGA_End_Date_Time__c,
                Subject = 'LGA Scheduled',
                IsRecurrence = FALSE,
                Description = lga.Event_Description__c,
                Location = lga.Event_Subjects__c,
                Event_ID__c = lga.Event_ID__c,
                IsAllDayEvent = False);
               
            lgaEvents.add(event);
           
            insert lgaEvents;
             
           }
        
    else
   
        for (LGA__c lga : System.Trigger.New) {
       
        String eventID = lga.Event_ID__c;
              
            Event event = [Select id, Event_ID__c from Event where Event_ID__c = lga.Event_ID__c];
             
                event.StartDateTime = lga.LGA_Start_DateTime__c;
                event.EndDateTime = lga.LGA_End_Date_Time__c;
                event.Subject = 'LGA Scheduled';
                event.Description = lga.Event_Description__c;
                event.Location = lga.Event_Subjects__c;

            lgaEvents.add(event);

            update lgaEvents;
           
            }
             
}

I've noticed that when I do for-loops in Javascript in Visualforce (I know, I know! I should put my JavaScript in a JS file!) I'ved noticed that it sometimes gets messed up, particuarly when there are two or more for-loops in the script!

 

This not the first time I've experienced this and it can be achieved quite simply.

 

 

<script type="text/javascript">
function selectLoose(objForm)
{
var records = '';
var els = objForm.elements;

for ( var i=0; i<els.length; i++ )
{
if ( els[i].nodeName.toLowerCase() == 'input' && els[i].getAttribute('type').toLowerCase() == 'checkbox' )
{
if ( els[i].value.indexOf('loose_') == 0 && els[i].checked )
{
records += (records == '' ? '' : ';') + els[i].value.substring(els[i].value.indexOf('_') + 1);
}
}
}

if ( records == '' )
{
alert('You have not selected any loose records to be deleted.');
return false;
}

getObj('delId').value = records;
return false;
}

function selectAllLoose(objAll)
{
var records = '';
var els = objAll.form.elements;

for ( var i=0; i<els.length; i++ )
{
if ( els[i].nodeName.toLowerCase() == 'input' && els[i].getAttribute('type').toLowerCase() == 'checkbox' )
{
if ( els[i].value.indexOf('loose_') == 0 )
{
els[i].checked = objAll.checked;
}
}
}
}
</script>

 

 The code above gets parsed into:

 

 

<script type="text/javascript">
function selectLoose(objForm)
{
var records = '';
var els = objForm.elements;

for ( var i=0; i<els records="" .length; i++ )
{
if ( els[i].nodeName.toLowerCase() == 'input' && els[i].getAttribute('type').toLowerCase() == 'checkbox' )
{
if ( els[i].value.indexOf('loose_') == 0 && els[i].checked )
{
records += (records == '' ? '' : ';') + els[i].value.substring(els[i].value.indexOf('_') + 1);
}
}
}

if ( records == '' )
{
alert('You have not selected any loose records to be deleted.');
return false;
}

getObj('delId').value = records;
return false;
}

function selectAllLoose(objAll)
{
var ;
var els = objAll.form.elements;

for ( var i=0; i<els.length; i++ )
{
if ( els[i].nodeName.toLowerCase() == 'input' && els[i].getAttribute('type').toLowerCase() == 'checkbox' )
{
if ( els[i].value.indexOf('loose_') == 0 )
{
els[i].checked = objAll.checked;
}
}
}
}
</script>

 

 

Message Edited by admintrmp on 10-22-2009 09:19 AM

I have trigger that basically updates the account owner to the corresponding user.

 

//trigger trigger AccountBeforeUpdateEvents on Account (before update) { AccountOpeningUtils_v1.InitUserList(); AccountOpeningUtils_v1.UpdateAccountOfficer(trigger.new); } public class AccountOpeningUtils_v1 { public static void InitUserList() { Boolean inLock = (OpportunityHelper_v1.IsUpdatingAccount() == true || CaseHelper_v1.IsUpdatingAccount() == true); if(!inLock)UserTriggerUtils_v1.InitUserList(); } public static void UpdateAccountOfficer(List<Account> accList) { for(Account a : accList) { if(!UserTriggerUtils_v1.GetUserList().isEmpty() && !UserTriggerUtils_v1.ValueIsNull(a.Account_Officer__c) && a.Account_Officer__c.length() >= 3) { String oCode = a.Account_Officer__c.substring(0, 3).trim(); User officer = UserTriggerUtils_v1.FindAccountOfficer(oCode); if(!UserTriggerUtils_v1.SObjectIsNull(officer))a.OwnerId = officer.Id; } } } } global class UserTriggerUtils_v1 { private static List<User> userList = new List<User>(); private static Map<String, Schema.SObjectField> userFields = Schema.sObjectType.User.fields.getMap(); public static void InitUserList() { String sQuery = 'Select '; Integer i = 0; for(String f : userFields.keySet()) { i ++; sQuery += (i == userFields.keySet().size() ? f : f + ', '); } sQuery += ' FROM User WHERE IsActive = TRUE'; System.debug('### QUERY ###: ' + sQuery); try { userList = Database.query(sQuery); System.debug('### USER LIST ###: ' + userList); } catch(System.QueryException e) { System.debug('### Exception found in userList for' + ' InitUserList() ###:' + e.getMessage()); } } }

when i use data loader i get too many script statements

Is there a way to make a call to the external webService from Apex and then do the parsing of the response manually, rather than using WSDL2Apex.

 

I am not able to import the WSDL into Apex, since the response has anyType keyword in it. I changed the keyword to anyType_x, and was able to import the WSDL. However, since the webService returns anyType as an element in its response, it fails when it's about the parse the response. (anyType not found, since I changed this to anyType_x).

 

I appreciate any advice on this.

 

Thanks

 

 

  • October 20, 2009
  • Like
  • 0

I'm writing a VF page to implement the following business requirement.

 

Allow user to select multiple partner accounts.

For each line item associated with the current opportunity, allow user to enter a percentage split to a partner.

 

If the line items on the current opp are {foo, bar} and the partners selected are {acme, widgetCo} this implies generating a table such as this

 

Partner: acme     Prod   Split %

                                 foo        10

                                 bar         0

 

Partner: widgetCo Prod   Split %

                                 foo        20

                                 bar        25

 

Where split % numbers are entered by the user. I can render it as a datatable inside a datatable, but I the product split information about the partner "acme"

 

How do I do this in VF?

 

 

Message Edited by dj_saaspoint on 10-15-2009 08:13 AM

I have several inputFields where the value is set to the account ownerid.  Is it possible to override the label?

 

<apex:page standardController="Account"> <h1>Manage Salesperson Territory Assignments</h1> <apex:form > <apex:pageBlock title="Update Specific District or Account Ownership" mode="edit"> <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Update"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Used to update owner of specified account and related child accounts" columns="1"> <apex:inputField value="{!account.ownerId}"/> <apex:inputField value="{!account.ownerId}"/> <apex:inputField value="{!account.parentId}"/> </apex:pageBlockSection> </apex:pageBlock> <apex:pageBlock title="Update Account Ownership by State" mode="edit"> <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Update"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Used to update owner of accounts by selected state" columns="1"> <apex:inputField value="{!account.ownerId}"/> <apex:inputField value="{!account.State__c}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>

I would like to change the labels for the account owner inputFields to:

 

"Change Owner From:"

"Change Owner To:"

 

Is this possible?

Hi all,

 

I am having some problems setting the callout timeout in apex. I have a class generated by the WSDL2Apex tool which works fine but I can't seem to be able to change the timeout value. I have tried changing the value of the timeout__x variable that is generated but this doesn't seem to do anything, am I supposed to use this variable during my web service invokation? My code is:

 

 

//Generated by wsdl2apex

public class smsService {

public class sendsms_element {

public String[] sMobileNums;

  public String sMessage;

public String sFrom;

public String sOrganisationId;

private String[] sMobileNums_type_info = new String[]{'sMobileNums','http://www.w3.org/2001/XMLSchema','string','0','-1','true'};

private String[] sMessage_type_info = new String[]{'sMessage','http://www.w3.org/2001/XMLSchema','string','0','1','true'};

private String[] sFrom_type_info = new String[]{'sFrom','http://www.w3.org/2001/XMLSchema','string','0','1','true'};

private String[] sOrganisationId_type_info = new String[]{'sOrganisationId','http://www.w3.org/2001/XMLSchema','string','0','1','true'};

private String[] apex_schema_type_info = new String[]{'http://expwsms','true','true'};

private String[] field_order_type_info = new String[]{'sMobileNums','sMessage','sFrom','sOrganisationId'};

}

 

public class receiveSMSResponse_element {

public String return_x;

private String[] return_x_type_info = new String[]{'return','http://www.w3.org/2001/XMLSchema','string','0','1','true'};

private String[] apex_schema_type_info = new String[]{'http://expwsms','true','true'};

private String[] field_order_type_info = new String[]{'return_x'};

}

 

public class expwsmsHttpSoap11Endpoint {

public String endpoint_x = 'http://hosted.expw.com:8002/axis2/services/expwsms.expwsmsHttpSoap11Endpoint/';

public Map<String,String> inputHttpHeaders_x;

public Map<String,String> outputHttpHeaders_x;

public String clientCert_x;

public String clientCertPasswd_x;

public Integer timeout_x = 120000;

private String[] ns_map_type_info = new String[]{'http://expwsms', 'smsService'};

public String receiveSMS(String JobId,String SMSMessage,String MobileNo,String VMN,String Keyword,String AccountId,String Network,String RecievedDate) {

smsService.receiveSMS_element request_x = new smsService.receiveSMS_element();

smsService.receiveSMSResponse_element response_x;

request_x.JobId = JobId;

request_x.SMSMessage = SMSMessage;

request_x.MobileNo = MobileNo;

request_x.VMN = VMN;

request_x.Keyword = Keyword;

request_x.AccountId = AccountId;

request_x.Network = Network;

request_x.RecievedDate = RecievedDate;

Map<String, smsService.receiveSMSResponse_element> response_map_x = new Map<String, smsService.receiveSMSResponse_element>();

response_map_x.put('response_x', response_x);

WebServiceCallout.invoke(

this,

request_x,

response_map_x,

new String[]{endpoint_x,

'urn:receiveSMS',

'http://expwsms',

'receiveSMS',

'http://expwsms',

'receiveSMSResponse',

'smsService.receiveSMSResponse_element'}

);

response_x = response_map_x.get('response_x');

return response_x.return_x;

}

 

public String sendsms(String[] sMobileNums,String sMessage,String sFrom,String sOrganisationId) {

smsService.sendsms_element request_x = new smsService.sendsms_element();

smsService.sendsmsResponse_element response_x;

request_x.sMobileNums = sMobileNums;

request_x.sMessage = sMessage;

request_x.sFrom = sFrom;

request_x.sOrganisationId = sOrganisationId;

request_x.setTimeout(2000);

Map<String, smsService.sendsmsResponse_element> response_map_x = new Map<String, smsService.sendsmsResponse_element>();

response_map_x.put('response_x', response_x);

WebServiceCallout.invoke(

this,

request_x,

response_map_x,

new String[]{endpoint_x,

'urn:sendsms',

'http://expwsms',

'sendsms',

'http://expwsms',

'sendsmsResponse',

'smsService.sendsmsResponse_element'}

);

response_x = response_map_x.get('response_x');

return response_x.return_x;

}

}

 

public class sendsmsResponse_element {

public String return_x;

private String[] return_x_type_info = new String[]{'return','http://www.w3.org/2001/XMLSchema','string','0','1','true'};

private String[] apex_schema_type_info = new String[]{'http://expwsms','true','true'};

private String[] field_order_type_info = new String[]{'return_x'};

}

 

public class receiveSMS_element {

public String JobId;

public String SMSMessage;

public String MobileNo;

public String VMN;

public String Keyword;

public String AccountId;

public String Network;

public String RecievedDate;

private String[] JobId_type_info = new String[]{'JobId','http://www.w3.org/2001/XMLSchema','string','0','1','true'};

private String[] SMSMessage_type_info = new String[]{'SMSMessage','http://www.w3.org/2001/XMLSchema','string','0','1','true'};

private String[] MobileNo_type_info = new String[]{'MobileNo','http://www.w3.org/2001/XMLSchema','string','0','1','true'};

private String[] VMN_type_info = new String[]{'VMN','http://www.w3.org/2001/XMLSchema','string','0','1','true'};

private String[] Keyword_type_info = new String[]{'Keyword','http://www.w3.org/2001/XMLSchema','string','0','1','true'};

private String[] AccountId_type_info = new String[]{'AccountId','http://www.w3.org/2001/XMLSchema','string','0','1','true'};

private String[] Network_type_info = new String[]{'Network','http://www.w3.org/2001/XMLSchema','string','0','1','true'};

private String[] RecievedDate_type_info = new String[]{'RecievedDate','http://www.w3.org/2001/XMLSchema','string','0','1','true'};

private String[] apex_schema_type_info = new String[]{'http://expwsms','true','true'};

private String[] field_order_type_info = new String[]{'JobId','SMSMessage','MobileNo','VMN','Keyword','AccountId','Network','RecievedDate'};

}

 

Please help as I have checked loads of documentation but can't seem to find out how to do this (I have tried request_x.setTimeout(120000) and request_x.timeout__x = 120000 but these don't seem to work. How can I set the timeout for this request?

 

Thanks

 

James 

Message Edited by Jamz_2010 on 10-05-2009 08:46 AM
Message Edited by Jamz_2010 on 10-05-2009 08:46 AM
Message Edited by Jamz_2010 on 10-05-2009 08:51 AM

Hi,

 

I have a field defined as currency(6,2)

and i want to display it in visualforce page as 123.333,90 €

i am currently using <apex:outputText value="{0,number,###,###.00} €/ anno">

but this displays the currency as 123,333.90 €

 

Hi Friends,

 

Going through the facts mentioned in the apex documentation, it seems that the limit of 10000 query rows when the entry point is an APEX class is applicable to the total cumulative count of all the queries which are a part of that class.

 

For e.g, if i have 5 different queries as part of the same APEX controller class and each one of them retrieves 2001 records, then i would get an exception stating: "Too many query rows - 10005" ??

 

Just want to confirm if my understanding here is correct. Because till now my understanding was that it is applicable to each individual query!!

 

Thanks a ton!!

Cool_D

How can we  redirect a trigger to a standard salesforce URL? Like when the user updates a cutom field in Opportunity, I want him to go to the new Partner reated list page directly when he hits save. Usually you can only see the new partner page only when you click New in Partner subsection from the opportunity details page. But I want to mandate the partner related list page when user selects YES for a custom field in Opportunity page.

I am creating a visualforce page that will live in a section on the contact page.  I am trying to get the page to redirect to an external site, but the entire contact page ends up getting redirected.  I used to be able to do this easily with S-controls, but I'm running into issues using visualforce.  My code is as follows:

 

 

<apex:page StandardController="Contact" extensions="pamExt" action="{!getRedir}" > </apex:page>

 

 where as you may have been able to guess getRedir returns a url.  Can anyone explain to me why this redirects the entire Contact page and maybe give a way that I can fix this so only this vforce page gets redirected?

Thanks

 

 have a business case where I need to display the corresponding input field when a value has been selected. For example: when Phone and fax fields have been selected as to what needs to be added, the cooresponding Phone and fax fields will be displayed. Currently my code is:

 

<apex:actionRegion > <apex:pageblockSection columns="1" > <apex:pageBlockSectionItem > <apex:outputLabel value="What Information needs to be Corrected?" id="thePageBlock1"/> <apex:outputPanel > <apex:inputfield value="{!Manufacturing_Design_Sheet__c.What_Information_needs_to_be_Corrected__c}"> <apex:actionSupport event="onclick" rerender="thePageBlock1" status="status1"/> </apex:inputField> <apex:actionStatus startText="applying value..." id="status1"/> </apex:outputPanel> </apex:pageBlockSectionItem><apex:pageBlockSectionItem > <apex:outputLabel value="Correct the Information"/> <apex:outputPanel > <apex:inputfield value="{!Manufacturing_Design_Sheet__c.Correct_the_Information__c}"> <apex:actionSupport event="onclick" rerender="thePageBlock" status="status"/> </apex:inputField> <apex:actionStatus startText="applying value..." id="status"/> </apex:outputPanel> </apex:pageBlockSectionItem> </apex:pageblockSection> </apex:actionRegion> <apex:pageBlockSection columns="1" rendered="{!Manufacturing_Design_Sheet__c.Correct_the_Information__c==true}"> <apex:inputfield value="{!Manufacturing_Design_Sheet__c.Technical_Phone__c}" /> </apex:pageBlockSection> <apex:pageBlockSection columns="1" rendered="{!And(Manufacturing_Design_Sheet__c.Correct_the_Information__c==true, Manufacturing_Design_Sheet__c.What_Information_needs_to_be_Corrected__c=='Commercial Phone') }"> <apex:inputfield value="{!Manufacturing_Design_Sheet__c.Commercial_Phone__c}" /> </apex:pageBlockSection>

 

 

Any suggestions? I am needing to do the following:

1. Display alll fields connected to their picklist values

2. Specify which column each field is displayed.

  • September 23, 2009
  • Like
  • 0

Hi all,

 

I have an interesting question.  Has anyone found a way of improving speed of the AJAX requests contained within Visualforce pages?

 

We have built a large number of VF pages and it takes between one a three seconds for the action methods contained within links, buttons and action support tags to complete and to re-render the page.

 

This normally isn't a problem on single row input forms.  However we have started to use multi line input forms for updating and editing large quantities of data.  This means that we have to wait for the action to complete before changing the value in the subsequent fields.

 

Maybe I'm just being impatient as I'm relatively new to AJAX but it seems to me that other AJAX sites I have used respond much quicker. 

 

It would be interesting to hear your thoughts / comments. 

Custom Setting is a feature to contain and mange parameters... so tracking the changes is a reasonable requirement.

 

Do you know it is already trackable or not? The schema doesn't have "(Name)History" table, so my guess is... not. 

 

I'm going to post it to idea if there is no such function yet.


ThomasTT

I'd like to put a List button on Task related list. For example, when user opens Account detail page, there is a Task related list which shows all Tasks related to the Account. I'd like put a button on the related list with checkboxes for multi-selection (of Tasks).

And, I'd like to use a VF page for the button.

So, if I go to the Task Custom Buttons & Links configuration page, I see "List Button" and "Visualforce page", but the "Visualforce page" picklist doesn't show anything.

Because, to show VF page in the list, that VF page must be using Task StandardSetController, but StandardSetController doesn't support Task. if this is Detail page button, that has to be Task Standard Controller so that's ok. So it's impossible to put VF page on the List button, isn't it?

Is there anyway to use VF page for Task List button?

Only thing I came up is to use OnClick javascript and GETRECORDIDS function, and concatinate the ids and document.location.replace("/apex/MyVFPage?ids="+ids). Is this the only way? This is ok to me, but if there is anyway to directly use VF Page, I'd like to know.

Thank you in advance.

ThomasTT

Message Edited by ThomasTT on 10-09-2009 06:41 PM

This is actually a confirmation to SFDC (so if some God in the SFDC heaven or any other wild heaven is watching me, please answer to my question...)

I got an parse error when I tried to generate apex class from WSDL by WSDL2APEX.

 

Error: Unable to find schema for element; {http://www.w3.org/2001/XMLSchema}string

like this post: http://community.salesforce.com/sforce/board/message?board.id=general_development&message.id=28929

Long story in short, I found the reason. Request/Response message doesn't accept just a xsd:string. It has to be complexType.

This post

http://community.salesforce.com/sforce/board/message?board.id=apex&message.id=2058

mentioned that SFDC doesn't support simpleType restriction, but I wonder it also mens it doesn't support single-standard type Request/Response.

 

Question: Am I correct? which means there is no way to use this WSDL? (this WSDL is from a product, so I can't change the actual format... only way to use this is to create a custom HTTP request...)

 

So, this doesn't work, because SessionID is xsd:string.

<definitions xmlns:tns="http://www.hoge.com/hoge/Object"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
name="Companies"
targetNamespace="http://www.hoge.com/hoge/Object">
<types>
<xsd:schema elementFormDefault="qualified" targetNamespace="http://www.hoge.com/hoge/Object">
<xsd:element name="Login">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="1" name="Username" type="xsd:string"/>
<xsd:element minOccurs="0" name="Password" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="SessionID" type="xsd:string"/>
</xsd:schema>
</types>
<message name="Login">
<part element="tns:Login" name="parameters"/>
</message>
<message name="LoginResponse">
<part element="tns:SessionID" name="body"/>
</message>

<portType name="CompaniesPort">
<operation name="Login">
<input message="tns:Login"/>
<output message="tns:LoginResponse"/>
</operation>
</portType>
<binding name="CompaniesSoapBinding" type="tns:CompaniesPort">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="Login">
<soap:operation soapAction="https://morethan/foo/bar/Login" style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="CompaniesService">
<port binding="tns:CompaniesSoapBinding" name="CompaniesService">
<soap:address location="https://morethan/foo/bar"/>
</port>
</service>
</definitions>

 This works because LoginOut is complexType.

<definitions xmlns:tns="http://www.hoge.com/hoge/Object"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
name="Companies"
targetNamespace="http://www.hoge.com/hoge/Object">
<types>
<xsd:schema elementFormDefault="qualified" targetNamespace="http://www.hoge.com/hoge/Object">
<xsd:element name="Login">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="1" name="Username" type="xsd:string"/>
<xsd:element minOccurs="0" name="Password" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="LoginOut">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="SessionID" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

</xsd:schema>
</types>
<message name="Login">
<part element="tns:Login" name="parameters"/>
</message>
<message name="LoginResponse">
<part element="tns:LoginOut" name="body"/>
</message>
<portType name="CompaniesPort">
<operation name="Login">
<input message="tns:Login"/>
<output message="tns:LoginResponse"/>
</operation>
</portType>
<binding name="CompaniesSoapBinding" type="tns:CompaniesPort">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="Login">
<soap:operation soapAction="https://morethan/foo/bar/Login" style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="CompaniesService">
<port binding="tns:CompaniesSoapBinding" name="CompaniesService">
<soap:address location="https://morethan/foo/bar"/>
</port>
</service>
</definitions>
ThomasTT

I'd like to display a input field (with apex:inputField) for unit price and a text for the currency Iso Code and I want to display them in 1 line (e.g. ______  USD, not ______ <br/> USD).

And the input field has required='true' attribute... this is the problem, but anyway, I tried the following 2 ways:

<apex:pageblockSectionItem>
<apex:outputLabel value="Unit Price"/>
<apex:outputPanel>
<apex:inputField id="price" value="{!oppLineItem..UnitPrice}" required="true"/>
{!opportunity.currencyIsoCode}
</apex:outputPanel>
</apex:pageblockSectionItem>

<apex:pageblockSectionItem>
<apex:outputLabel value="Unit Price"/>
<apex:outputPanel>
<apex:inputField id="price" value="{!oppLineItem..UnitPrice}" required="true">
{!opportunity.currencyIsoCode}
</apex:inputField>
</apex:outputPanel>
</apex:pageblockSectionItem>

 and both ended up with the following HTML.

<div class="requiredInput">
<div class="requiredBlock"/>
<input id="price" type="text" name="price"/>
</div>
USD

How can I make it in 1 line like the following HTML

<div class="requiredInput">
<div class="requiredBlock"/>
<input id="price" type="text" name="price"/> USD
</div>

 or is there any other way to make them in 1 line? maybe it's just HTML/CSS issue, but any help is appreciated.

Thank you in advance.

ThomasTT

 

Message Edited by ThomasTT on 09-28-2009 11:07 AM

I'm trying to put a commandButton in each row in pageBlockTable. Those buttons call the same function ("Update"), but different parameter. The function updates the status in the row by using the given parameter to determine which row should be updated.

 

Also there is a button "refresh" to reRender the entire pageBlockTable. The statuses are updated by controller, so reRendering should not loose any data (status).

 

Initial status is "new" when you click the "update" button, the status in the row will change to the curren time.

After changing all status from "new" to time, click "refresh". Nothing should change.

 

When you click "Update"s one by one, refresh doesn't change anything.

However, when you click very quickly without waiting the end of each actionFucntion (you can do that because it's asychronous), the refresh loose some values from the page and never come back!!!

 

That's very weird because all values are stored in the controller so that page refresh shouldn't matter.

 

 

 

Is this because Controller is not stateless and the state is controlled (managed) by browser? Is that the reason why some concurrent processes conflict and loose the values?

 

 

And, what could be the workaround? disable buttons in onStart and enable them onStop?

 

Thank you in advance.

 

 

ThomasTT

 

 

[Initial page]

 

Initial page

[Change status from 'new' to the time]
Click

[After refresh, some values are lost !!]

some values are lost

 

 

 [VF page]

<apex:page controller="MultiThreadTestController">
<apex:form >
<apex:pageBlock id="pageBlock">
<apex:commandButton value="refresh" action="{!refresh}" rerender="pageBlock"/>
<apex:pageBlockTable value="{!Items}" var="item">
<apex:column >
<apex:facet name="header">Button</apex:facet>
<apex:commandButton value="Update" action="{!updateStatus}" reRender="status">
<apex:param name="selectedItem" value="{!item.name}" assignTo="{!selectedItem}"/>
</apex:commandButton>
</apex:column>
<apex:column >
<apex:facet name="header">Status</apex:facet>
<apex:outputText value="{!item.status}" id="status"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

 [Controller]

public class MultiThreadTestController {
class Item {
public string name {get; set;}
public string status {get; set;}
public Item(string name, string status){this.name = name; this.status = status;}
}

public Item[] items {set; get;}
public string selectedItem {get; set;}

public MultiThreadTestController (){
items = new List<Item>();
for(integer i=1;i<=5;i++) items.add(new Item(''+i, 'New'));
}

public PageReference refresh() {return null;}

public PageReference updateStatus() {
Item selected = null;
for(Item i : items){if(i.name == selectedItem){selected = i;break;}}
if(selected == null) return null;
selected.status = selectedItem + ' - ' + datetime.now();
// wait for a while
integer a = 0;
for(integer i=0;i<10000;i++) a+=i;
return null;
}
}

 

 

 

 

 

 

 

 

I'm trying to use commandButton onComplete in pageBlockTable and I'd like to use 'var' variable in the onComplete, but I can't use 'var' variable in onComplete. I can use 'var' variable in onClick, but not in onComplete.

 

For example,  I define 'var' variable "element", which is one of the elements in array "list". In onClick, I can use {!element}, but when I code {!element} in onComplete, VF editor tries to correct me to implement "OnCompleteTestControler.element" property, which means that it doesn't allow me to use 'var' variable in onComplete.

 

Is it the specification? or a bug? (or don't I understand VF at all?)

 

ThomasTT

 

[VF page]

<apex:page controller="OnCompleteTestController"><apex:form ><apex:pageBlock > <apex:pageBlockTable var="element" value="{!list}"> <apex:column> <apex:facet name="header">Name</apex:facet> <apex:outputText value="{!element}"/> </apex:column> <apex:column> <apex:facet name="header">Button for onClick</apex:facet> <apex:commandButton value="click me for {!element}" onClick="alert('{!element}');"/> </apex:column> <apex:column> <apex:facet name="header">Button for onComplete</apex:facet> <!-- Not allowed <apex:commandButton value="click me for {!element}" onComplete="alert('{!element}');"/> --> <apex:commandButton value="click me for {!element}" onComplete="alert('No var variable!');"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock></apex:form></apex:page>

 

 

 [Controller]

 

public class OnCompleteTestController { public String[] getList() { return new String[]{'alpha', 'beta', 'gamma'}; } }

 

 

 

 

This is actually a confirmation to SFDC (so if some God in the SFDC heaven or any other wild heaven is watching me, please answer to my question...)

I got an parse error when I tried to generate apex class from WSDL by WSDL2APEX.

 

Error: Unable to find schema for element; {http://www.w3.org/2001/XMLSchema}string

like this post: http://community.salesforce.com/sforce/board/message?board.id=general_development&message.id=28929

Long story in short, I found the reason. Request/Response message doesn't accept just a xsd:string. It has to be complexType.

This post

http://community.salesforce.com/sforce/board/message?board.id=apex&message.id=2058

mentioned that SFDC doesn't support simpleType restriction, but I wonder it also mens it doesn't support single-standard type Request/Response.

 

Question: Am I correct? which means there is no way to use this WSDL? (this WSDL is from a product, so I can't change the actual format... only way to use this is to create a custom HTTP request...)

 

So, this doesn't work, because SessionID is xsd:string.

<definitions xmlns:tns="http://www.hoge.com/hoge/Object"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
name="Companies"
targetNamespace="http://www.hoge.com/hoge/Object">
<types>
<xsd:schema elementFormDefault="qualified" targetNamespace="http://www.hoge.com/hoge/Object">
<xsd:element name="Login">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="1" name="Username" type="xsd:string"/>
<xsd:element minOccurs="0" name="Password" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="SessionID" type="xsd:string"/>
</xsd:schema>
</types>
<message name="Login">
<part element="tns:Login" name="parameters"/>
</message>
<message name="LoginResponse">
<part element="tns:SessionID" name="body"/>
</message>

<portType name="CompaniesPort">
<operation name="Login">
<input message="tns:Login"/>
<output message="tns:LoginResponse"/>
</operation>
</portType>
<binding name="CompaniesSoapBinding" type="tns:CompaniesPort">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="Login">
<soap:operation soapAction="https://morethan/foo/bar/Login" style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="CompaniesService">
<port binding="tns:CompaniesSoapBinding" name="CompaniesService">
<soap:address location="https://morethan/foo/bar"/>
</port>
</service>
</definitions>

 This works because LoginOut is complexType.

<definitions xmlns:tns="http://www.hoge.com/hoge/Object"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
name="Companies"
targetNamespace="http://www.hoge.com/hoge/Object">
<types>
<xsd:schema elementFormDefault="qualified" targetNamespace="http://www.hoge.com/hoge/Object">
<xsd:element name="Login">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="1" name="Username" type="xsd:string"/>
<xsd:element minOccurs="0" name="Password" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="LoginOut">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="SessionID" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

</xsd:schema>
</types>
<message name="Login">
<part element="tns:Login" name="parameters"/>
</message>
<message name="LoginResponse">
<part element="tns:LoginOut" name="body"/>
</message>
<portType name="CompaniesPort">
<operation name="Login">
<input message="tns:Login"/>
<output message="tns:LoginResponse"/>
</operation>
</portType>
<binding name="CompaniesSoapBinding" type="tns:CompaniesPort">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="Login">
<soap:operation soapAction="https://morethan/foo/bar/Login" style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="CompaniesService">
<port binding="tns:CompaniesSoapBinding" name="CompaniesService">
<soap:address location="https://morethan/foo/bar"/>
</port>
</service>
</definitions>
ThomasTT
For example if you are using a visual flow to do some data maintenance task - e.g. updating contact details.


You want to ask the user to update fields like the Department, but you want to default the choice to display the existing value from the contact record.

At the moment you can only default it to a static choice.  I would like to be able to default it to the value of a lookup variable, so that the user can see the department is currently 'Sales' or whatever.

(The workaround I have found so far is to have n versions of the screen - with each one having the department defaulting to one of the n possible values - i.e. one for 'Sales', one for 'Finance', etc.  and a decision step to decide which screen to show. This is 'ok' for a small number of choices, but un-manageable for picklists with more than a few options)

 

(NB - this is a copy of an Idea that I created earlier https://sites.secure.force.com/success/ideaView?id=08730000000ihzjAAA)

Hello

          I am trying to create a date time picker in visualforce page but i unable to create it. As i try it in simple html it is quite easy .

Any suggestion regarding this will be helpful for me and if possible give me some basic code to create it.

 

Thanks...

I need your help. I've a subquery and Im' trying to display it in a visualforce page without any results:

 

My Class:

 

 

	public List<SObject> getOpen()
		{
	
		SObject[] Cuenta = [SELECT Name, 
		         (Select Subject, WhoId, WhatId, Id, IsTask, ActivityDate, Status, Priority, OwnerId FROM OpenActivities  
		          WHERE OwnerID =:USER_ID ORDER BY ActivityDate ) 
		          From Account WHERE id=:RECORD_ID];
		Actividades = Cuenta.get(0).getSObjects('OpenActivities'); 
                //This is just to verify the Actividades list
		for(Integer i=0; i<Actividades.size(); i++)
			{
			System.debug('********Sobject'+Actividades[i]);
			}
		return Actividades;
		}		

 

In my page I want to display the Subject, WhoId, WhatId, etc.

 

If I put:

 

 

	<apex:pageBlock title="Actividades Abiertas" >    
		<apex:dataTable value="{!Open}" var="each" cellpadding="10" border="0" styleClass="list">
			<apex:column headerValue="Acción">{!each}</apex:column>
	</apex:pageBlock>

 

 

I have my 5 id's open activities without a problem.  But if I put:

 

 

	<apex:pageBlock title="Actividades Abiertas" >    
		<apex:dataTable value="{!Open}" var="each" cellpadding="10" border="0" styleClass="list">
			<apex:column headerValue="Acción">{!each.Subject}</apex:column>
	</apex:pageBlock>

 

 

I've got an error ' SObject.Subject Property Unknown'

 

In my debug log I have my list with all the data

 

 

11:10:0.928|USER_DEBUG|[44,4]|DEBUG|********SobjectOpenActivity:{Status=No iniciada, AccountId=001R000000QAo87IAD, WhatId=001R000000QAo87IAD, Subject=Llamada, WhoId=003R000000MurqIIAR, OwnerId=005400000010CwqAAE, IsTask=true, Id=00TR0000008DY1OMAW, ActivityDate=2010-04-09 00:00:00, Priority=Normal}

11:10:0.931|USER_DEBUG|[44,4]|DEBUG|********SobjectOpenActivity:{Status=No iniciada, AccountId=001R000000QAo87IAD, WhatId=a0BR0000002ppkaMAA, Subject=Enviar Encuesta, WhoId=003R000000MurqIIAR, OwnerId=005400000010CwqAAE, IsTask=true, Id=00TR0000008DiZNMA0, ActivityDate=2010-04-26 00:00:00, Priority=Normal}

11:10:0.933|USER_DEBUG|[44,4]|DEBUG|********SobjectOpenActivity:{Status=No iniciada, AccountId=001R000000QAo87IAD, WhatId=001R000000QAo87IAD, Subject=Generar Reporte, WhoId=003R000000MurqIIAR, OwnerId=005400000010CwqAAE, IsTask=true, Id=00TR0000008DY2nMAG, ActivityDate=2010-04-28 00:00:00, Priority=Normal}

11:10:0.936|USER_DEBUG|[44,4]|DEBUG|********SobjectOpenActivity:{AccountId=001R000000QAo87IAD, WhatId=a0BR0000002ppkaMAA, Subject=Reunión, WhoId=003R000000MurqIIAR, OwnerId=005400000010CwqAAE, IsTask=false, Id=00UR0000004Y5fYMAS, ActivityDate=2010-07-20 00:00:00}

11:10:0.939|USER_DEBUG|[44,4]|DEBUG|********SobjectOpenActivity:{AccountId=001R000000QAo87IAD, WhatId=001R000000QAo87IAD, Subject=Reunion, WhoId=003R000000MurqIIAR, OwnerId=005400000010CwqAAE, IsTask=false, Id=00UR0000004Y5cFMAS, ActivityDate=2010-10-19 00:00:00}

 

 

 

 

Hi,

 

I am spending alot of time to figure out how to construct the query to get the result I want in SafesForce, but no luck. 

What I have it

1. From Account, I created an Opportunity.

2. From Opportunity, I created a Case.

3. From Case, I create mutilep Tasks associated with the case.

 

The result I try to escomblish is listing these fields:

Account, Opportunity, Case, and Tasks.

Account#1, Opt# 1, Case# 1, Task#1

Account#1, Opt# 1, Case# 1, Task#2

Account#1, Opt# 1, Case# 1, Task#3

Account#2, Opt# 2, Case# 2, Task#4

Account#2, Opt# 2, Case# 2, Task#5

 

I have put together this query, but it only show Account.Name, Opportunity, and Case,  Tasks are not show up since they are not tied to Case (if I created Task from Account, then it will show up in this query, but I need to create it from Case).

 

select account.Name, (select Opportunity.Name from Account.Opportunities),  (Select CaseNumber from Cases), (select Task.Subject from Tasks)  from Account

 Any advice would be appreciated.

 

Thanks,

I need to determine whether a user has write access to a given SObject record. There are a couple ways I know to do this, both with distinct downsides. First, I can simply do a try/catch update on the record, but that changes the last-modified date, and has some other issues with security in a managed package.

 

Second, I can crawl the SObject__Share object, and figure things out from there. The problem there, I discovered, is that once you reference an xxx__Share object in Apex, you can no longer change the sharing rules for that xxx object. It complains "Unable to change sharing model because sharing objects are referenced by the following components: Apex.cls"

 

I saw in a thread from over a year ago that SF recognized a need for this. Has it been included in the platform yet?

 

Thanks. 

Hi everyone i have a list in my Apex class which has soql query result..

        

String query = 'SELECT  City,Latitude__c FROM Lead WHERE City LIKE \''+city+'%\'';
       
        leadrecords = Database.query(query);   

 

Eg :in the above line leadrecords is alist of lead type

 

    private List<Lead> leadrecords;

 

So now iam trying to pass this list to ajavascript variable so dat javascript variable should have query  output...but when i have done like this iam able to pass the list but when iam tryong to display that it is displaying the  ids  but i want to display the field city and latitude which are storesd in that list how to do it please someone help me with the solution... to javascript variable so how to pass this list to javascript variable

  

I want to add the Loading animation to all of my buttons while salesforce is thinking but hasn't processed and loaded the next page:

 

Just like when you Click save on a case, Upload an attachment, etc.

I know I know, another dumb question.

 

From another system, I get a string that represents a date, ex 03211988, which means March 21, 1988. How to I convert that string into a salesforce date object? I tried the .parse function, but that needs the / to be included in the string, which are not. I suppose I could do a bunch of string manipulation to insert the / but that seems fairly hackish. Any other more elegant ideas?

I'm new to visualforce and I've got a custom object, Property__c with a multi-select picklist of classifications (Classification__c). How can I put those picklist values onto a visualforce page with a custom controller? And how do I retrieve the value(s) for use in a query?
Message Edited by ethanone on 03-26-2010 10:22 AM

Hi

 

I have a method in the controller to delete a record when i click on a apex:outputLink   ,but before i delete a record i have to ask for a confirmation using javascript ,How can i call a apex method from a javascript using the user in put if the user says yes it should execute otherwise it should not execute at all .

 

Regards

Vinayak sharma

I have created a custom object that operates similiar to the Account Contact role object.

 

What is want the code below to do is to make sure that only one record can be marked as Primary at time.

I a user updates a record and marks it as Primary the trigger code will in turn find other records where Primary is equal to true and will change it to false.

 

I get the following error implement the trigger code as shown below

Developer script exception from 'test' : AccountContactRole_SetPrimary : AccountContactRole_SetPrimary: execution of BeforeUpdate caused by: System.SObjectException: DML statment cannot operate on trigger.new or trigger.old Trigger. AccountContactRole_SetPrimary: line 17, column

 

trigger AccountContactRole_SetPrimary on Account_Contact_Role__c (after update) { // Validate if the Primary and the combination of the contact and the role is not duplicated for the relevant account List <Account_Contact_Role__c> acrList = new List<Account_Contact_Role__c>(); for (Account_Contact_Role__c acr: Trigger.New){ Id CurrentId = acr.Id; if (acr.Primary__c == true){ for (Account_Contact_Role__c acrP : [SELECT Id FROM Account_Contact_Role__c WHERE Id !=: acr.Id and Primary__c = true]){ acrP.Primary__c = false; acrList.add(acr); } } } if (!acrList.isEmpty()){ update acrList; } }

 

 

 

I'm a bit stumped on this. I've created a managed package which includes a hierarchical custom setting at the org level. This is then used in custom formula fields. All works well if you view the pages as a system administrator, but if you login as a standard user all you see is #Error!

I've checked and the fields are set as visible and read only, and the the standard user is set to view the correct page layout. The formula fields display fine if I replace the custom settings part with a string, and of course work fine for sys admins. Where else should I look to make sure standard users have access to this data?

Many thanks!

  • January 25, 2010
  • Like
  • 0

I have the code below in an Apex test prior to Test.startTest().  I would have thought that this would bump the query rows by at most one row but it doesn't; it bumps the query rows by 201.  That statement gets executing a few times and I exceed the 500 query row limit.   In and RDBS, that query would return exactly 1 row.  What's going on?  Does it count every row scanned even though one value gets returned?  That would mean you could never execut select count() from account if you have more than 10,000 accounts.

 

 

                               Select count()
                              From AccountShare 
                              where Account.Office_Front_or_Back__c = 'Front Office'
                              and UserOrGroupId in :groupList
                              and Account.enrollment__c >= 5
                              and Account.enrollment__c <= 650 limit 201]

I am creating a visualforce page that will live in a section on the contact page.  I am trying to get the page to redirect to an external site, but the entire contact page ends up getting redirected.  I used to be able to do this easily with S-controls, but I'm running into issues using visualforce.  My code is as follows:

 

 

<apex:page StandardController="Contact" extensions="pamExt" action="{!getRedir}" > </apex:page>

 

 where as you may have been able to guess getRedir returns a url.  Can anyone explain to me why this redirects the entire Contact page and maybe give a way that I can fix this so only this vforce page gets redirected?

Thanks

 


first of all, can any body explain/show the steps on how to post a screenshot as part of the message on this community. i can see people doing this but i am unable to do so.

 

anyway i try to explain in words:

 

i am trying to display an error message

 

 

 

<apex:inputText value="{!subject}" id="Subject" maxlength="80" required="true" id="Subject_Validation"/>

<apex:message for="Subject_Validation" styleClass="locationError" />

 

 it works fine but i am getting it in Awkward format  - why j_id0:j_id2:j_id11:

 

j_id0:j_id2:j_id11:Subject_Validation: Validation Error: Value is required.

 

its same for IE/Mozilla.

 

any suggestion where i am wrong.

 

 

 

We have overidden our new and edit buttons for Cases to go to a custom visualforce page.  This was fine until now we want to utilize Record Types.  Now, regardless of the record type chosen, new cases go to the custom visualforce page instead of the page layout for the record type.  I am thinking that I need another VF page to act as a proxy to route the user to the correct page.  I have read a couple of forum posts but am unsure if they are applicable to my problem.

 

http://forums.sforce.com/sforce/board/message?board.id=Visualforce&thread.id=4875