• Avrom
  • NEWBIE
  • 455 Points
  • Member since 2009
  • PMTS, Development
  • Salesforce.com


  • Chatter
    Feed
  • 18
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 111
    Replies

Hii Folks!!!!

 

I want to call a javascript function on page load.Based on the Role of the user who logs in,one of the divs should be visible(or Editable) and the remaining divs should be hidden(or UnEditable).

 

I'm providing my code for better understanding.Kindly look at it and I would be very thankful if you suggest a solution for this.

 

<apex:page standardController="Project_Management__c">

    <apex:form >
        <!--ZM-00E90000000cNj8EAE
        Executive-00E90000000cNjDEAU
        Director-00E90000000cNj3EAE-->
        <script src="/soap/ajax/19.0/connection.js" type="text/javascript"></script>
        <script src="/js/functions.js"></script>
        <script src="/soap/ajax/19.0/apex.js" type="text/javascript"></script>


        <script>           
            function GETINFO()
            {
                try{
                    sforce.connection.sessionId="{!$Api.Session_ID}";
                    var user = sforce.connection.getUserInfo();
                    alert('Username:'+user.userName);

                    alert('Role Id:'+user.roleId);
                    if(user.roleId == '00E90000000cNj8EAE'){        
                        
document.getElementById("div3").style.display='block';

                    }

                   if(user.roleId == '00E90000000cNjDEAU'){        
                        
document.getElementById("div4").style.display='block';

                    }

                   if(user.roleId == '00E90000000cNj3EAE'){        
                        
document.getElementById("div5").style.display='block';

                    }

                  }
                  catch(error){
                      alert(error);
                  }         
            }
            window.onLoad=GETINFO();
         </script>
         
 
           <apex:pageBlock >
            <apex:pageBlockSection >
                <apex:inputField value="{!Project_Management__c.Name}"/>
            </apex:pageBlockSection>
           </apex:pageBlock>
          
           <div id="div1" style='float:left;clear:right'>
              <table>            
                <tr><td>Sr.No</td></tr>
                <tr><td>1</td></tr>
                <tr><td>2</td></tr>
                <tr><td>3</td></tr>
              </table>
            </div>


            <div id="div2" style='float:left;clear:right'>
              <table>
                <tr><td>Document Name</td></tr>
                <tr><td>Agreement-Hardware</td></tr>
                <tr><td>Agreement-Software and Service</td></tr>
                <tr><td>Road Permit Declaration</td></tr>
              </table>
            </div>


            <div id="div3" style='float:left;clear:right'>
              <table>
                <tr><td>Attached</td></tr>
                <tr><td><input id="zm1" type="checkbox"/> </td></tr>
                <tr><td><input id="zm2" type="checkbox"/></td> </tr>
                <tr><td><input id="zm3" type="checkbox"/></td> </tr>
              </table>
            </div>


            <div id="div4" style='float:left;clear:right'>
              <table>
                <tr><td>Checked</td></tr>
                <tr><td><input id="mis1" type="checkbox"/></td></tr>
                <tr><td><input id="mis2" type="checkbox"/></td></tr>
                <tr><td><input id="mis3" type="checkbox"/></td></tr>
              </table>
            </div>


            <div id="div5" style='float:left;clear:right'>
              <table>
                <tr><td>Approved</td></tr>
                <tr><td><input id="director1" type="checkbox"/></td></tr>
                <tr><td><input id="director2" type="checkbox"/></td></tr>
                <tr><td><input id="director3" type="checkbox"/></td></tr>
              </table>
            </div>


            <div id="div6" style='float:left;clear:right'>
              <table>
                <tr><td>Received</td></tr>
                <tr><td><input id="finance1" type="checkbox"/></td></tr>
                <tr><td><input id="finance2" type="checkbox"/></td></tr>
                <tr><td><input id="finance3" type="checkbox"/></td></tr>
              </table>           
            </div>
       
    </apex:form>

</apex:page>

 

 

 

Thanks & Regards,

Jagadeesh K.

Hi,

 

I want to clone a record with two options

1. one with line items

2. without lineitems

 

I have a button in my VF page on mouse over i need something like a dropdown menu 1. clone with line items, 2. clone without line items.

 

Is that possible?

 

The  simplest option would be to have two buttons "clone with lineitems" and "clone without lineitems". But would like to explore the possibility of having it on hover.

 

Can anybody come up with ideas/suggestions to achieve it?

 

Thanks

Prady

  • September 01, 2010
  • Like
  • 0

Hi,

 

We're facing a bit of a challenge in my company and I hope someone here might be able to help.

 

The first challenge might be a bit off-topic but I'll give it a go anyway. How can one model a recursive data structure in SFDC?

 

Basically, we have a custom object called Sales Products which has a type. When type is "Bundle", we would like to be able to link a number of other Sales Products (same object but different type) to it.

 

The second challenge is displaying the Sales Products to select. It would be nice if we could list the existing Sales Products in e.g. a multi-select picklist but as I understand it the inputField shown is based on the actual type of field on the object (i.e. a text field will give a text field, a picklist will give a picklist and so on).

 

Does anyone have any good ideas on how to achieve both recursive data structure and a user friendly way of displaying the recursive link?

 

Cheers.

 

Søren Nødskov Hansen

It seems like I've read several solutions to this, none of which appear to work for me

 

I have a page that will have two tables. WHich one is rendered depends on a picklist option in a selectList.

 

Relevant Apex Code:

 

public string LineType;

public string getLineType()    // This is the selectOption value from the selectList
    {
        return LineType;
    }
    public void setLineType(string LT)
    {
        this.LineType = LT;
    }


    public list<OpportunityLineItem> LineItems;
    
    public list<OpportunityLineItem> getLineItems()  // for the Opp Line Item table
    {
        
        LineItems = [SELECT id, TotalPrice, PriceBookEntry.Product2.Name, Opportunity.Name
                     FROM OpportunityLineItem
                     WHERE OpportunityID = :ApexPages.currentPage().getParameters().get('Id')];
        return LineItems;
    }
    
    public list<QuoteLineItem> QuoteLines;
    
    public list<QuoteLineItem> getQuoteLines()     // for the Quote Line Item Table
    {
        QuoteLines = [SELECT id, Quantity, UnitPrice, PriceBookEntry.Product2.Name 
                      FROM QuoteLineItem
                      WHERE Quote.OpportunityId = :Opp.Id];
        return QuoteLines;
    }

 

 

And the Apex Code

 

<apex:page standardcontroller="Opportunity" extensions="QOA_ManageQuotesController" >
<h1> Manage Quotes for {!Opportunity.Name} </h1>
<apex:form >

<apex:pageBlock id="LineItemsTable">
<h1> Select Line Type </h1>
<apex:selectList id="TableSelect" value="{!LineType}" size="1" >
<apex:selectOption itemValue="Products" itemLabel="Products"/>
<apex:selectOption itemValue="QOA" itemLabel="QOA"/>
<apex:selectOption itemValue="SFDC Lite" itemLabel="SFDC Lite"/>
</apex:selectList>



<apex:pageBlockTable id="Table" value="{!LineItems}" var="item" columns="6" rendered="{!LineType == 'Products'}" >
<apex:column headervalue="Products">
<apex:outputLink value="/{!item.id}" id="theLink">{!item.PriceBookEntry.Product2.Name}</apex:outputLink>
</apex:column>
<apex:column value="{!item.TotalPrice}"/>
<apex:column headerValue="Create" width="5%">
<apex:commandButton action="{!CreateQuote}"/ value="Create Quote">
</apex:column>
<apex:column headerValue="View" width="5%">
<apex:commandButton action="{!ViewQuote}"/ value="View Quote">
</apex:column>
<apex:column headerValue="Refresh" width="5%">
<apex:commandButton action="{!RefreshQuote}"/ value="Refresh Quote">
</apex:column>
<apex:column headerValue="Delete" width="5%">
<apex:commandButton action="{!DeleteQuote}"/ value="Delete Quote">
</apex:column>
</apex:pageBlockTable>


</apex:pageBlock>
</apex:form>
</apex:page>

 

 

The results of this is that the table is not rendered when the Products value is selected.

 

If I remove the 'rendered="{!LineType =='Products'}"' attribute, the LineItems page renders as expected. I've tried using

{!IF(LineType = 'Products', true, false)}, which doesn't work, although both

 

rendered="{!LineType != 'Products'}" and {!IF(LineType = 'Products', false, true)} works just fine, except its wrong.

 

Clearly the LineType value isn't being set, or else the Table component isn't seeing it. Can someone tell me where I'm going wrong here??

I have created a series of custom objects (projects, project task, expense, timesheet, timesheet line items) and am creating a visualforce page for a billing detail report, and the standardController = SFL5_Projects__c.

 

A lookup relationship exists on the Projects (SFL5_Projects__c) object to Account via field Client__c, but I cannot reference Account object via standard syntax to pull back the name of the Account (SFL5_Projects__c.Client__c.name errs out, as standard syntax is .Account.name if I were referencing from a standard object like Opportunity.Account.name).

 

So, my question is how does one reference both standard and custom objects to pull fields (where lookup relationships exist) when the standardController =  a custom object?

Regards,

Jeff

Hello!

 

I have tried to use the new dependent picklist feature. In a normal VF Page everything works fine. But if I move the code to a VF componet the dependency is gone.

Is this a known issue or could it be that I made some mistakes?

 

Thanks for your help!

 

Regards,

Jochen

Hi all.

 

Does anyone know how the new field dependency availability (Summer '10) in Visualforce Pages is supposed to work? I am able to implement the feature when I use a standard controller (as per the example in the release notes), but as soon as the object I want to utilize the dependencies on is delivered to the page through a controller extension it doesn't seem to work.

 

Anybody know if this is intended behavior, or if there is a way around this?

 

Regards,

Ivar Gunnarsson

  • June 14, 2010
  • Like
  • 0

Hi,

 

i have problem with picklist dependencies.

 

What I want to do:

Salesforce have integraetd Mass Case Close function, but we cant change layout of this page. Therefore we want build our custom visualforce page and put there all fields which we need.

 

My steps :

 

1. Create custom picklist which is dependent on standard picklist

 I've created Reason Code Specification (REASON_CODE_SPECIFICATION__c) field which is dependent on Case Reason (Reason) standard field.

2. i've created matrix of dependencies

3. i've created visual force page

<apex:page standardController="Case" recordSetVar="cases" tabStyle="Case">
<apex:form >
    <apex:pageBlock title="Mass Close Cases" mode="edit">
        <apex:pageBlockButtons location="top">
            <apex:commandButton value="Save" action="{!save}"/>
            <apex:commandButton value="Cancel" action="{!cancel}"/>
        </apex:pageBlockButtons>
        
        <apex:pageBlockSection >
            <apex:inputField value="{!Case.Status}"/>
        </apex:pageBlockSection>

        <apex:pageBlockSection >
            <apex:inputField value="{!Case.Reason}"/>
            <apex:inputField value="{!Case.Case_Reason_Specification__c}"/>
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:form>
You have selected cases with IDs: {!selected}.
</apex:page>

 This page accept all selected items from List View Button.

 

4. I've created List View Button for Case object

 Label: My own mass close

 Behavior: Display in existing window with sidebar

 Display type: List button

 Display Checkboxes (for multi-record selection): True

 Content Source: Visualforce page

 Visualforce Page: is page above

 

Now when I go to CASES tab and select some view I can see this button :) it's still OK :)

When I select some case and press my own Mass close button I was redirected to visualforce page.

But there is problem. When I select some Case Reason i still can select all of other values from Case Reason Specification even if I make field dependency.

 

I want update all {!selected} cases with this code and tpe values just once. I don't want type values for all seleced items, but only once for all selected records.

 

Please help how can I do this?

 

 

Hello,

 

I have a visual force page and apex controller I have been building to use for lead zip code searches. I was able to get the basic search to work but wanted to validate the input to verfiy they were only 5 digits. I have tried linking to my zip code validation rule but was having some difficulty with that. I have also tried setting up a pattern and matcher class in the controller, but could not get it to recognize a wild card search. Now I am working on a javascript validation. Here is my basic code to test the input and verfiy that it is a number:

       <script> var postalcode = '{!$Component.postalcode}' </script> 
        <script type="text/javascript"> 
        function validateText(numb){ 
            if(isNaN(parseInt(numb))) {alert("zip code is numbers only")  
            return false } 
            else  return true };
        </script>
        

 Here is the entire page including my Ajax/soap for the javascript&colon;

<apex:page controller="zipController">
<script src="/soap/ajax/15.0/connection.js" type="text/javascript"></script>
<script src="/soap/ajax/15.0/apex.js" type="text/javascript"></script>
    <apex:form >
     <apex:pageMessages />
        <apex:pageBlock mode="edit" id="block">
        <apex:pageBlockSection >
        <apex:pageBlockSectionItem >
    <apex:outputLabel for="searchText"> Enter zip code</apex:outputLabel>
        <apex:panelGroup >
        <apex:inputText id="searchText" value="{!searchText}"/>
        <apex:commandButton value="Go!" action="{!doSearch}"/>
        </apex:panelGroup>
        </apex:pageBlockSectionItem>
        </apex:pageBlockSection>
        <apex:actionStatus id="status" startText="requesting..."/>
            <apex:pageBlockSection title="Lead Zip Code Search " id="results" columns="1">
            <apex:pageBlockTable value="{!results}" var="l"
                rendered="{!NOT(ISNULL(results))}">
                    <apex:column value="{!l.postalcode}"/>
                    <apex:column value="{!l.company}"/>
                    <apex:column value="{!l.name}"/>
                    <apex:column value="{!l.email}"/>
            </apex:pageBlockTable>
         </apex:pageBlockSection>
           </apex:pageBlock>
       </apex:form>
       
       <script> var postalcode = '{!$Component.postalcode}' </script> 
        <script type="text/javascript"> 
        function validateText(numb){ 
            if(isNaN(parseInt(numb))) {alert("zip code is numbers only")  
            return false } 
            else  return true };
        </script>
        
</apex:page>

I have inserted the javascript at various points on the page, just to see if it would test after or before the search but neither worked.  I have tried numerous approaches to solve the wildcard search and number validation issue, but have not had any luck. I have posted a previous message using a different approach with the controller. Any advice would be appreciated.

Thanks,

What does it mean by <apex:outputText value="{!$Label.site.stay_tuned}"/>? How do I know all key and values about $Label? How to add and change those? Is there any reference website for it to see all variables? Any Visual Force API?

Hi,

 

I have a custom controller called: MyController, I did 

Error: Unknown constructor 'MyController.MyController(ApexPages.StandardSetController controller)'.

 

On my controller code I have the following implementation of a simple constructor:

 

public class MyController {
    public Plan_Table__c table;
    public List <Table_Account__c> table_acc;
    public MyController() {
        table = null;
        table_acc = null;
    }

 

 

// some get and set APIs ....

...

...

...

}

 

Why do I keep getting this error when saving my tag file:

<apex:page standardStylesheets="false" sidebar="false" StandardController="Table_Account__c" Extensions="MyController" tabStyle="Account" recordSetVar="acc">

 

...

...

...

 

 

Thanks,

Guy

I'm trying to create a page that allows my users to fill in fields, attach as many files as they want, and then submit the information, creating a new lead with all the attachments.

 

What I want to do is let the user attach files BEFORE submitting, meaning BEFORE the Lead is actually inserted into the database. To try to accomplish this, I'm creating a list of attachments in the controller and then holding the attachments there. When the user clicks "submit" I then insert the Lead and assign all of the attachments in the list to that Lead.

 

The goal here is to be able to submit the Lead and its Attachments at the same time.

 

I'm hitting the viewstate size limit (I'm growing to dislike that error very much.) Is there a way to efficiently gather attachments before inserting them into the DB? Below are my relevant code snippets:

 

 

public class newLeadExtension {

public Lead theLead;
public String theName {get; set;}
public Attachment att {get; private set;} //Holds value from inputFile
public List<Attachment> attachments {get; set;} //Holds attachments
public List<String> attachmentNames {get; set;} //Holds atachment names

//Get the lead from the standardcontroller
public newLeadExtension(ApexPages.StandardController cont) {
theLead = (Lead)cont.getRecord();
att = new Attachment();
attachmentNames = new List<String>();
attachments = new List<Attachment>();
}

public PageReference attach() {
attachments.add(att);
attachmentNames.add(att.Name);
return null;
}
}

 

Attach A File:<br/>
<apex:inputFile value="{!att.Body}" filename="{!att.Name}" />
<apex:commandButton value="Attach" action="{!attach}"/>

Attached Files:<br/>
<apex:repeat var="att" value="{!attachmentNames}" >
&nbsp;&nbsp;{!att}<br/>
</apex:repeat>

 

 

(The "submit" method isn't shown here, but it just inserts the lead, then iterates through the attachment list assigning each parent ID as the lead and inserting it)

 

Thanks for any help you can provide!

I have an interesting situation which I can't seem to figure out.  I have a page which iterates over a list of Objects.  Each object has some basic data and then a list of fields and values (it is it's own wrapper class).

 

I render the basic data in a repeat loop, then a nested repeat loops through the fields and values.  When I simply use rendered="true" everything looks fine.  However I would like to display only those values which are NOT labeled 'Not Enabled' and are not null.  For some reason when i changed rendered to rendered="{!AND(f.value!='Not Enabled',f.value!=null)} the values I want are printed but sometimes with huge gaps between the lines, ie:

 

Field 1:  Value 1

Field 2:  Value 2

 

 

Field3:  Value 3

Field4:  Value 4

 

Here is the VF code

 

<apex:page controller="printIDscontroller" showHeader="false" sidebar="false" renderas="pdf" title="User IDs"> <apex:panelGrid columns="1" width="100%" > Login IDs for Account:<b>{!accountName}</b> on Order Request <b>{!OrderReqNum}</b><br/><br/> </apex:PanelGrid> <apex:repeat value="{!printIDs}" var="i" id="table"> User ID:<b>{!i.tulid.Name}</b> <apex:panelGrid columns="3" cellspacing="4" width="80%"> <apex:panelGroup > <apex:outputLabel value="Login Location:"/>&nbsp;<apex:outputText value="{!i.tulid.Login_Location__c}" /> </apex:panelGroup> <apex:panelGroup > <apex:outputLabel value="Exchange Type:"/>&nbsp;<apex:outputText value="{!i.tulid.Exchange_Type__c}" /> </apex:panelGroup> </apex:panelGrid> <apex:repeat value="{!i.theList}" var="f" id="fields"> <apex:panelGrid columns="3" width="100%"> <apex:panelGroup rendered="{!AND(f.value!='Not Enabled',f.value!=null)}"> <apex:outputText value="{!f.label}"/><apex:outputText value=": "/><apex:outputText value="{!f.value}"/> </apex:panelGroup> </apex:panelGrid> </apex:repeat> </apex:repeat> </apex:page>

 

 Any insight would be appreciated.

 

  • February 09, 2010
  • Like
  • 0

Good day,

 

I'm working with dynamic hierarchy tree whereby I need to put a <div> or </div> in separate <apex:outputText> tags depend on the respective node type (parent, child, etc). I write the render to decide when to have a <div> and when there is a need for </div>. The collapse and expand feature work fine, but there is always a warning message display at the browser the first time I load the page saying that <div> should be matched with a </div>. I checked the source of the web page and confirmed that each <div> has a matched </div>.

 

Below is partial of my code:

<apex:outputText rendered="{!IF(OR(pos.nodeType=='start',pos.nodeType=='parent'),true,false)}">
             <div id='{!pos.nodeId}'>

</apex:outputText> 

<!-- Data population in between to populate the child node to the parent node -->

<apex:outputText rendered="{!IF(OR(pos.nodeType=='end',pos.nodeType=='child_end'),true,false)}">
             </div>

</apex:outputText>

 

After encountered with the warning message, I try to simplify the code as follows and found that the warning message will definitely show at browser if there is only <div> present within <apex:outputText></apex:outputText> and no </div> is found. But I couldn't have </div> put at same occurence to ensure that  the collapsible feature is working. Is this the known issue in Salesforce Visualforce page? And is there any way we could turn off this warning message by coding?

 

<!-- This simplified code below will give warning message. I understand in this case we don't need to use the <apex:outputText> tag. My intention is to simulate the scenario -->

<apex:outputText rendered="true">

             <div>

</apex:outputText>

<apex:outputText rendered="true">

             </div>

</apex:outputText>

 

Hi,

 

Here is a portion of my VisualForce email template:

 

<tr>

           <td><th align="right">Ship to Address</th></td>

           <td align="left">{!relatedTo.GS_Address__r.Address1__c}</td>

       </tr>

       <tr>

           <td><th align="right"></th></td>

           <td align="left">{!relatedTo.GS_Address__r.Address2__c}</td>

       </tr>

       <tr>

           <td><th align="right"></th></td>

           <td align="left">{!relatedTo.GS_Address__r.Address3__c}</td>

       </tr>

       <tr>

           <td><th align="right"></th></td>

           <td align="left">{!relatedTo.GS_Address__r.Address4__c}</td>

       </tr>

<tr>

           <td><th align="right"></th></td>

           <td align="left">{!relatedTo.GS_Address__r.Attn__c}</td>

       </tr>

       <tr>

           <td><th align="right"></th></td>

           <td align="left">{!relatedTo.GS_Address__r.City__c},{!relatedTo.GS_Address__r.ST_PROV__c}</td>

       </tr>

       <tr>

           <td><th align="right"></th></td>

           <td align="left">{!relatedTo.GS_Address__r.PostalCode__c}</td>

       </tr> 

 

I want to do the <tr> and <td> for Address2,3 and 4 only if those field have a value. I don't want empty lines between Address1 and City.

 

So, how can I test the value before displaying the field?

 

Thanks

 

Patrick

 

Anyone can you please explain

 

1)what is appexchange?

 

2)what is sandbox (test enviroment) and production. wats difference between these two?  

 

3) How testmethod relates to sandbox and also to production?

 

 

Thanks

Message Edited by JHA on 01-12-2010 05:02 AM
  • January 12, 2010
  • Like
  • 0
Is there a way to insert an image from Documents into an <apex:inputTextarea> field?

Hi all,


I'm working on a VF page with a few field validation checks.  What I'm looking to do is have a user complete a form, then click on the "Next" button to go to page 2.  Before going to page 2 I would like the perform a quicksave and then redirect to page 2.  If upon quicksaving any errors are found, I would like the error to be displayed and the user not redirected.

 

The code I have now tries to quicksave and regardless of its success, forwards the user to page 2.

 

 

<apex:pagemessages ></apex:pagemessages> ... <apex:actionFunction name="saveit" action="{!quickSave}" oncomplete="window.location='http://www.google.com';"/>

 

 

 

How to import larger data into Custom Metadata Types ?

Hi All,

Break is not working. 

Apex:

Power=string.valueof(lstproduct2[i].test__c) + ' ' + 'KW' + '<br />' + string.valueof(lstproduct2[i].Rating__c) + ' ' + 'KVA' + '<br />' + string.valueof(lstproduct2[i].Hp__c) + ' ' + 'Hp';

VF:

  <apex:outputLabel value="{!Power}" />

Out put 

Out put coming like this but i want break line.

300 Kv<br />150 KA<br />2000 Hp

 

Html:

 

label>

 

1000 KW&lt;br&gt;&lt;/br&gt;500 KVA&lt;br&gt;&lt;/br&gt;2000 Hp</label>

label>1000 KW&lt;br&gt;&lt;/br&gt;500 KVA&lt;br&gt;&lt;/br&gt;2000 Hp</label>

 

 

Hi,

I get the following error when trying to use a VF template since the winter 11:

(SELECT id, solution.solutionnote, solution.__procedure_information__c
^
ERROR at Row:1:Column:55
No such column '__procedure_information__c' on entity 'Solution'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

The same when previewing the template :
Error occurred trying to load the template for preview:
solution.solutionnote, solution.solutionnumber, solution.__solution_quality__c,
^
ERROR at Row:1:Column:80
No such column '__solution_quality__c' on entity 'Solution'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.. Please try editing your markup to correct the problem.

And when trying to save:
Error: ; nested exception is: common.exception.ApiQueryException: solution.solutionnote, solution.solutionnumber, solution.__solution_quality__c, ^ ERROR at Row:1:Column:80 No such column '__solution_quality__c' on entity 'Solution'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

My field name is solution_quality__c without __ at the beginning
and my vf code is:
<apex:repeat var="Sols" value="{!RelatedTo.CaseSolutions}">
<table cols="2" border="0" width="100%" cellspacing="2">
<tr><td width="20%" valign="top" bgcolor="#EEEEEE">Solution Quality:</td><td width="80%"><apex:outputText value="{!Sols.Solution.Solution_Quality__c}"/></td></tr>
<tr><td width="20%" valign="top" bgcolor="#EEEEEE">Additional Information:</td><td width="80%"><!--apex:outputText value="{!Sols.Solution.Procedure_information__c}" escape="false"/--></td></tr>
</table>
</apex:repeat>

what's wrong with this?

Hello,

 

I'm new to javascript and Firebug. I have a VFpage with javascript functions.

 

<apex:page standardController="Auftragsposition__c" extensions="Auftr_pos_controller_extension">

<script>
function changeMgges ( mg_tg )
{
  var mg_tg = mg_tg.value;
  alert (" Mg Tg " + mg_tg);  
  var mg_ges = mg_tg * 30;
  alert (" Mg ges " + mg_ges);  
  document.getElementById('{!$Component.edit_form.edit_block.edit_section.MgGes}').value = mg_ges;                

}
</script>

 

If I now start Firebug and set a breakpoint by clicking on the scriptline, the alerts are shown but the script does not stop. If I try to enter debug(changeMgges) in the consoles commandline it responds:

 

>>> debug(changeMgges)
Can anyone help me?
Thanks
Harry
  • September 28, 2010
  • Like
  • 0

Hii Folks!!!!

 

I want to call a javascript function on page load.Based on the Role of the user who logs in,one of the divs should be visible(or Editable) and the remaining divs should be hidden(or UnEditable).

 

I'm providing my code for better understanding.Kindly look at it and I would be very thankful if you suggest a solution for this.

 

<apex:page standardController="Project_Management__c">

    <apex:form >
        <!--ZM-00E90000000cNj8EAE
        Executive-00E90000000cNjDEAU
        Director-00E90000000cNj3EAE-->
        <script src="/soap/ajax/19.0/connection.js" type="text/javascript"></script>
        <script src="/js/functions.js"></script>
        <script src="/soap/ajax/19.0/apex.js" type="text/javascript"></script>


        <script>           
            function GETINFO()
            {
                try{
                    sforce.connection.sessionId="{!$Api.Session_ID}";
                    var user = sforce.connection.getUserInfo();
                    alert('Username:'+user.userName);

                    alert('Role Id:'+user.roleId);
                    if(user.roleId == '00E90000000cNj8EAE'){        
                        
document.getElementById("div3").style.display='block';

                    }

                   if(user.roleId == '00E90000000cNjDEAU'){        
                        
document.getElementById("div4").style.display='block';

                    }

                   if(user.roleId == '00E90000000cNj3EAE'){        
                        
document.getElementById("div5").style.display='block';

                    }

                  }
                  catch(error){
                      alert(error);
                  }         
            }
            window.onLoad=GETINFO();
         </script>
         
 
           <apex:pageBlock >
            <apex:pageBlockSection >
                <apex:inputField value="{!Project_Management__c.Name}"/>
            </apex:pageBlockSection>
           </apex:pageBlock>
          
           <div id="div1" style='float:left;clear:right'>
              <table>            
                <tr><td>Sr.No</td></tr>
                <tr><td>1</td></tr>
                <tr><td>2</td></tr>
                <tr><td>3</td></tr>
              </table>
            </div>


            <div id="div2" style='float:left;clear:right'>
              <table>
                <tr><td>Document Name</td></tr>
                <tr><td>Agreement-Hardware</td></tr>
                <tr><td>Agreement-Software and Service</td></tr>
                <tr><td>Road Permit Declaration</td></tr>
              </table>
            </div>


            <div id="div3" style='float:left;clear:right'>
              <table>
                <tr><td>Attached</td></tr>
                <tr><td><input id="zm1" type="checkbox"/> </td></tr>
                <tr><td><input id="zm2" type="checkbox"/></td> </tr>
                <tr><td><input id="zm3" type="checkbox"/></td> </tr>
              </table>
            </div>


            <div id="div4" style='float:left;clear:right'>
              <table>
                <tr><td>Checked</td></tr>
                <tr><td><input id="mis1" type="checkbox"/></td></tr>
                <tr><td><input id="mis2" type="checkbox"/></td></tr>
                <tr><td><input id="mis3" type="checkbox"/></td></tr>
              </table>
            </div>


            <div id="div5" style='float:left;clear:right'>
              <table>
                <tr><td>Approved</td></tr>
                <tr><td><input id="director1" type="checkbox"/></td></tr>
                <tr><td><input id="director2" type="checkbox"/></td></tr>
                <tr><td><input id="director3" type="checkbox"/></td></tr>
              </table>
            </div>


            <div id="div6" style='float:left;clear:right'>
              <table>
                <tr><td>Received</td></tr>
                <tr><td><input id="finance1" type="checkbox"/></td></tr>
                <tr><td><input id="finance2" type="checkbox"/></td></tr>
                <tr><td><input id="finance3" type="checkbox"/></td></tr>
              </table>           
            </div>
       
    </apex:form>

</apex:page>

 

 

 

Thanks & Regards,

Jagadeesh K.

Hi,

 

I want to clone a record with two options

1. one with line items

2. without lineitems

 

I have a button in my VF page on mouse over i need something like a dropdown menu 1. clone with line items, 2. clone without line items.

 

Is that possible?

 

The  simplest option would be to have two buttons "clone with lineitems" and "clone without lineitems". But would like to explore the possibility of having it on hover.

 

Can anybody come up with ideas/suggestions to achieve it?

 

Thanks

Prady

  • September 01, 2010
  • Like
  • 0

I created a controller extension to replace the standard "New" record for a custom object. The save and all subsequent updates are working, however, my conditional statement is not working, saving regardless.

 

Here is my VF:

 

<apex:page standardController="Merged_Contact__c" extensions="mergeContact" tabStyle="Merged_Contact__c">
<apex:sectionHeader title="Merging Contacts" subtitle="Merge a Contact's Information to Another" />
<apex:form >
	<apex:pageMessages />
	<apex:pageBlock mode="edit">
		<apex:pageBlockButtons >
			<apex:commandButton action="{!mergeSave}" value="Save" />
		</apex:pageBlockButtons>
		<apex:pageBlockSection title="Select Contacts">
			<apex:inputField value="{!Merged_Contact__c.Merge_to_Contact__c}" required="true" />
			<apex:inputField value="{!Merged_Contact__c.Merge_from_Contact__c}" required="true" />
		</apex:pageBlockSection>
		<apex:pageBlockSection title="Select Optional Fields to Merge">
			<apex:inputField value="{!Merged_Contact__c.Title__c}" />
			<apex:inputField value="{!Merged_Contact__c.Phone__c}" />
			<apex:inputField value="{!Merged_Contact__c.Email__c}" />
			<apex:inputField value="{!Merged_Contact__c.Mobile__c}" />
			<apex:inputField value="{!Merged_Contact__c.Address__c}" />
			<apex:inputField value="{!Merged_Contact__c.Other_Phone__c}" />
			<apex:inputField value="{!Merged_Contact__c.Assistant__c}" />
			<apex:inputField value="{!Merged_Contact__c.Fax__c}" />
		</apex:pageBlockSection>
	</apex:pageBlock>
</apex:form>
</apex:page>

 

 Here's my extension:

 

public with sharing class mergeContact {
	
	public Merged_Contact__c mc;
	
	ApexPages.StandardController stdController;

	public mergeContact(ApexPages.StandardController controller) {
		
		stdController = controller;
		this.mc = (Merged_Contact__c)stdController.getRecord();
		
	}
	
	public PageReference mergeSave() {

		Id toId;
		Id fromId;
		Id toHomeId;
		Id fromHomeId;
	
		Boolean title;
		Boolean email;
		Boolean address;
		Boolean assistant;
		Boolean phone;
		Boolean mobile;
		Boolean otherPhone;
		Boolean fax;
		
		Merged_Contact__c newMC;
		Contact fromContact;
		Contact updateContact;
		Contact removeContact;
	
		Set<Id> newPN = new Set<Id>();
		
		List<Contact> toHome = new List<Contact>();
		List<Contact> fromHome = new List<Contact>();
		List<Production_Member__c> updatePM = new List<Production_Member__c>();
		List<Production_Member__c> removePM = new List<Production_Member__c>();
		List<Event> updateEvent = new List<Event>();
		List<Task> updateTask = new List<Task>();

		toId = mc.Merge_to_Contact__c;
		fromId = mc.Merge_from_Contact__c;
	
		toHome = [SELECT Account.ParentId FROM Contact WHERE Id =: toId];
		toHomeId = toHome[0].Account.ParentId;
		
		fromHome = [SELECT Account.ParentId FROM Contact WHERE Id =: fromId];
		fromHomeId = fromHome[0].Account.ParentId;
		
		if(toHomeId == fromHomeId) {
			
			newMC = new Merged_Contact__c(Merge_to_Contact__c = mc.Merge_to_Contact__c, Merge_from_Contact__c = mc.Merge_from_Contact__c, Title__c = mc.Title__c, Phone__c = mc.Phone__c, Email__c = mc.Email__c, Mobile__c = mc.Mobile__c, Address__c = mc.Address__c, Other_Phone__c = mc.Other_Phone__c, Assistant__c = mc.Assistant__c, Fax__c = mc.Fax__c);
			
			title = mc.Title__c;
			email = mc.Email__c;
			address = mc.Address__c;
			assistant = mc.Assistant__c;
			phone = mc.Phone__c;
			mobile = mc.Mobile__c;
			otherPhone = mc.Other_Phone__c;
			fax = mc.Fax__c;
			
			if(title || email || address || assistant || phone || mobile || otherPhone || fax) {
				
				fromContact = [SELECT Id, Title, Email, MailingStreet, MailingCity, MailingState, MailingPostalCode, AssistantName, Phone, MobilePhone, OtherPhone, Fax FROM Contact WHERE Id =: fromId];
				updateContact = [SELECT Id, Title, Email, MailingStreet, MailingCity, MailingState, MailingPostalCode, AssistantName, Phone, MobilePhone, OtherPhone, Fax FROM Contact WHERE Id =: toId];
				
				if(title) { updateContact.Title = fromContact.Title; }
				if(email) { updateContact.Email = fromContact.Email; }
				if(address) { updateContact.MailingStreet = fromContact.MailingStreet; }
				if(address) { updateContact.MailingCity = fromContact.MailingCity; }
				if(address) { updateContact.MailingState = fromContact.MailingState; }
				if(address) { updateContact.MailingPostalCode = fromContact.MailingPostalCode; }
				if(assistant) { updateContact.AssistantName = fromContact.AssistantName; }
				if(phone) { updateContact.Phone = fromContact.Phone; }
				if(mobile) { updateContact.MobilePhone = fromContact.MobilePhone; }
				if(otherPhone) { updateContact.OtherPhone = fromContact.OtherPhone; }
				if(fax) { updateContact.Fax = fromContact.Fax; }
				
			}
	
			removeContact = new Contact(Id = fromId, Active__c = False);
				
			for(Production_Member__c fpm : [SELECT Production_No__c FROM Production_Member__c WHERE Contact__c =: fromId]){
				
				newPN.add(fpm.Production_No__c);
				
			}
		
			for(Production_Member__c tpm : [SELECT Production_No__c FROM Production_Member__c WHERE Contact__c =: toId]){
				
				newPN.remove(tpm.Production_No__c);
				
			}
			
			for(Production_Member__c upm : [SELECT Id FROM Production_Member__c WHERE Contact__c =: fromId AND Production_No__c IN : newPN]){
				
				Production_Member__c pm = new Production_Member__c(Id = upm.Id, Contact__c = toId);
				updatePM.add(pm);
				
			}
		
			for(Production_Member__c rpm : [SELECT Id FROM Production_Member__c WHERE Contact__c =: fromId AND Production_No__c NOT IN : newPN]){
				
				Production_Member__c pm = new Production_Member__c(Id = rpm.Id);
				removePM.add(pm);
				
			}
		
			for (Event e : [SELECT Id FROM Event WHERE WhoId =: fromId]) {
				
				Event fe = new Event(Id = e.Id, WhoId = toId);
				updateEvent.add(fe);
				
			}
			
			for (Task t : [SELECT Id FROM Task WHERE WhoId =: fromId]) {
				
				Task te = new Task(Id = t.Id, WhoId = toId);
				updateTask.add(te);
				
			}

			if(newMC != null) {	insert newMC; }
			
			if(updatePM.size() > 0) { update updatePM; }
			
			if(removePM.size() > 0) { delete removePM; }
			
			if(updateEvent.size() > 0) { update updateEvent; }
		
			if(updateTask.size() > 0) { update updateTask; }

			if(removeContact != null) { update removeContact; }

			if(updateContact != null) { update updateContact; }
			
			PageReference curPage = ApexPages.currentPage();
			ApexPages.Message confirmMSG = new ApexPages.message(ApexPages.Severity.CONFIRM, 'The Merge was Successful');
			ApexPages.addMessage(confirmMSG);
			curPage.setRedirect(true);
			return curPage;
			
		} else {
			
			PageReference curPage = ApexPages.currentPage();
			ApexPages.Message errorMSG = new ApexPages.message(ApexPages.Severity.ERROR, 'The selected Merge from Contact is outside of the Merge to Contact Home Office');
			ApexPages.addMessage(errorMSG);
			return curPage;
			
		}
		
	}

}

 

My question is two fold:

 

  1. Why is it saving regardless of my conditional statement?
  2. I'm assuming question one answers this, but why are my messages not showing?'

 

Thanks!

  • August 31, 2010
  • Like
  • 0

I've built a PageBlockTable that allows users to enter multiple records at one time. The table itself is working fine, I can iterate through and grab the values I need without issue. I'm trying to add some dynamic error messaging to the table to let users know which fields/cells need their attention. I'm using outputText for the error messaging, and my hope is to have a dynamic style for each one, and just toggle "display:inline" and "display:none" from the Apex Controller.

 

However, I can't seem to access a paricular pair of outputText fields. My code ends up turning them on or off for an entire column. Any ideas? Thanks!

 

Visualforce page:

 

 

<apex:form id="theForm">
    
    <apex:sectionHeader title="New Lab Project Hours" subtitle="Lab Project Hour Edit"/>
        
    <apex:pageBlock title="Lab Project Hour Quick Entry" mode="edit">
    <apex:pageMessages id="error" />
        <apex:pageblockButtons >
            <apex:commandButton value="Save" style="padding-left:6px;padding-right:6px" action="{!save}" rerender="error,theForm" />
            <apex:commandButton value="Cancel" style="padding-left:6px;padding-right:6px" action="{!cancel}" rerender="error" />
        </apex:pageblockButtons>
        
        <apex:pageblockSection title="Record Information" columns="2">
            <apex:inputField value="{!Lab_Project_Hours__c.Lab_Project_Name__c}" id="LabProjectName"/>
            <apex:inputField value="{!Lab_Project_Hours__c.Lab_Overflow_Resource__c}" id="LabOverflowResource"/>
            <apex:inputField value="{!Lab_Project_Hours__c.Employee_Name__c}" id="EmployeeName"/>
            <apex:inputField value="{!Lab_Project_Hours__c.Hourly_Utilization_Rate__c}" id="HourlyUtilizationRate"/>
        </apex:pageblockSection>
        
        <apex:pageBlockSection columns="1" title="Hours Worked">
        
            <apex:pageBlockTable HeaderClass="centerHeader" style="width:600px;margin-left:15%" value="{!lphs}" var="a" id="hourTable">
                <apex:column headerValue="Date Worked" styleClass="columnStyle" style="width:35%">
                    <apex:inputField value="{!a.TimeDate__c}" styleClass="{!dateFieldError}" /> <br />
                    <apex:outputText value="Error:" styleClass="errorTextBold" style="{!dateError}" />
                    <apex:outputText value=" Invalid number" styleClass="errorTextBold" style="{!dateError}" />
                </apex:column> 
                
                <apex:column headerValue="Type of Hours" styleClass="columnStyle" style="width:25%">
                    <apex:inputField value="{!a.Type_of_Hours__c}" styleClass="{!typeFieldError}" /> <br />               
                    <apex:outputText value="Error:" styleClass="errorTextBold" style="{!typeError}" />
                    <apex:outputText value=" Invalid number" styleClass="errorText" style="{!typeError}" />
                </apex:column>                
                
                <apex:column headerValue="Number of Hours Worked" styleClass="columnStyle" style="width:40%">
                    <apex:inputField value="{!a.Number_of_Hours_Worked__c}" styleClass="{!numFieldError}" /> <br />                    
                    <apex:outputText value="Error:" styleClass="errorTextBold" style="{!numError}" />
                    <apex:outputText value=" Invalid number" styleClass="errorText" style="{!numError}" />
                </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlockSection>
            
        <div style="text-align:center;width:600px;margin-left:15%;font-weight:bold">
            <apex:commandLink value="Add Row" action="{!addRow}" rerender="hourTable,error" immediate="true" /> 
                &nbsp;|&nbsp;&nbsp;
            <apex:commandLink value="Remove Row" action="{!removeRow}" rerender="hourTable,error" immediate="true" />
        </div>
            
    </apex:pageBlock>
    </apex:form>

 

Apex Controller (the relevant piece)

 

public class ControllerSetLabProjectHourEmployeeName{

  private final Lab_Project_Hours__c objLabProject;
  public List<Lab_Project_Hours__c> lphs {get; set;}
  public String returnURL {get; set;}
  
  public String dateError {get; set;}
  public String typeError {get; set;}
  public String numError {get; set;}
  public String dateFieldError {get; set;}
  public String typeFieldError {get; set;}
  public String numFieldError {get; set;}

  // Constructor method
  public ControllerSetLabProjectHourEmployeeName(ApexPages.StandardController stdController){    
    this.objLabProject = (Lab_Project_Hours__c) stdController.getRecord();
    
    dateError = 'display:none;';
    typeError = 'display:none;';
    numError = 'display:none;';
    dateFieldError = '';
    typeFieldError = '';
    numFieldError = '';
         
    lphs = new List<Lab_Project_Hours__c>();
    for(Integer i=0; i<5; i++)
       lphs.add(New Lab_Project_Hours__c());
       
    try{
       User currentUser = [Select Id, Employee_Page__c From User Where Id = : UserInfo.getUserId() Limit 1];
       if(currentUser.Employee_Page__c != null){
         List<Employee__c> listEmployee = [Select Id, Name From Employee__c where Id = : currentUser.Employee_Page__c Limit 1];
         if(listEmployee.size() > 0){
            objLabProject.Employee_Name__c = listEmployee.get(0).Id;
         }  
       } 
     }
     catch(Exception ex){
       ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL,'Something unexpected happened, please contact an Administrator.'));
     }  
               
     Map<String, String> parentURL = ApexPages.currentPage().getParameters();
     returnURL = parentURL.get('retURL'); 
  }
  
  public void save(){
    Integer numOfRows = lphs.size();
    Integer count=0, totalCount=0, i=0, dateBlank=0, typeBlank=0, numBlank=0;
    String incompleteRows = '';
    
    //Make sure that the entire table isn't blank, and report an error if it is
    for(i=0; i<numOfRows; i++)
      if(lphs[i].TimeDate__c == null && lphs[i].Type_of_Hours__c == null && lphs[i].Number_of_Hours_Worked__c == null)
        count++;
    if(count == numOfRows)
      ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'You must fill out at least one row to submit hours.'));
    
    count=0;
    totalCount=0;
    
    for(i=0; i<numOfRows; i++) {
      if(lphs[i].TimeDate__c == null){
        count++; dateBlank=1;}
      if(lphs[i].Type_of_Hours__c == null){
        count++; typeBlank=1;}
      if(lphs[i].Number_of_Hours_Worked__c == null){
        count++; numBlank=1;}
            
      totalCount = totalCount + count;
      if(count > 0 && count <3){
        incompleteRows = incompleteRows + (i+1) + ' ';
        
        if(dateBlank == 1){
          dateError = 'display:inline;';
          dateFieldError = 'errorField';
        }
        if(typeBlank == 1){
          typeError = 'display:inline;';
          typeFieldError = 'errorField';
        } 
        if(numBlank == 1){
          numError = 'display:inline;';
          numFieldError = 'errorField';
        } 
      }
         
      count=0;
      dateBlank=0;
      typeBlank=0;
      numBlank=0;
    }
      
    if(totalCount == numOfRows)
      ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'You must fill out at least one row to submit hours.'));

    if(incompleteRows.length() > 0)
      ApexPages.AddMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'The following rows are incomplete and need to be fixed: ' + incompleteRows));
    
   // PageReference pageRef = new PageReference(returnURL);
   // return pageRef;
  }
}

 

 

 

 

Hello,

I am creating a Visualforce page using new version 19.

I have two dependent picklist fields. When the controlling field is an inputfield the dependent picklist is filtered.

If I change the controlling field to an outputfield the dependent picklist shows all the values (it is not filtering).

The value of the controlling field is auto populated.

 

Is there a work around to maintain the dependency by keeping the controlling field as outputfield.

 

Dependency Works:

 

<apex:page standardController="opportunity" tabstyle="Opportunity" >
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockSection title="Sample" columns="1">
                <apex:inputField value="{!opportunity.Segment__c}"/>
                <apex:inputField value="{!Opportunity.Department__c}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

 

Dependency does,t Work:

 

<apex:page standardController="opportunity" tabstyle="Opportunity" >
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockSection title="Sample" columns="1">
                <apex:outputfield value="{!opportunity.Segment__c}"/>
                <apex:inputField value="{!Opportunity.Department__c}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

Thanks for you time.

 

  • August 25, 2010
  • Like
  • 0

Hi,

         could some one help me in currency format like 00,00,00,000.00 format in outputText value?

i tried this but not working....

<apex:outputText value="{0,number,#,##,##0=}00">

thanking you.

I am trying to show currency like 1,00,000.00 but it shows like 100,000.00

how can I do this.?

i used this code "<apex:outputText value="Rs{0,number,#,##,##,##0}=00">" but it is not working.

How to write Test method for Upsert Statement. Please help..

 

public PageReference reset() 
{
TallySheetItemList= [select ID, MELT__c, BND__c, GR_WT_KGS__c, Tare__c,
NET_WT_KGS__c, Melt_Date__c, INGOTS__c, Ref__c, IsDeleted__c from TS_NASAAC_Item__c where Tally_Sheet_Ref__c = :TS.ID and IsDeleted__c = false order by CreatedDate limit 100 ];
return null;
}


public PageReference saveItem()
{
upsert TallySheetItemList;
reset();
return null;
}

Currently I have it in my testMethod

 

/* Test Case */

static testMethod void myUnitTest() {
PageReference PageRef = Page.vfTallySheet;
test.setCurrentPage(PageRef);
Apexpages.Standardcontroller sc = new Apexpages.Standardcontroller(new Tally_Sheet__c());
TallySheetItems controller = new TallySheetItems(sc);
controller.reset();
controller.saveItem();
}

/* Test Case ends....*/

 

Hello,

 

I have a pageBlockSection with columns = 4.  I am trying to display data in this pageBlockSection using apex:outputField:

 

  <apex:pageBlockSection title="GC Report" columns="4">
                <apex:outputField value="{!Result__c.GC_AGE_USED__c}" />
                <apex:outputtext value="" />
                <apex:outputtext value="" />
                <apex:outputtext value="" />
            
                <apex:outputField value="{!Result__c.INCOME_USED__c}" />
                <apex:outputField value="{!Result__c.Total_Income__c}" />
                <apex:outputField value="{!Result__c.IncomeSRI__c}" />       
                <apex:outputField value="{!Result__c.INCOME__c}" />
                
                <apex:outputField value="{!Result__c.REALESTATE_USED__c}" />
                <apex:outputField value="{!Result__c.RealEstate_Total__c}" />
                <apex:outputField value="{!Result__c.RealEstateSRI__c}" />       
                <apex:outputField value="{!Result__c.REALESTATE__c}" />

  </apex:pageBlockSection>

 

The data is not aligned properly.. The first two columns take up majority of the display space and the last two appear crowded.  Why is this?

 

Thanks.

 

  • August 18, 2010
  • Like
  • 0

How do I include AccountId (lookup field on Contact) from mergefields in my javascript onclick code for a button.

Hi,

 

We're facing a bit of a challenge in my company and I hope someone here might be able to help.

 

The first challenge might be a bit off-topic but I'll give it a go anyway. How can one model a recursive data structure in SFDC?

 

Basically, we have a custom object called Sales Products which has a type. When type is "Bundle", we would like to be able to link a number of other Sales Products (same object but different type) to it.

 

The second challenge is displaying the Sales Products to select. It would be nice if we could list the existing Sales Products in e.g. a multi-select picklist but as I understand it the inputField shown is based on the actual type of field on the object (i.e. a text field will give a text field, a picklist will give a picklist and so on).

 

Does anyone have any good ideas on how to achieve both recursive data structure and a user friendly way of displaying the recursive link?

 

Cheers.

 

Søren Nødskov Hansen