• Ruley
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 8
    Replies

We have a new field on the Opportunity object called "Purchasing Account" (Purchasing_Account__c). The data type is Lookup on the Account object. We needed this because we wanted to track both who the opportunity is for as well as who is going to be paying for the opportunity, usually it is the same, but sometimes it is different and to automatically flow orders into our ERP system and invoice the correct customer this field made the most sense.

 

What I want to do now is make it as easy as possible for users by defaulting the value in "Purchasing Account" to be the same as "Account Name" which is the standard lookup. 

 

I can do it with a trigger, if blank fill in same value as in Account Name, but I was wondering if there is an easier way to do it.

  • July 29, 2011
  • Like
  • 0

I have a force.com Free app where my Free license users can access the objects standard pages, create, edit as they should. However I created a custom controller and Visualforce form page that they can see all of the correct data that they should have, but the save button doesn't actually perform the action. That profile has security access to the class and the page. It isn't throwing an error, it is just doing nothing. My system admin user works just fine and handles the data correctly, so I'm guessing it is something wrong in a security setting, only I don't know what it is because those Free users have permission on the object (and they can save via the standard object page), the class and the page. 

 

On the button, the action calls my Custom Controller that grabs all of the records in the form, loops over them and then saves. It isn't throwing an error, it acts like it submits the page, but nothing happens. The values remain in the fields as they were typed. And debugging appears like that save action on the button never takes place.

  • April 20, 2011
  • Like
  • 0

The first thing I did was read this post on http://blog.sforce.com/sforce/2009/10/passing-javascript-values-to-apex-controller.html

 

Here I thought I was doing everything right but I can't get the values to actually pass in.

 

The page itself lists out a grid of various records in a table, with one input text field per row. I want it so if they enter a value in one of the boxes, it will add it to a list of new entries to make. So the onchange event runs to add it to the list, and there is a save method that happens later that will store all of the values in lstTimeToEnter

 

This is the VisualForce code

 

<apex:actionFunction action="{!CreateTimeEntryRecord}" name="enterTime">
	<apex:param name="insertTimeTask" value="" />
	<apex:param name="insertTimeWork" value="" />
</apex:actionFunction>


<apex:inputText id="TimeEntry" onchange="enterTime({!lstTasks.ID}, this.value)"></apex:inputText>

 

 

This is the Apex Code

 

public PageReference CreateTimeEntryRecord() {
		insertedTimeTaskID = Apexpages.currentPage().getParameters().get('insertTimeTask');
        insertedTimeWorked = decimal.valueOf(Apexpages.currentPage().getParameters().get('insertTimeWork'));
                insertedTimeDate = date.today();
        
		Time_Entry__c objNewTimeEntry = new Time_Entry__c(Task__c=insertedTimeTaskID, Date_Worked__c=insertedTimeDate, Time_Worked__c=insertedTimeWorked);
		lstTimeToEnter.add(objNewTimeEntry);
		
		return null;
	}

 

I'm sure I'm missing something simple and would appreciate any help.

 

 

  • April 04, 2011
  • Like
  • 0

I have an error with a new Visualforce page I'm creating that takes advantage of a custom controller I made. It is all around custom objects I build, and the class file compiled just fine. But when I start building the Visualforce page it gives me an error that I can't for the life of me figure out.

 

This is the Visual Force Page

 

 

<apex:page controller="TaskTimeEntryController" showHeader="true" sidebar="false">
	<apex:form id="TimeEntryForm">
		<apex:pageBlock >
			<apex:pageBlockSection >
				{!$User.FirstName} {!$User.LastName}
			</apex:pageBlockSection>
			<apex:pageBlockSection >
				<apex:pageBlockTable value="{!lstTasksForUser}" var="lstTasks" width="100%">
					<apex:column HeaderValue="Select">
						<apex:outputText Value="{!lstTasks.Name}"></apex:outputText>
					</apex:column>
				</apex:pageBlockTable>
			</apex:pageBlockSection>
		</apex:pageBlock>
	</apex:form>
</apex:page>

 

 

And the Controller:

 

public class TaskTimeEntryController {
	public List<Task__c> lstTasksForUser = new List<Task__c>();
	public List<Time_Entry__c> lstTimeToEnter = new List<Time_Entry__c>();
	
	public TaskTimeEntryController(){
		populateTaskList();
	}
	
	private void populateTaskList() {
		lstTasksForUser = [
			Select Name, Task_Status__c, Current_Hours__c, Current_End_Date__c, Current_Duration__c, Assigned_To__c, 
				(Select Estimated_Time__c From Future_Time_Entries__r)
			From Task__c 
			WHERE Assigned_To__c = :UserInfo.getUserId()];
	}
	
	public List<Task__c> getUsersTasks() {
		return lstTasksForUser;
	}
}

 

 

The class compiles fine, I'm using the Force.com IDE, so that seems to be okay. But then when I go to save my Visualforce page it gives the following error:

 

Save error: Unknown property 'TaskTimeEntryController.lstTasksForUser'

 

I've looked over a the variable names a bunch of times and even copied another sample that was the same structure and it compiles just fine, but when I change to my objects, error. I'm sure I'm missing something simple.

  • February 14, 2011
  • Like
  • 0

We have a profile that we want to allow them to see all accounts, because they have a supporting role, but they shouldn't be allowed to see contacts or tasks assigned to that account unless they have created those records themselves. It seems I can hide everything or nothing with the standard setup, but not selectively hide which records they can see.

 

I'm thinking there isn't a way to do this without creating a custom visual force page and displaying things specifically, but wanted to check first before I went down a much longer path then I really want to.

  • January 19, 2011
  • Like
  • 0

I'm trying to setup an extension and custom page connected to the Account. I want to show related accounts in a parent child relationship.

 

Accounts

Subscriptions (Account can own 0-N subscriptions)

Subscription Products (Subscriptions can have 1-N Products)

Subscription Sites (Subscription Products can have 1-N Sites)

 

On the Subscription Products page I have a custom button that goes to my new Visualforce page. I want to display all of the accounts that are child accounts of the one that owns the subscription. To save the data I'm thinking I need to extend the standard controller for Subscription_Sites__c, but that is saying then the ID isn't valid.

Id value 0015000000WUMIe is not valid for the Subscription_Site__c standard controller

 

My Visualforce page is pretty simple right now, the first line is the following and later I'm trying to loop over the lstAllAccounts

 

<apex:page standardController="Subscription_Site__c"  extensions="SubscriptionSiteExtension">

 

 

That list is the return variable from my Extension Class.

 

public class SubscriptionSiteExtension {

private final Subscription_Site__c objSubscriptionSite;

public string newSiteAccountID {get ; set ;}

public SubscriptionSiteExtension(ApexPages.StandardController extController){
	this.objSubscriptionSite = (Subscription_Site__c)extController.getRecord();
}

public List<Account> lstAllAccounts {
	get {
		String txtSubscriptionProductID = objSubscriptionSite.Subscription_Product__c;
		
		List<Subscription_Product__c> lstSubscriptionProducts = 
			[SELECT Subscription__c
			FROM Subscription_Product__c
			WHERE ID = :txtSubscriptionProductID LIMIT 1];
		
		String txtSubscriptionID = lstSubscriptionProducts[0].Subscription__c;
			
		List<Subscription__c> lstSubscriptions = 
			[SELECT Purchasing_Account__c
			FROM Subscription__c
			WHERE ID = :txtSubscriptionID LIMIT 1];
		
		String txtAccountID = lstSubscriptions[0].Purchasing_Account__c;
		
		List<Account> lstAllAccounts = 
			[SELECT Name
         	FROM Account
        	WHERE ParentID = :txtAccountID OR ID = :txtAccountID
     		ORDER BY ParentID, Name];
		
		return lstAllAccounts;
	}
	private set;
}

}

 

 

I'm thinking if I can grab the Subscription_Product__c.ID that is all I need to get the list of accounts. Displaying them is half the battle and where I think I'm off is because I want this page to gather multiple Subscription_Site__c records and save them all at once under the Subscription_Product__c. It will be a huge time saver for the users.

 

I'm kind of new to this so I'm hoping I'm missing something simple. Any help is greatly appreciated.

  • November 16, 2010
  • Like
  • 0

I have a force.com Free app where my Free license users can access the objects standard pages, create, edit as they should. However I created a custom controller and Visualforce form page that they can see all of the correct data that they should have, but the save button doesn't actually perform the action. That profile has security access to the class and the page. It isn't throwing an error, it is just doing nothing. My system admin user works just fine and handles the data correctly, so I'm guessing it is something wrong in a security setting, only I don't know what it is because those Free users have permission on the object (and they can save via the standard object page), the class and the page. 

 

On the button, the action calls my Custom Controller that grabs all of the records in the form, loops over them and then saves. It isn't throwing an error, it acts like it submits the page, but nothing happens. The values remain in the fields as they were typed. And debugging appears like that save action on the button never takes place.

  • April 20, 2011
  • Like
  • 0

The first thing I did was read this post on http://blog.sforce.com/sforce/2009/10/passing-javascript-values-to-apex-controller.html

 

Here I thought I was doing everything right but I can't get the values to actually pass in.

 

The page itself lists out a grid of various records in a table, with one input text field per row. I want it so if they enter a value in one of the boxes, it will add it to a list of new entries to make. So the onchange event runs to add it to the list, and there is a save method that happens later that will store all of the values in lstTimeToEnter

 

This is the VisualForce code

 

<apex:actionFunction action="{!CreateTimeEntryRecord}" name="enterTime">
	<apex:param name="insertTimeTask" value="" />
	<apex:param name="insertTimeWork" value="" />
</apex:actionFunction>


<apex:inputText id="TimeEntry" onchange="enterTime({!lstTasks.ID}, this.value)"></apex:inputText>

 

 

This is the Apex Code

 

public PageReference CreateTimeEntryRecord() {
		insertedTimeTaskID = Apexpages.currentPage().getParameters().get('insertTimeTask');
        insertedTimeWorked = decimal.valueOf(Apexpages.currentPage().getParameters().get('insertTimeWork'));
                insertedTimeDate = date.today();
        
		Time_Entry__c objNewTimeEntry = new Time_Entry__c(Task__c=insertedTimeTaskID, Date_Worked__c=insertedTimeDate, Time_Worked__c=insertedTimeWorked);
		lstTimeToEnter.add(objNewTimeEntry);
		
		return null;
	}

 

I'm sure I'm missing something simple and would appreciate any help.

 

 

  • April 04, 2011
  • Like
  • 0

I have an error with a new Visualforce page I'm creating that takes advantage of a custom controller I made. It is all around custom objects I build, and the class file compiled just fine. But when I start building the Visualforce page it gives me an error that I can't for the life of me figure out.

 

This is the Visual Force Page

 

 

<apex:page controller="TaskTimeEntryController" showHeader="true" sidebar="false">
	<apex:form id="TimeEntryForm">
		<apex:pageBlock >
			<apex:pageBlockSection >
				{!$User.FirstName} {!$User.LastName}
			</apex:pageBlockSection>
			<apex:pageBlockSection >
				<apex:pageBlockTable value="{!lstTasksForUser}" var="lstTasks" width="100%">
					<apex:column HeaderValue="Select">
						<apex:outputText Value="{!lstTasks.Name}"></apex:outputText>
					</apex:column>
				</apex:pageBlockTable>
			</apex:pageBlockSection>
		</apex:pageBlock>
	</apex:form>
</apex:page>

 

 

And the Controller:

 

public class TaskTimeEntryController {
	public List<Task__c> lstTasksForUser = new List<Task__c>();
	public List<Time_Entry__c> lstTimeToEnter = new List<Time_Entry__c>();
	
	public TaskTimeEntryController(){
		populateTaskList();
	}
	
	private void populateTaskList() {
		lstTasksForUser = [
			Select Name, Task_Status__c, Current_Hours__c, Current_End_Date__c, Current_Duration__c, Assigned_To__c, 
				(Select Estimated_Time__c From Future_Time_Entries__r)
			From Task__c 
			WHERE Assigned_To__c = :UserInfo.getUserId()];
	}
	
	public List<Task__c> getUsersTasks() {
		return lstTasksForUser;
	}
}

 

 

The class compiles fine, I'm using the Force.com IDE, so that seems to be okay. But then when I go to save my Visualforce page it gives the following error:

 

Save error: Unknown property 'TaskTimeEntryController.lstTasksForUser'

 

I've looked over a the variable names a bunch of times and even copied another sample that was the same structure and it compiles just fine, but when I change to my objects, error. I'm sure I'm missing something simple.

  • February 14, 2011
  • Like
  • 0

I'm trying to setup an extension and custom page connected to the Account. I want to show related accounts in a parent child relationship.

 

Accounts

Subscriptions (Account can own 0-N subscriptions)

Subscription Products (Subscriptions can have 1-N Products)

Subscription Sites (Subscription Products can have 1-N Sites)

 

On the Subscription Products page I have a custom button that goes to my new Visualforce page. I want to display all of the accounts that are child accounts of the one that owns the subscription. To save the data I'm thinking I need to extend the standard controller for Subscription_Sites__c, but that is saying then the ID isn't valid.

Id value 0015000000WUMIe is not valid for the Subscription_Site__c standard controller

 

My Visualforce page is pretty simple right now, the first line is the following and later I'm trying to loop over the lstAllAccounts

 

<apex:page standardController="Subscription_Site__c"  extensions="SubscriptionSiteExtension">

 

 

That list is the return variable from my Extension Class.

 

public class SubscriptionSiteExtension {

private final Subscription_Site__c objSubscriptionSite;

public string newSiteAccountID {get ; set ;}

public SubscriptionSiteExtension(ApexPages.StandardController extController){
	this.objSubscriptionSite = (Subscription_Site__c)extController.getRecord();
}

public List<Account> lstAllAccounts {
	get {
		String txtSubscriptionProductID = objSubscriptionSite.Subscription_Product__c;
		
		List<Subscription_Product__c> lstSubscriptionProducts = 
			[SELECT Subscription__c
			FROM Subscription_Product__c
			WHERE ID = :txtSubscriptionProductID LIMIT 1];
		
		String txtSubscriptionID = lstSubscriptionProducts[0].Subscription__c;
			
		List<Subscription__c> lstSubscriptions = 
			[SELECT Purchasing_Account__c
			FROM Subscription__c
			WHERE ID = :txtSubscriptionID LIMIT 1];
		
		String txtAccountID = lstSubscriptions[0].Purchasing_Account__c;
		
		List<Account> lstAllAccounts = 
			[SELECT Name
         	FROM Account
        	WHERE ParentID = :txtAccountID OR ID = :txtAccountID
     		ORDER BY ParentID, Name];
		
		return lstAllAccounts;
	}
	private set;
}

}

 

 

I'm thinking if I can grab the Subscription_Product__c.ID that is all I need to get the list of accounts. Displaying them is half the battle and where I think I'm off is because I want this page to gather multiple Subscription_Site__c records and save them all at once under the Subscription_Product__c. It will be a huge time saver for the users.

 

I'm kind of new to this so I'm hoping I'm missing something simple. Any help is greatly appreciated.

  • November 16, 2010
  • Like
  • 0