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

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

I am wanting to give permisson to selected Users (Team Managers, etc.) to enable them to Manage Queue Members. Just as in a Call Centre envirionment, I would like them to be able to move their 'agents' around based on workload and need.

 

What I don't want to do is expose the Manage User Permissions in full, which is what is needed if I use Permission Sets.

 

Has anyone achieved this with a page and some code?

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 line breaks in a formula - it is a mini help that pre-validates data and gives the user a hand.

 

In this example everything is fine.

 

 

CASE(  Status__c  , "New",   $Setup.Network_Trial_Help__c.New__c  ,  "Approved",  $Setup.Network_Trial_Help__c.Approved__c , "Hardware Issued",  $Setup.Network_Trial_Help__c.Hardware_Issued__c , "Agreement Received",  $Setup.Network_Trial_Help__c.Agreement_Received__c , "Hardware Returned",  $Setup.Network_Trial_Help__c.Hardware_Returned__c , "") &
IF(Number_of_Items__c<1,BR() & BR() & IMAGE("/img/samples/flag_red.gif" , "Red") & " You have not selected any Items " & IMAGE("/img/samples/flag_red.gif" , "Red"),"") &
IF( Account_Valid__c ="True", " The Account does not have a valid address " & IMAGE("/img/samples/flag_red.gif" , "Red") ,"")

 

Here, I am simply adding a line break between the last two IF statements

 

 

CASE(  Status__c  , "New",   $Setup.Network_Trial_Help__c.New__c  ,  "Approved",  $Setup.Network_Trial_Help__c.Approved__c , "Hardware Issued",  $Setup.Network_Trial_Help__c.Hardware_Issued__c , "Agreement Received",  $Setup.Network_Trial_Help__c.Agreement_Received__c , "Hardware Returned",  $Setup.Network_Trial_Help__c.Hardware_Returned__c , "") &
IF(Number_of_Items__c<1,BR() & BR() & IMAGE("/img/samples/flag_red.gif" , "Red") & " You have not selected any Items " & IMAGE("/img/samples/flag_red.gif" , "Red"),"") &
IF( Account_Valid__c ="True",BR() & " The Account does not have a valid address " & IMAGE("/img/samples/flag_red.gif" , "Red") ,"")

 

 

When doing so, the formula saves OK, but the result is always #error

 

It doesn't matter where I try and add the BR(), as long as it is AFTER the first IF statement, I get #error. I can add dozens, as long as they are in the first IF statement.

 

Does anyone have any idea what I am doing wrong?

 

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 have over 3000 Contacts with an Address Line greater than the 30 character limit. This stops the Geocode with an error and it won't start again.

I then tried to change the Contact Mapping Address to Do Not Map, but the update fails as the Address Line is greater than 30 characters.

What am I to do? Other than edit the 3000 records (not going to happen).

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?

I am having problems with a simple IF statement and Lookup Fields. How do I ask if the Lookup Field Membership_Number__c is empty.

 

This is my code, but all records, with or without a Membership Number are going to the else.

 

 

if (ili.Product_Family__c=='Membership') { 
        		if (ili.Account_Name__r.Membership_Number__c==NULL) {
        			InvoiceLineItemPaid.AddMembership((String)ili.Id);
        		} else {
        			InvoiceLineItemPaid.AddMembershipLineItem((String)ili.Id);
        		}

 

 

 

All components failed Version Compatibility Check

Every component in this change set requires the "19" or higher platform version. Please select an organization with a platform version of "19" or higher.

  
 

Since the upgrade of the sandbox it seems I can't deploy to my production environment. I am trying only one visualforce page which is API 16.0.

 

Why can't I do this?

Can I get some feedback, ideas or game plan for the following: 

 

When a CDR Call_Detail_Record__c is imported, it needs to be matched to a Call Rate Call_Rate__c. The Call Rates are based on a prefix of between 3 and 8 digits long (there are 100's of these). The string from the CDR (to match to the rates) can be between 5 and 15 digits long.

 

A (5 to15 digit) Call_Detail_Record__c.DST__c needs to be match to the longest Call_Rate.Prefix__c possible, checked in a descending order (the first 8 of DST__c compared to the 8 digit Prefix__c records first, then 7, etc.).

 

This Call Rate Id is then assigned to the CDR. 

 

CDR data is imported via the Bulk API. Could be 1 or 10,000 records.

 

Any ideas on best way to handle this will be appreciated. 

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

I need a Text Formula to include the formatted DATE/TIME as part of the text string. Just as the DATE/TIME fields are formatted for the user time zone, I would like to do this within a Text Formula.

 

e.g.

 

"Some text can come from other places, then we also show the date 20/12/2009 12:48 PM" 

 

I am stuck on how to format the Date/Time fields in the correct format within a Text Formula. My 1st formula to work with the date alone (in a Text Formula) was long enough, I dread to think what is needed to format the date as above. I am hoping there is something very simple I have missed. Or should I just write a trigger?

I have found a single solved discussion for PersonEmail via the API, but nothing on using the Person fields in formula.

 

I am needing to create a formula field to show the email, or if there isn't one, create a username from the persons name. Pretty simple, but can't 'find' the fields.
I am needing some help with creating my first S-Control. I have a Custom Object that (in short) requires my users to Submit for Approval, many items in one process. These items are determined by several List Views.

I am guessing that this isn't a standard feature. Can someone help me with the code needed to submit several items at one time?
Now we are using multiple Record Types, it would be helpful to be able to set this in the Create New Lead window in Maildrop.

I would think more than just me would benefit from this addition.

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

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