• momorgan
  • NEWBIE
  • 0 Points
  • Member since 2009

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

We are looking to amend our current sharing to be more restrictive. Within certain teams, we want to change so that the only Accounts that users can see in full are the ones they own themselves.

However, it doesn't make sense to simply hide all other Accounts from them. Instead, it would make sense for them to be able to see Accounts they don't own, but not in their entirety.

 

For example, on a Account record I don't own, I would be able to see the Account Owner and Account Name, but nothing else - that way I know who to contact internally about it.

How could this be achieved?

Hello all.

 

This has me totally beaten, so any light anyone can shed upon it would be warmly received!

 

Here's the simplest example I can come up with:

 

Http h = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint('http://dl.getdropbox.com/u/145601/afdtest.xml');
req.setMethod('GET');
HttpResponse res = h.send(req);
Xmldom d = new xmldom(res.getBody());
List<XMLDOM.Element> items = d.getElementsByTagName('Item');
System.Debug('Items in list:' + items.size());

 

Essentially: go and fetch an XML document, then put all the elements called <item> into a list.

 

In the example XML document I'm using, there are 27 <item> elements, so you'd expect the size of the list to be 27... but not so. It's 12. What's more, only the first 10 items in the list are retrieved from the XML - the last two are null.

 

So what on earth is all that about? And how do I retrieve the lot? Am I misusing "getElementsByTagName" or "getBody" or something?

 

Thanks in advance.

Hello all.

 

This is the most simple example of something I'm trying (and failing) to achieve with triggers:

 

 

trigger AccountOriginalName on Contact (before insert) { for (Contact c : Trigger.new){ c.Account_Original_Name__c = c.Account.Name; } }

 

So, when an contact is created, a field on the contact is populated with the name of the associated account. Except it isn't - it comes out null. Why's that, then?

 

Thanks

 

 

I'm passing details from one VF page to another. If you've read "Creating a Wizard with Visualforce Pages" in the Cookbook, you'll be familar with this.

 

I'm also showing and hiding certain fields based on user actions. If you've read "Dynamically Updating a Page" in the Cookbook, you'll know this too.

 

However, I'm finding a problem when the two techniques are combined. To illustrate this, I've prepared a simple example using two pages that share a standalone controller.

 

Here's the Apex:

 

 

public class listdemo {

public List<selectOption> getFoodstuffOptions() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('A Fish', 'A Fish'));
options.add(new SelectOption('Some Chips', 'Some Chips'));
return options;
}

public class tempList{
public String foodstuff {get; set;}
public Integer quantity {get; set;}
public tempList(string inFoodstuff, integer inQuantity){
foodstuff = inFoodstuff;
quantity = inQuantity;
}
}

private List<tempList> ListOne {get; set;}
public List<tempList> getListOne(){
if(ListOne == null){
ListOne = new List<tempList>();
for (Integer c = 0; c < 5; c++){
ListOne.add(new tempList(null,null));
}
}
return ListOne;
}

private List<tempList> ListTwo {get; set;}
public List<tempList> getListTwo(){
if(ListTwo == null){
ListTwo = new List<tempList>();
for (Integer c = 0; c < ListOne.Size(); c++){
ListTwo.add(new tempList(ListOne.Get(c).foodstuff,ListOne.Get(c).quantity));
}
}
return ListTwo;
}

public PageReference feedme(){
return Page.ListDemo2;
}

}

 

 

Here's the first VF page:

 

 

<apex:page Controller="listdemo">
<apex:form >
<apex:pageblock mode="edit">
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!feedme}" value="Next" />
</apex:pageBlockButtons>
<apex:pageblockTable value="{!ListOne}" var="l" width="100%">
<apex:column headervalue="Foodstuff" width="50%">
<apex:actionRegion >
<apex:selectlist value="{!l.foodstuff}" multiselect="false" size="1" required="true">
<apex:selectOptions value="{!foodstuffoptions}" />
<apex:actionSupport event="onchange" rerender="quantitycolumn" />
</apex:selectlist>
</apex:actionRegion>
</apex:column>
<apex:column headervalue="Quantity" id="quantitycolumn" width="50%">
<apex:inputText required="true" value="{!l.quantity}" rendered="{!l.foodstuff == 'Some Chips'}" />
</apex:column>
</apex:pageblockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

 

Here's the second VF page:

 

 

<apex:page Controller="listdemo">
<apex:form >
<apex:pageblock>
<apex:pageblockTable value="{!ListTwo}" var="l" width="100%">
<apex:column value="{!l.foodstuff}" headervalue="Foodstuff" width="50%" />
<apex:column value="{!l.quantity}" headervalue="Quantity" />
</apex:pageblockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

 

On the first page is an editable table with two columns (Foodstuff and Quantity) and five rows. For each row you can choose the value of Foodstuff from a drop-down list. There are two possible values: A Fish and Some Chips. The adjacent box to accept an value in the Quantity column appears only if you choose Some Chips.

 

So, on one or more rows, choose Some Chips and enter a quantity, then click Next to take this to the second page.

 

Screenshot of first page

 

The second page shows an even simpler table. The table on the first page reflects the contents of a list (ListOne). This list is then copied to another list (ListTwo) for the table on the second page.

 

However, while the values for Foodstuff make it through, the values for Quantity do not.

 

Screenshot of second page

 

Can anyone suggest why?

 

Thanks.

 

I think I'm missing something trivial, but I can't see it so I wonder if you can. The expected result of the code below is a table with five rows, but nothing is returned from the Apex code. Can anyone advise?

 

Here's the Apex:

 

 

public class listdemo { public List<selectOption> getFoodstuffOptions() { List<SelectOption> options = new List<SelectOption>(); options.add(new SelectOption('A Fish', 'A Fish')); options.add(new SelectOption('Some Chips', 'Some Chips')); return options; } public class tempList{ public String foodstuff {get; set;} public Integer quantity {get; set;} public tempList(string inFoodstuff, integer inQuantity){ foodstuff = inFoodstuff; quantity = inQuantity; } } public List<tempList> ListOne {get; set;} public List<tempList> getListOne(){ if(ListOne == null){ ListOne = new List<tempList>(); for (Integer c = 0; c < 5; c++){ ListOne.add(new tempList('Something',1)); } } return ListOne; } }

 

Here's the VF:

 

 

<apex:page Controller="listdemo"> <apex:form > <apex:pageblock mode="edit"> <apex:pageblockTable value="{!ListOne}" var="l"> <apex:column headervalue="Foodstuff"> <apex:actionRegion > <apex:selectlist value="{!l.foodstuff}" multiselect="false" size="1" required="true"> <apex:selectOptions value="{!foodstuffoptions}" /> <apex:actionSupport event="onchange" rerender="quantitycolumn" /> </apex:selectlist> </apex:actionRegion> </apex:column> <apex:column headervalue="Quantity" id="quantitycolumn"> <apex:inputText required="true" value="{!l.quantity}" rendered="{!l.foodstuff == 'Some Chips'}" /> </apex:column> </apex:pageblockTable> </apex:pageBlock> </apex:form> </apex:page>

 

 

 

Thanks.

 Hello all. I've got a pageblockTable that is generated from a list, and I'd like to be able to style rows on-the-fly. The sensible thing to do seemed to be to build up a string of class names while iterating through the list (in Apex), then to spit out that string like so:

 

 

<apex:pageblockTable value="{!master}" var="m" rowClasses="{!masterRowClasses}">

 

Alas, this doesn't work. There's nothing wrong with the string that's generated by the Apex, as it'll work fine when pasted in place of the formula reference. The doco isn't explicit on the subject, so I'm left wondering if this can be done.

 

Anyone ever done this or something similar? If not, anyone care to have a go?

Thanks! :)

 

We are looking to amend our current sharing to be more restrictive. Within certain teams, we want to change so that the only Accounts that users can see in full are the ones they own themselves.

However, it doesn't make sense to simply hide all other Accounts from them. Instead, it would make sense for them to be able to see Accounts they don't own, but not in their entirety.

 

For example, on a Account record I don't own, I would be able to see the Account Owner and Account Name, but nothing else - that way I know who to contact internally about it.

How could this be achieved?

Hi to all,

I am using Lead object & the lead source field adds some Extra values like web,email,phone.
Now I added one custom field Lead No.

 

If I choose Lead source to Web,phone,email then lead no is increased by 1.


If I choose Lead source to Other than above three The Lead No Custom Field should be hodden.

How to hidden a Fields through APEX code???

 

 

Thanks,
Krishna.

Hello all.

 

This is the most simple example of something I'm trying (and failing) to achieve with triggers:

 

 

trigger AccountOriginalName on Contact (before insert) { for (Contact c : Trigger.new){ c.Account_Original_Name__c = c.Account.Name; } }

 

So, when an contact is created, a field on the contact is populated with the name of the associated account. Except it isn't - it comes out null. Why's that, then?

 

Thanks

 

 

I'm passing details from one VF page to another. If you've read "Creating a Wizard with Visualforce Pages" in the Cookbook, you'll be familar with this.

 

I'm also showing and hiding certain fields based on user actions. If you've read "Dynamically Updating a Page" in the Cookbook, you'll know this too.

 

However, I'm finding a problem when the two techniques are combined. To illustrate this, I've prepared a simple example using two pages that share a standalone controller.

 

Here's the Apex:

 

 

public class listdemo {

public List<selectOption> getFoodstuffOptions() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('A Fish', 'A Fish'));
options.add(new SelectOption('Some Chips', 'Some Chips'));
return options;
}

public class tempList{
public String foodstuff {get; set;}
public Integer quantity {get; set;}
public tempList(string inFoodstuff, integer inQuantity){
foodstuff = inFoodstuff;
quantity = inQuantity;
}
}

private List<tempList> ListOne {get; set;}
public List<tempList> getListOne(){
if(ListOne == null){
ListOne = new List<tempList>();
for (Integer c = 0; c < 5; c++){
ListOne.add(new tempList(null,null));
}
}
return ListOne;
}

private List<tempList> ListTwo {get; set;}
public List<tempList> getListTwo(){
if(ListTwo == null){
ListTwo = new List<tempList>();
for (Integer c = 0; c < ListOne.Size(); c++){
ListTwo.add(new tempList(ListOne.Get(c).foodstuff,ListOne.Get(c).quantity));
}
}
return ListTwo;
}

public PageReference feedme(){
return Page.ListDemo2;
}

}

 

 

Here's the first VF page:

 

 

<apex:page Controller="listdemo">
<apex:form >
<apex:pageblock mode="edit">
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!feedme}" value="Next" />
</apex:pageBlockButtons>
<apex:pageblockTable value="{!ListOne}" var="l" width="100%">
<apex:column headervalue="Foodstuff" width="50%">
<apex:actionRegion >
<apex:selectlist value="{!l.foodstuff}" multiselect="false" size="1" required="true">
<apex:selectOptions value="{!foodstuffoptions}" />
<apex:actionSupport event="onchange" rerender="quantitycolumn" />
</apex:selectlist>
</apex:actionRegion>
</apex:column>
<apex:column headervalue="Quantity" id="quantitycolumn" width="50%">
<apex:inputText required="true" value="{!l.quantity}" rendered="{!l.foodstuff == 'Some Chips'}" />
</apex:column>
</apex:pageblockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

 

Here's the second VF page:

 

 

<apex:page Controller="listdemo">
<apex:form >
<apex:pageblock>
<apex:pageblockTable value="{!ListTwo}" var="l" width="100%">
<apex:column value="{!l.foodstuff}" headervalue="Foodstuff" width="50%" />
<apex:column value="{!l.quantity}" headervalue="Quantity" />
</apex:pageblockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

 

On the first page is an editable table with two columns (Foodstuff and Quantity) and five rows. For each row you can choose the value of Foodstuff from a drop-down list. There are two possible values: A Fish and Some Chips. The adjacent box to accept an value in the Quantity column appears only if you choose Some Chips.

 

So, on one or more rows, choose Some Chips and enter a quantity, then click Next to take this to the second page.

 

Screenshot of first page

 

The second page shows an even simpler table. The table on the first page reflects the contents of a list (ListOne). This list is then copied to another list (ListTwo) for the table on the second page.

 

However, while the values for Foodstuff make it through, the values for Quantity do not.

 

Screenshot of second page

 

Can anyone suggest why?

 

Thanks.

 

I think I'm missing something trivial, but I can't see it so I wonder if you can. The expected result of the code below is a table with five rows, but nothing is returned from the Apex code. Can anyone advise?

 

Here's the Apex:

 

 

public class listdemo { public List<selectOption> getFoodstuffOptions() { List<SelectOption> options = new List<SelectOption>(); options.add(new SelectOption('A Fish', 'A Fish')); options.add(new SelectOption('Some Chips', 'Some Chips')); return options; } public class tempList{ public String foodstuff {get; set;} public Integer quantity {get; set;} public tempList(string inFoodstuff, integer inQuantity){ foodstuff = inFoodstuff; quantity = inQuantity; } } public List<tempList> ListOne {get; set;} public List<tempList> getListOne(){ if(ListOne == null){ ListOne = new List<tempList>(); for (Integer c = 0; c < 5; c++){ ListOne.add(new tempList('Something',1)); } } return ListOne; } }

 

Here's the VF:

 

 

<apex:page Controller="listdemo"> <apex:form > <apex:pageblock mode="edit"> <apex:pageblockTable value="{!ListOne}" var="l"> <apex:column headervalue="Foodstuff"> <apex:actionRegion > <apex:selectlist value="{!l.foodstuff}" multiselect="false" size="1" required="true"> <apex:selectOptions value="{!foodstuffoptions}" /> <apex:actionSupport event="onchange" rerender="quantitycolumn" /> </apex:selectlist> </apex:actionRegion> </apex:column> <apex:column headervalue="Quantity" id="quantitycolumn"> <apex:inputText required="true" value="{!l.quantity}" rendered="{!l.foodstuff == 'Some Chips'}" /> </apex:column> </apex:pageblockTable> </apex:pageBlock> </apex:form> </apex:page>

 

 

 

Thanks.

 Hello all. I've got a pageblockTable that is generated from a list, and I'd like to be able to style rows on-the-fly. The sensible thing to do seemed to be to build up a string of class names while iterating through the list (in Apex), then to spit out that string like so:

 

 

<apex:pageblockTable value="{!master}" var="m" rowClasses="{!masterRowClasses}">

 

Alas, this doesn't work. There's nothing wrong with the string that's generated by the Apex, as it'll work fine when pasted in place of the formula reference. The doco isn't explicit on the subject, so I'm left wondering if this can be done.

 

Anyone ever done this or something similar? If not, anyone care to have a go?

Thanks! :)

 

Hi, i'm new at Visualforce and I was wondering what I have to do to entirely replace an Accounts page layout with Visualforce designed Accounts layout page?

 

Do I have to create a page for the edit mode and override that (from buttons & links in setup) and do the same for the view mode page?

 

If I am wrong, what are the appropriate steps to take?

 

Thanks for any help for this newbie to VF!!

  • June 26, 2009
  • Like
  • 0

Is it possible using a VisualForce page to display account fields on the contact page layout? I don't really want to create a bunch of forumla fields to do this.

 

Thanks