• DownstairsB
  • NEWBIE
  • 24 Points
  • Member since 2010

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

For a normal Email Task (workflow rule), you can specify that the sender is an org-wide email address.

We need to be able to set this for the Approval Request Notification template on an Approval Process.

 

How do I accomplish this?  It is critical to our business that the submitters of the request DO NOT have their name and email on the notification.

Hi, I'm having a similar issue with using a Map<id,Product2>

 

The weird thing is that it works perfectly in sandbox but not in development... wtf apex?

 

I'm not going to post the entire trigger code here, as it's not necessary, I have narrowed the issue down to the Map .get() method:

 

24 System.Debug('Keyset: '+pMap.keyset());
25 System.Debug('Product: '+pMap.get('01t50000001LcjyAAC').name);
26 Product2 testp;
27 if (Trigger.isInsert){
28 for (Product_Lot__c pl: Trigger.new){
29           System.Debug('Product__c: '+pl.Product__c);
30           testp = pMap.get(pl.Product__c); <--- Always Returns Null
31           testp.Inventory_on_Hand__c += pl.Quantity__c;    <--- Causes a null pointer exception
32      }

 

 

Results of Execute Anonymous:

 

11:33:25.101|USER_DEBUG|[24]|DEBUG|Keyset: {01t50000001LcjyAAC}

11:33:25.101|METHOD_EXIT|[24]|System.debug(ANY)

11:33:25.101|METHOD_ENTRY|[25]|System.debug(ANY)

11:33:25.101|METHOD_ENTRY|[25]|MAP.values()

11:33:25.101|METHOD_EXIT|[25]|MAP.values()

11:33:25.102|USER_DEBUG|[25]|DEBUG|Product: 2-Mercaptoethanol

11:33:25.102|METHOD_EXIT|[25]|System.debug(ANY)

11:33:25.102|METHOD_ENTRY|[29]|System.debug(ANY)

11:33:25.102|USER_DEBUG|[29]|DEBUG|Product__c: 01t50000001LcjyAAC

11:33:25.102|METHOD_EXIT|[29]|System.debug(ANY)

11:33:25.102|METHOD_ENTRY|[30]|MAP.get(ANY)

11:33:25.102|METHOD_EXIT|[30]|MAP.get(ANY)

11:33:25.102|EXCEPTION_THROWN|[31]|System.NullPointerException: Attempt to de-reference a null object

11:33:25.102|FATAL_ERROR|System.NullPointerException: Attempt to de-reference a null object

Trigger.Product_Lot_Trigger: line 31, column 4

 

So if you look at the highlighted lines (DEBUG outputs), you can plainly see that the map contains a valid ID, and the

hard-coded get() on line 25 returns the correct object and displays the correct name, so the Value is correct too.

Also you can see that the field Product__c (on line 29) exactly matches the key that is in the Map.

But line 30 is still returning NULL!!!!

 

I'm just starting to get angry at this point, because this works 100% correctly in the Sandbox.  Can anyone help?

For a normal Email Task (workflow rule), you can specify that the sender is an org-wide email address.

We need to be able to set this for the Approval Request Notification template on an Approval Process.

 

How do I accomplish this?  It is critical to our business that the submitters of the request DO NOT have their name and email on the notification.

For a normal Email Task (workflow rule), you can specify that the sender is an org-wide email address.

We need to be able to set this for the Approval Request Notification template on an Approval Process.

 

How do I accomplish this?  It is critical to our business that the submitters of the request DO NOT have their name and email on the notification.

I looks like Messaging.SingleEmailMessage provides both of these methods.  I was wondering if I can set both the plain text and the html for this email.  Then, depending on the recipient's email configuration, one's email reader will choose the appropriate content.  Thanks in advance.

Can I built a VF Email Template where the "To" field can populated or overwritten?

 

The Email will be sent out from the Lead level, and as you know be default the "To" field displays the Lead Name.

 

There is a lookup to Contact custom field in the LEAD, and when the VFTemplate is selected the "To" field should be overwritten to that Contact Name which is already selected on the LEAD.

 

Can this be done?

HI.

 

I am following the Warehouse app Tutorial.

I am at Tutorial #7.

Just finished down-loading the Force.com IDE but don't know how to create a project.

The instruction are saying to select FILe->New but under File the only options I am getting are: Exit, Open File and Convert Line delimiters to...

 

Help will be much appreciated!

 

New to SF

Hello.  I have seen a couple of related posts - but none of them seem to address my specific issue.

 

I have added an actionRegion around an inputField.  The behavior works as desired - but the label of the inputField ("Region Label")  disappears.  I have tried to add the label via OutputLabel - but the desired "Region Label" now appears ABOVE the inputField picklist instead of immediately to the left of it.

 

Can anyone suggest where I am going wrong?


Thanks in advance.

 


<apex:actionRegion >
  <apex:outputLabel value="Region Label" for="RegPickList">
    <apex:inputField value="{!xxx.CustomerRegion__c}" id="RegPickList" required="true">
      <apex:actionSupport event="onchange" rerender="RegionDetailPanel"/>
    </apex:inputField></apex:outputLabel>
</apex:actionRegion>

Hi, I'm having a similar issue with using a Map<id,Product2>

 

The weird thing is that it works perfectly in sandbox but not in development... wtf apex?

 

I'm not going to post the entire trigger code here, as it's not necessary, I have narrowed the issue down to the Map .get() method:

 

24 System.Debug('Keyset: '+pMap.keyset());
25 System.Debug('Product: '+pMap.get('01t50000001LcjyAAC').name);
26 Product2 testp;
27 if (Trigger.isInsert){
28 for (Product_Lot__c pl: Trigger.new){
29           System.Debug('Product__c: '+pl.Product__c);
30           testp = pMap.get(pl.Product__c); <--- Always Returns Null
31           testp.Inventory_on_Hand__c += pl.Quantity__c;    <--- Causes a null pointer exception
32      }

 

 

Results of Execute Anonymous:

 

11:33:25.101|USER_DEBUG|[24]|DEBUG|Keyset: {01t50000001LcjyAAC}

11:33:25.101|METHOD_EXIT|[24]|System.debug(ANY)

11:33:25.101|METHOD_ENTRY|[25]|System.debug(ANY)

11:33:25.101|METHOD_ENTRY|[25]|MAP.values()

11:33:25.101|METHOD_EXIT|[25]|MAP.values()

11:33:25.102|USER_DEBUG|[25]|DEBUG|Product: 2-Mercaptoethanol

11:33:25.102|METHOD_EXIT|[25]|System.debug(ANY)

11:33:25.102|METHOD_ENTRY|[29]|System.debug(ANY)

11:33:25.102|USER_DEBUG|[29]|DEBUG|Product__c: 01t50000001LcjyAAC

11:33:25.102|METHOD_EXIT|[29]|System.debug(ANY)

11:33:25.102|METHOD_ENTRY|[30]|MAP.get(ANY)

11:33:25.102|METHOD_EXIT|[30]|MAP.get(ANY)

11:33:25.102|EXCEPTION_THROWN|[31]|System.NullPointerException: Attempt to de-reference a null object

11:33:25.102|FATAL_ERROR|System.NullPointerException: Attempt to de-reference a null object

Trigger.Product_Lot_Trigger: line 31, column 4

 

So if you look at the highlighted lines (DEBUG outputs), you can plainly see that the map contains a valid ID, and the

hard-coded get() on line 25 returns the correct object and displays the correct name, so the Value is correct too.

Also you can see that the field Product__c (on line 29) exactly matches the key that is in the Map.

But line 30 is still returning NULL!!!!

 

I'm just starting to get angry at this point, because this works 100% correctly in the Sandbox.  Can anyone help?

Hello -

 

I am trying to add a visualforce page to my custom object that will show the related products.

 

So my "Sales Checklist" object is housed on the opportunity, sales fills all the information out then the object is sent to a queue.

 

But to save time i want to pull in the opportunityLineItems in to the sales checklist?

 

Is this possable? I know very little visualforce.

 

This is as far as I have gotten:

 

<apex:page StandardController="Sales_Checklist__c">
<apex:relatedList list="Opportunity__r" />

<apex:pageBlock title="{!Sales_Checklist__c.Opportunity__r.Name}"/>

  <apex:dataTable value="{!Sales_Checklist__c.Opportunity__r}" var="opp" cellPadding="4" border="1">
                
           <apex:column ><apex:facet name="header">Product Name</apex:facet></apex:column>
                
                
           <apex:column><apex:facet name="header">Quantity</apex:facet></apex:column>
                
                
           <apex:column ><apex:facet name="header">Unit Price</apex:facet></apex:column>
                
              
           <apex:column ><apex:facet name="header">Total Price</apex:facet></apex:column>
  </apex:dataTable>
</apex:page>

 

 

any help would be greatlt appriciated

 

Thanks,

Niki

I am creating a visualforce page which will display the profile photo of the user in it.

Can someone help me reference it ?

Hi, Can't seem to figure out as to why this piece of code always returns a Null value and always executes the if statement even when there is an entry in the table. Thanks


                   if (currentBuyerId.get(a.UserOrGroupId) == NULL){
                    //If UserOrGroupId does not exist
                    //Add records being shared with buyers into the array for later insert
                    relationShare.add(buyerShare);      
                }

 

**********************

 

trigger Buyer_Supplier_Share on mcbangalore__Relation__c (after insert,after update) {

AccountShare buyerShare = new AccountShare();
List<AccountShare> relationshare = new List<AccountShare>();
id badId = '00550000001DzCR';

//
if ( trigger.isInsert||trigger.isUpdate) {

    for(Relation__c relation:trigger.new) {
        
        //Retrieve every supplier sharing record and insert it into the Buyer Sharing table
        
         List<AccountShare> supplierShare= [Select AccountId, UserOrGroupId from AccountShare
                        where AccountId =:relation.Supplier__c];

        //Map the Ids and UserOrGroup Ids of the Buyer Record to prevent duplicate entries
    
        Map<Id, AccountShare> currentBuyerId = new Map<Id,AccountShare> ([Select UserOrGroupId,AccountId from AccountShare
                        where AccountId = :relation.Buyer__c]);
        
        for (AccountShare a :supplierShare) {   
        
            //Share the Buyer Account with the Sellers;
            buyerShare.AccountId = relation.Buyer__c;
            //Share the Seller Account with all the Buyer Contacts
            buyerShare.UserOrGroupId = a.UserorGroupId;
            
            //Set the access level
            buyerShare.AccountAccessLevel = 'edit';
            //Set the Sharing Reason
            //buyerShare.RowCause = schema.Relation__Share.Rowcause.Grant_Relationship__c;
        
            //Check if the UserOrGroupId already exists for this Id
                
                   if (currentBuyerId.get(a.UserOrGroupId) == NULL){
                    //If UserOrGroupId does not exist
                    //Add records being shared with buyers into the array for later insert
                    relationShare.add(buyerShare);      
                }

    
            } //For AccountShare a
        } //for trigger.new
    } //If (trigger.IsInsert)


//Insert Array into the database
Database.SaveResult[] buyerresult = Database.insert(relationShare,false);

//Process Errors

Today I am running into an Apex error ' Illegal assignment from LIST<User> to User' with the following piece of code.

 

User u =[Select u.Profile.Name, u.ProfileId From User u where u.UserName = :username];

 

This code worked ok last week with no errors but today I cannot get this to work and I dont know why!

 

Ive tried to change the code to 

User[] u =[Select u.Profile.Name, u.ProfileId From User u where u.UserName = :username];

but this also errors out with 'Illegal assignment from LIST<User> to LIST<User>'

 

Any help/pointers would be greatly appreciated.

 

How do I check if a valid Contact is returned from a query like this in Apex.

 

Contact o = [SELECT c.Id, Email, LastName, FirstName, MailingCity, HomePhone, MailingState, MailingStreet, MailingPostalCode, AccountId, Source_Code__c, Drupal_User_Id__c FROM Contact c WHERE c.Email = :n.Email AND c.Id != :n.Id limit 1];

 

How do I check to see if o is a populate Contact object.

Is there a way to automatically backfill an autonumber on existing object records?

 

Or does this have to be done programmatically via APEX?

 

Thanks for your insight in advance.

Hello,

 

Im using the Force.com IDE for writing Apex code. Is there any way to write debug statements to print a value to the console ?. An example would be really appreciated.

 

Thank You

  • April 09, 2010
  • Like
  • 0

Hi,

 

I am i have a created a custom object and am trying to make a master-detail relationship with the object Product. The problem is when I select Master-Detail the Product object does not show up in the drop down list. Does this mean that I can not create a Master Detail relation ship keeping the Product as the master or is there some settings to be changed to get this done.

 

Thanks

KD 

  • May 20, 2009
  • Like
  • 0
Hi,

I am creating a string in my APEX class which needs to have new line characters in it. For eg:

"This is line 1.
This is line 2."

I need to show this on my Visualforce page. It works but the new line char does not appear on the Visualforce page. I have tried adding almost all types of linefeed chars possible but none worked.

When i use "This is line 1 \n This is line 2", it shows the same in Visualforce page without converting it to a  new line. I have tried \n,\r,\n\r,<br/>,&lt;br/&gt; and few others. I also tried setting escape attribute of "outputText" on visualforce but it didnt worked. 

Is there any way to make it work.

Thanks
[GM]

Today I am running into an Apex error ' Illegal assignment from LIST<User> to User' with the following piece of code.

 

User u =[Select u.Profile.Name, u.ProfileId From User u where u.UserName = :username];

 

This code worked ok last week with no errors but today I cannot get this to work and I dont know why!

 

Ive tried to change the code to 

User[] u =[Select u.Profile.Name, u.ProfileId From User u where u.UserName = :username];

but this also errors out with 'Illegal assignment from LIST<User> to LIST<User>'

 

Any help/pointers would be greatly appreciated.