• Rustan
  • NEWBIE
  • 105 Points
  • Member since 2012

  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 42
    Replies

Hello,

 

 

How can I rewrite the following so I don't run the soql in the for loop, however,

each Workorder has it's own material list of items.

 

		           	
                for(jbbfc2__Workorder__c wo : workorderList){  
		         materialUList = [select jbbfc2__Workorder__c, Name
                                from jbbfc2__MaterialU__c 
                                where jbbfc2__Workorder__r.jbbfc2__Status__c ='Closed' AND jbbfc2__Workorder__c =:wo.id];
 	             
                  InvoiceObj invObjItem = new InvoiceObj(wo, wrMap, materialUList);
                  this.invObjList.add(invObjItem);
                 }

 

I have a page controlled by a controller that need to check if a case exists, and if it does, redirect. I'm calling:

 

 redirectPage = new PageReference('http://mypagehere.com');

 

from a constructor, but it does nothing unless I action it with a visualforce action. I don't really want to do this. What I want to have happen is for anyone that comes to the page and has a parameter that indicates a redirect to simply redirect. A la:

 

1. User tries to go to page with "http://myorg.com/mpage?case=1

2. Controller says "If case=1, redirect" in the constructor.

 

Is there no way to do this?

How do i get a formula field including br() to actually render a row break instead for showing the text string? 

 

Im using the following code to display a message if the entry criteria for an approval process has not been met. 
The "Missing_needed_fields_for_approval__c"-field is a formula that includes BR(). This renders perfectly on the standard page layout but not in my output text block. In the text block the text BR() is displayed.

Is there any way of getting the formula BR() to be rendered as a <BR/>? 

 

       <!-- APPROVAL ENTRY CRITERIAS -->
       <apex:OutputText escape="false" rendered="{!OR(flight__c.Customer_approved__c == '',flight__c.C_Opportunity_won__c =='', flight__c.C_Simulation_completed__c =='' ) }">
           <br/>
           <div style="border:1px solid red; padding:10px; margin:20px; background-color:#f1cccc;">
           <b>Before submitting this flight for approval you need to fix the following:</b><br/> 
	       {!Flight__c.Missing_needed_fields_for_approval__c}
           </div>
           <br/>
       </apex:outputText>

 

FYI : Im a beginner to apex :)

 

I have added my visualforce page to Account page and found that it can set only fixed height. I wrote javascript solution for auto height. First part I added to main Account page by adding new button with {!REQUIRESCRIPT("my_scipt_here")}, second part I added to visualforce page.

 

Is it possible to add javascipt to the "main" Account page without adding Custom Button?

Hi

 

 

 how can we write a trigger using list,set ,map for two custom objects.the trigger should be in the way ,,when we insert a record in one object ,the record should automatically inserted in the second  object.at the same time when we update the record in first object.the record should automatically update in the second object...i.e.there should not be any relation between two objects.

Hello,

 

 

How can I rewrite the following so I don't run the soql in the for loop, however,

each Workorder has it's own material list of items.

 

		           	
                for(jbbfc2__Workorder__c wo : workorderList){  
		         materialUList = [select jbbfc2__Workorder__c, Name
                                from jbbfc2__MaterialU__c 
                                where jbbfc2__Workorder__r.jbbfc2__Status__c ='Closed' AND jbbfc2__Workorder__c =:wo.id];
 	             
                  InvoiceObj invObjItem = new InvoiceObj(wo, wrMap, materialUList);
                  this.invObjList.add(invObjItem);
                 }

 

Hello,

 

I tried to write an apex code to sum the field of child related list obect.

 

I have 2 custom objects : "Server__c" and "Component__c"

i have a field, type :number, called "Memory__c" in the component object.

there are n Components related to Server.

 

I would like to sum the Memory of each component related to my server.

 

i tried this, but it doesn't work. I'm new in the apexcode

 

public class CustomserverController {

Id idServer = null;
Integer SumMemory = 0;

public CustomChassisController(ApexPages.StandardController conMain) {
// Set Variables
idServer = conMain.getId();
}

List<Server__c> LstServer = [SELECT (select Memory__c FROM Components__r) FROM Server__c WHERE Id = :idServer];

for(Server__c a: LstServer)
{
for(Components__c o: a.Components__r)
{
SumMemory += Memory__c;
}
}
}

 

Thanks for your help

 

Antoine

 

Hai

 

For Account Object in Rating field------->if Rating = cold, the record should not be editable.

 

How can i achive this.

 

Please help me.

 

C Narendra

+91-9849896921.  

Hi,

 

I'm not a developer, but I'm attempting to learn since I've reached a point where I need code to customize and automate further.  I've created a custom "Sales Price" field for Opportunity Products that I am using to replace the standard Sales Price field.  I want the custom field to default with the price book entry list price (unitprice) value as does the standard Sales Price field.  Then I have the standard Sales Price field getting updated to equal the custom Sales Price times the number of month terms (custom field that will be updated at Opportunity level and automatically populated in reflective custom field on Opportunity Products via trigger).  I've created triggers for both the Sales Price value to default and the Month Terms to default, but neither seems to be working now.   Below is the trigger for the Sales Price value when creating a new opportunity line item.  I could have sworn this worked last Friday and now doesn't.  Not sure how to get the price to default when adding a new product line item?  It should only default when adding new since I don't want it to override any amount that they put in and save. But it also needs to work if they go back into the opp and add additional items later.  Any input on this is greatly appreciated. I've spent hours searching other posts in the community and all the other documentation, but I don't have that natural developer brain, and I'm banging my head now!

 

trigger SalesPricecustom on OpportunityLineItem (before insert) {
    Set<Id> pbeIds = new Set<Id>();
        for (OpportunityLineItem oli : Trigger.new) 
        pbeIds.add(oli.pricebookentryid);
        
    Map<Id, PricebookEntry> entries = new Map<Id, PricebookEntry>(
        [select UnitPrice from pricebookentry 
         where id in :pbeIds]);     
            
for (OpportunityLineItem oli :trigger.new){
     if(pricebookentry.unitprice <> null && oli.sales_price__c == null){
    
    oli.sales_price__c = entries.get(oli.pricebookEntryId).UnitPrice;  
  }
}} 

 

Thanks!

for (ContentVersion cv : trigger.new)
{
	if (cv.Contact__c != null && cv.Hold__c == true)
	{
		cv.TagCsv = 'Hold';
	}
	system.debug('@@ cv.TagCsv : ' + cv.TagCsv);
}

This code has been put on ContentVersion, Before Update trigger. And this debug line: system.debug('@@ cv.TagCsv : ' + cv.TagCsv);, also shows that TagCsv field has been put value into it successfully, but when I go into the Content record, the Tags field is coming in Empty.

 

Is this some kind of Bug ?

  • August 14, 2012
  • Like
  • 1

<apex:detail subject="{Position__c.Id}" relatedList="true" inlineEdit="true"/>

 

I want to inline edit only 1 specific column when I go to the record detail page.

 

How can I achieve this. Quick response is much appreciable

 

Thanks in advance!

Hi,

 

I'm trying to create a table of contents in a visualforce page rendered as a pdf. Has anybody done this? Is this even possible?

 

I'm looking for something that would end up looking like:-

 

1. Lorem Ipsum......................1

2. Lorem Ipsum......................2

3. Lorem Ipsum......................2

4. Lorem Ipsum......................3 

 

(heading).............................(page number)

 

I know I can do the first bit but I don't have any way of knowing which page the heading will fall on due to differing content lengths.

 

Thanks for any help.

Rich.

I want to create advance financial reports using visualforce and apex.

Please advice the best way to do.

 

Thanks 

Ravi

 

hey guys,

 

I have a customized visualforce page. I need to display some documents. I dont want to upload them as static resources but rather in a folder where I can control which groups/roles can see that folder.

 

How can I link to or display any documents which are uploaded to this folder?

 

Thanks,
Calvin

Hi,

I have a VF page for custom object, which is parent object to many other children objects.

These children objects have lookup field to parent object.

So, there when child record is created, name of parent record appears on the page layout.

When you click on that link, it takes you to standard layout of the parent object. Instead of that, I want to take user to custom VF page that we have developed for parent object.

 

Can anybody tell me how to do that?

 

Thanks,

Bakul

Hi

I  have written a controller and visualforcepage to delete the records from s3amazon.

and i have  been override the standard button  delete with my visualforcePage.and its working fine when click on delete.

I am able to delete the record in salesforce as well asin S3.when i click on override button.

But  when i delete the records using the dataloader.

I am able to delete the record in salesforce but not in S3amazon...........Please help me to solve the issues

 

 

 

thanks in advances

  • August 07, 2012
  • Like
  • 0