• Gsajeesh
  • NEWBIE
  • 25 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 11
    Replies

Hi folks,

 

I've written a really simple controller extension for a custom object, that ensures the "target" of my Visualforce page is only ever one record (there only exists one record for this object, it's a kind of "joining object").


The class is below, but I'm struggling to get my head round what my test class should try and invoke. Any help massively appreciated!

 

Thanks,

Lee

 

public class BPT_SummaryViewController{
    public BPT_SummaryViewController(ApexPages.StandardController projcon){}
    
    public Bid_Planning_Summary__c getSummary(){
        Bid_Planning_Summary__c a = [select id from Bid_Planning_Summary__c][0];
        return a;
    }
}

 

Hi,

 

Is there a way in Salesforce to specify the running user while scheduling and apex job?

I have an Apex Batch job which auto creates deals based on some criteria and posts chatter messages. The Batch job has to be scheduled for once a day.

I am able to schedule it using the 'Shedule Apex' button.
 But in this case , since the scheduler is me, the message of activity completion comes to me and the chatter posts mention my name in the posts .

I need a way to schedule the batch job as a generic system user so that the messages go to generic email id and the chatter posts mention generic user name.

 

Please help

 

Thanks

 

 

HI All

 

In salesforce, when creating new objects and navigating to any other object ( or any other tab/ application/any other part of the application) in the application all data is lost unless saved before. 

Is it possible to display a message asking the user to save the object before navigating to the other tab or other part of application?  we are using standard detail pages for the objects

 

Please help!

Hi All,

 

I have the following requirement. Please suggest some solutions

 

All items deleted by users should be kept in the recycle bin for 12 months . The users should not be able to manually empty the recycle bin.

Is there a way to implement this in salesforce.

 

Thanks

Gayathri

In salesforce, when creating new objects and navigating to any other object ( or any other tab) in the application all data is lost unless saved before.  Is it possible to display a message asking the user to save the object before navigating to the other tab or other part of application

When creating new objects and intuitively pressing the Enter key the system saves and closes the page and returns to the main menu. I need to limit the Enter key  to the entry fields and neither triggering the save action nor directly taking the user back to the main screen. Is this possible through a Java script? If yes, should I create visualforce pages for standard object detail pages  and override detail page of standard objects ? Or is there any other method to implement this? Pls help!

Hi All,

 

Possible bug with Apex Maps.  Am seeing very strange and prohibitive behaviour - any comments welcome.

 

Code is as follows - idea is to take some map values to a list, then update them.  

 

In this example there is one record in the map - lets try to put it in a list then update it.

 

// update positions
	if(!posMap.isEmpty()){
	       List<Position__c> posUpdates = new List<Position__c>();
		posUpdates = posMap.Values();
		system.debug('posUpdate record -->'+posUpdates[0]);
		system.debug('id ->'+posUpdates[0].id);
		system.debug('Affiliation_Final__c >'+posUpdates[0].Affiliation_Final__c);
		update posUpdates;
	}

 K - now what does the debug log show?

 

USER_DEBUG|[403]|DEBUG|posUpdate record -->Position__c:{Affiliation_Final__c=a03N0000000mQEKIA2 RecordTypeId=01290000000f9xxAAA, Position_Type__c=Junior Warden, Date_of_Installation__c=2013-03-12 00:00:00, Id=a07N0000000iA6lIAE }
11:21:17.825 (825418000)|USER_DEBUG|[404]|DEBUG|id ->null
11:21:17.825 (825468000)|USER_DEBUG|[405]|DEBUG|Affiliation_Final__c ->null
11:21:17.825 (825516000)|DML_BEGIN|[406]|Op:Update|Type:Position__c|Rows:1
11:21:17.826 (826821000)|DML_END|[406]
11:21:17.826 (826971000)|EXCEPTION_THROWN|[406]|System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified

 For some reason the value in the map doesnt make it to the list, and we then get obvious error ....

 

Any ideas anyone?

 

Dear Expert,

I am trying to Pass parameter to Apex method from VF page.It work for remove But i am not able to get the parameter value for update.

 

<apex:repeat value="{!lstAuthContacts}" var="AC">
 <apex:form >
 <apex:commandLink value="Remove" action="{!removeContact}">
   <apex:param name="delContact" value="{!AC.Id}" assignTo="{!cParam}"></apex:param>
 </apex:commandLink>

<label>First name*</label>
<apex:inputField value="{!AC.FirstName}" styleClass="form-text" id="form-text-contact-first-name"/>

<label>Last name*</label>
<apex:inputField value="{!AC.LastName}" styleClass="form-text" id="form-text-contact-last-name"/>
<label>Phone*</label>
<apex:inputField value="{!AC.Phone}" styleClass="form-text" id="form-text-contact-phone"/>
<label>Email address*</label>
<apex:inputField value="{!AC.Email}" styleClass="form-text" id="form-text-contact-email"/>

<apex:commandButton action="{!updateAuthContact}" value="Save updates" id="theButton"> <apex:param name="updateContact" value="{!AC.Id}" assignTo="{!cParam}"></apex:param> </apex:commandButton>
</apex:form>
</apex:repeat>

 

 

public with sharing class AccountProfileController {
public Id aid {get;set;}
public string cParam{get;set;} public list<Contact> lstAuthContacts{get;set;} public AccountProfileController(){ getlstAuthContacts(); } private void getlstAuthContacts(){ aid = Apexpages.currentPage().getParameters().get('id'); if(aid != ''){ lstAuthContacts = [Select Contact.Id, Contact.Name, Contact.Contact_Type__c, Contact.FirstName, Contact.LastName, Contact.Phone, Contact.Email, Contact.MailingStreet, Contact.MailingCity, Contact.MailingState, Contact.MailingPostalCode, Contact.MailingCountry, Contact.Living_Will__c From Contact Where Contact.AccountId = :aid And Contact.Contact_Type__c = 'Authorized Contact']; } }
public PageReference removeContact(){
if(cParam != ''){
Contact toDel=new Contact(id=cParam);
delete todel;
getlstAuthContacts
}
returm null;
}
public PageReference updateAuthContact() {
if(cParam != ''){
Contact toUpdate=new Contact(id=cParam);
update toUpdate;
getlstAuthContacts();
}
return null;
}
}



 

Is there any way to change the total salesforce standard pages using any css / home page components  / any other way?

 

What we can see once you login into salesforce, i want to change the total pages that i want ? 

 

Is this allow by salesforce ?

 

 

 

Hi folks,

 

Today I come to you looking for some help understanding how to bulkify a trigger.  I currently have this code.

 

if(Trigger.isUpdate)
{
Projection_Multi_Year__c testObj = Trigger.new[0];
List<Projection_Multi_Year__c> checkForDups = new List <Projection_Multi_Year__c>([select id from Projection_Multi_Year__c where
account__c = :testObj.account__c and ownerID = :testObj.ownerID]);
if(checkForDups.size() != 0)
{
trigger.new[0].addError('Update dupe error');
}
else
{
String profileID = UserInfo.getProfileID();
String profileName = [Select name from Profile where ID = :profileID].name;
for(Projection_Multi_Year__c obj : Trigger.New)
{

String accountName = [select name from Account where ID = :obj.Account__c].name;
User ownerObj = [select ID,name,LHH_Zone__c,Region__c,ManagerID from User where ID = :obj.ownerID];
String ownerName = [select name from User where ID = :obj.ownerID].name;
String managerName = [select name from USER where ID = :ownerObj.ManagerID].name;
System.debug('obj.CreatedBy.name = ' + old.CreatedBy.Name);
System.debug('obj.CreatedBy = ' + old.CreatedByID);
obj.Projection_Name__c = accountName + ' - ' + divisionName + ' - ' + ownerObj.name;
//this ^ field has 32,000 some chars. Need to also make a var for a 80 char field
if(accountName.length() > 80)
{
accountName = accountName.substring(0,79);
}

if(ownerName.length() > 80)
{
ownerName = ownerName.substring(0,79);
}
String truncatedName = ownerName + ' - ' + accountName + ' - ' + divisionName;
if(truncatedName.length() > 80)
{
truncatedName = truncatedName.substring(0,79);
}
obj.Name = truncatedName;
obj.Manager__c = managerName;
obj.LHH_Zone__c = ownerObj.LHH_Zone__c;
obj.Country_Region__c = ownerObj.Region__c;

}//end of For

 

So while I understand the basics of my problem I am not sure how to write the solution.  I am going to be sending a bulk upload of thousnads of records at this trigger, so I cant have queries inside of a for loop that will itereate through all the records.

 

Help would be much appriciated on the specifics.

Hi,

 

Is there a way in Salesforce to specify the running user while scheduling and apex job?

I have an Apex Batch job which auto creates deals based on some criteria and posts chatter messages. The Batch job has to be scheduled for once a day.

I am able to schedule it using the 'Shedule Apex' button.
 But in this case , since the scheduler is me, the message of activity completion comes to me and the chatter posts mention my name in the posts .

I need a way to schedule the batch job as a generic system user so that the messages go to generic email id and the chatter posts mention generic user name.

 

Please help

 

Thanks

 

 

Suppose there is a VF

 

<apex:page standardController="Acc" extensions="Acc_Ext">

    <apex:commandButton action={!Run} value="Run">

</apex:page>

 

In Acc_Ext I want to call a method from another class i.e Sub_Acc_Ext. And Sub_Acc_Ext has got method as Run()

How to call this Run() in my Acc_Ext class????

 

Please help!!!!!!!!!!!!!!

  • December 19, 2012
  • Like
  • 0

Hi folks,

 

I've written a really simple controller extension for a custom object, that ensures the "target" of my Visualforce page is only ever one record (there only exists one record for this object, it's a kind of "joining object").


The class is below, but I'm struggling to get my head round what my test class should try and invoke. Any help massively appreciated!

 

Thanks,

Lee

 

public class BPT_SummaryViewController{
    public BPT_SummaryViewController(ApexPages.StandardController projcon){}
    
    public Bid_Planning_Summary__c getSummary(){
        Bid_Planning_Summary__c a = [select id from Bid_Planning_Summary__c][0];
        return a;
    }
}

 

In oracle we have "Dual" table.

Like can we have any table in salesforce.

Hi all,

I am getting the following error any one please help me to solve

 

expenseList = [Select id,

Name,

Doctors_Met__c,

station__c,

Month_Year_Combination__c,

Chemist_Met__c,

( select id,frommarket__c,tomarket__C,Fare__c from Expense_Fares__r)

from Expense__c ];

 

Error: ManageExpenseStatementController Compile Error: Didn't understand relationship 'Expense_Fares__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 100 column 21