• Ross James
  • NEWBIE
  • 0 Points
  • Member since 2008

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

I use Hyperlinks to jump to Related Lists on (rather long and crowded) pages, but would like to know if you can link to a Section within the Detail.

 

If so, what do I need to look for in the page source?

 

Any help is appreciated.

I have a simple trigger on Leads that needs to know if the Owner is a User or a Queue.

 

Can anyone show me the (proably very) simple solution to this? My code is below, with the 'real world' question if Owner = Queue.

 

 

 Set<id> ownerIds = new Set<id>();
    for (Lead l : Trigger.new)
        ownerIds.add(l.OwnerId);
        
    Map<id, User> owners = new Map<id, User>([Select Id from User Where Id in :ownerIds]);      
    
    for (Lead l : Trigger.new)
        if(l.Owner = queue){
        //l.Owner_Usable__c = null;
        } else {
        //l.Owner_Usable__c  = owners.get(l.OwnerId).Id;
        }

 

 

 

I am using Custom Settings for the first time and hitting an issue. In my Sandbox, I have everything working great, I go to login as a user to check page layouts etc. and come across the problem below.

 

Why does a standard user in the sandbox get this error, but admins don't?

 

How do I deploy the Custom Setting to the instance it was created on? I did try to do this but was thrown an error in Eclipse as it already existed.

 

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger UpdateRateScoringwithTask caused an unexpected exception, contact your administrator: UpdateRateScoringwithTask: execution of AfterInsert caused by: System.UnexpectedException: No such column 'Name' on entity 'Churn_Risk_Settings__c'. 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. In this instance, it is not visible to the user because the custom object has not yet been deployed: Class.UpdateRateScoringwithTask.UpdateRateScoring: line 8, column 30

With a Google Maps Enterprise Key I am assuming we can then run batches? I have been asked if we could run a number of batch updates through the day to geolocate new records.

 

Would this be possible to run in Apex?

 

<messaging:emailTemplate
    replyTo="{!CASE($User.Region__c,"NSW","my@mycompany.com.au",$User.email)}"
    subject="Network Device Trial Agreement"
    recipientType="Contact"
    relatedToType="Network_Trial__c"

 

 This is giving me the error 

ErrorError: The element type "messaging:emailTemplate" must be terminated by the matching end-tag "</messaging:emailTemplate>"

 

If I take the formula out it is fine. Any ideas?

 

<apex:datatable align="left" var="nt" width="100%" value="{!relatedTo.Network_Trial_Items__r}">
            <apex:column width="40%" value="{!nt.Product__c}" headerValue="Product"/>
            <apex:column width="30%" value="{!nt.USIM__c}" headerValue="USIM"/>
</apex:datatable>

The above gives me a great table of related items, but I need to filter and only show a specific category. 

 

 

How do we do this in a Visualforce email? 

I am trying to setup Chatter News Alerts and coming at a stop very early in the process

 

Copy the generated email address (it will end in a long string of letters.and.numbers.in.salesforce.com);

 

googlealerttochatter@p-1sxmfayyumw7wktnoaywh9ry.p4ypjmaa.p.apex.sandbox.salesforce.com  

   
  • Email address must be a valid Email Services address

As you can see, it isn't accepting the email address generated from the Email Service. I have tried this with other Servces, Email Addresses and Users.

 

I am testing this in Sandbox, could this be a problem?

After a lot of persistence I finally was able to get repeating header and footers when rendering a Visualforce page as a PDF. The key to this is the page2PDF support of CSS3. 

 

Here is the css I came up with:

 

<style type="text/css">

@page {

@top-center {

content: element(header);

}

}

div.header {

padding: 10px;

position: running(header);

}

</style>

 

In the visualforce page I have the header setup as a div with the class name "header" the position running command pulls the content in my div and repeats it at the top of every page. The key for some reason is to put your header and footer divs at the top before you put your content on the page.

 

Here is my page

 

<apex:page renderAs="pdf">

<head>

<style type="text/css" media="print">

@page {

@top-center {

content: element(header);

}

@bottom-left {

  content: element(footer);

}

}

 

div.header {

padding: 10px;

position: running(header);

}

div.footer {

display: block;

padding: 5px;

position: running(footer);

}

 

.pagenumber:before {

content: counter(page);

}

.pagecount:before {

content: counter(pages);

}

</style>

</head>

 

<div class="header">

<div>My Header Text</div>

</div>

 

<div class="footer">

<div>Page <span class="pagenumber"/> of <span class="pagecount"/></div>

</div>

 

<div class="content">

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum nec nulla turpis. Suspendisse eget risus sit amet lectus ornare varius. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean nec urna purus, adipiscing accumsan massa. Nullam in justo nulla, sed placerat mauris. In ut nunc eget libero posuere luctus. Donec vulputate sollicitudin ultrices. Nulla facilisi. Mauris in sapien arcu. Phasellus sit amet quam non mi ornare tincidunt ac quis lectus.</p>

</div>

</apex:page>

 

I cut the content text short for the purpose of this post. I am sure it will just take some more playing around.

 

Hope this helps someone avoid some late nights like I spent trying to figure this out. :smileyhappy:

 

 

Message Edited by JohnDS on 03-10-2010 07:34 PM

Hi,

Is it possible to addresss a question to Reid Carlberg ? I want to write to him as an "App Evangelist". I am an SF administrator / Developer, and I'm looking for a solution to allow a mass / batch production of VisualForce page to be PDF'd and downloaded / Sent by email.
 
The idea is that if each page represents a document (Invoice / Timesheet / Etc.),  sitting around generating say 200 of these, takes a long time. Printing each seperately, also takes a long time.

I'm looking for any app / idea that someone out there may have.
 
Thanks.
 
Ben 

Can someone tell me the obvious and silly mistake I am making?

 

trigger GoItemfromAsset on SchedInt__c (before update) { if(Trigger.isUpdate) { for(SchedInt__c s : Trigger.new) { if (s.ItemFromAsset__c==true) { ItemfromAsset.createItemfromAsset(); } } }}

 

 

 

The class is as follows: 

 

 

public with sharing class ItemfromAsset {
    
    public static Map<id, Asset> getAssetToCreateItem() {
        
        DateTime dT = System.now();
        String myDate = dT.format('d');
        Decimal myDay = decimal.valueOf(myDate);
        
        List<Asset> asts =  [select id, name, AccountId, Billing_Product__c, Quantity 
                                from asset 
                                where Day__c = :myDay
                                and Status = 'Active'];
        Map<id, Asset> result = new Map<id, Asset>();
        for (Asset ast : asts) {
            result.put(ast.id, ast);
        }
        return result;
    }
    

    public static void createItemsfromAsset() {
        
        DateTime dT = System.now();
        String myDate = dT.format('d');
        Decimal myDay = decimal.valueOf(myDate);
        
        Map<id, Asset> AssetIdToItem = getAssetToCreateItem();
        system.debug('got AssetIdToItem map of size ' + AssetIdToItem.size());
        
        Map<id, Asset> idToAsset = new Map<id,Asset>();
        
        List<Item__c> Items = new List<Item__c>(); 
        
        List<Asset> assets = [select id, name, AccountId, Billing_Product__c, Quantity 
                                from asset 
                                where Day__c = :myDay 
                                and Status = 'Installed'];
        System.debug('***** accounts returned = ' + assets.size());
        
        insert items;
        
        Map<id,id> astToItem = new Map<id, id>();
        System.debug('***** about to iterate throught the items');
        
        for (Item__c currItem : items) {
            astToItem.put(currItem.asset__c, currItem.id);
            System.debug('***** accid/invid = ' + currItem.account__c + '/' + currItem.id);
        }
        }
        }

 

 

 

Message Edited by Ross James on 03-01-2010 07:54 PM
Message Edited by Ross James on 03-01-2010 07:55 PM