• ICSteve
  • NEWBIE
  • 25 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 16
    Replies

Hello,

I have the following trigger that is designed to change an Opportunity owner to a new account owenr after an account DLoader upsert. It compares the owners of Opportunity to new owenrs of accounts and users who share accounts (indicated by UserID inserted in SLS2__c upon account update).

 

The trigger works when I change account owners manually in SFDC, but does not work wehn I use that DataLoader to update ownership. It returns the following ERROR:

updateOppOwner: execution of AfterUpdate

caused by: System.NullPointerException: Attempt to de-reference a null object

Trigger.updateOppOwner: line 17, column 1.

 

Please help.

this is the trigger inserted in Account:Triggers

====

 

Line 17 : optyMap.get(acct.id).OwnerID= acct.OwnerID;

======

Full trigger:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

 

trigger updateOppOwner on Account (after insert, after update) {
  if (Trigger.isAfter) {
  Set<Id> acctIds = new Set<Id>();
    for (Account acct : Trigger.new) {
       acctIds.add(acct.Id);
       }     
Map<id,Opportunity> optyMap = new Map<Id,Opportunity>( [SELECT OwnerId  FROM Opportunity WHERE AccountId in :acctIds]);

    if ( !optyMap.isEmpty() ) {

    for (Account acct : Trigger.new) {

        for(Opportunity opty : optyMap.values() ) {      

            if(opty.OwnerId != acct.OwnerId && opty.OwnerId != acct.SLS2__c){

               optyMap.get(acct.id).OwnerID= acct.OwnerID;
                    } else {
          opty.OwnerId = opty.OwnerId ;
                   }
            }

        update optyMap.values();

        }
  }
    }
    }

  • February 15, 2013
  • Like
  • 0
I have a URL list button on opportunity that I am trying to use on the related list on both the account and contact detail pages. The button displays fine in the opportunity related list on the account detail but I can't get it to display on the contact detail. Has anyone else come across this issue?

I'm displaying a case comment body with an outputfield in salesforce1 and am trying to use "word-wrap: break-word" so that the text does not go off the side of the screen and force the user to scroll. It works fine with Android and in the browser, however it isn't working for iOS. I was able to get the lines to break using "word-break: break-all" but then every line ends with a broken word which is not what we want.

Has any dealt with this issue and have a solution?

I am attempting to add a ContentVersion field set to a package that includes a class which references it but it was not automatically added and it's not available to add manually. I was able to add field sets for other objects but not any on ContentVersion.
Is there something I'm missing or is this simply a salesforce bug?
Is it possible to have a select element open its dropdown options box by clicking on the label for the element? I tried achieving this with javascript by calling focus() and click() on the select element but giving it focus does not open the box with the options.

I have a field on a custom object that I use to display one of the attachments on the record. I use servlet file download link to get the image to display and that is fine. However, these pictures are being uploaded from mobile devices and whenever this is done for an image taken and uploaded from an iOs device in portait mode, it is automatically being rotated 90 degrees into landscape when displayed on the page. If I go into the attachment and click view file it displays properly though.

Has anyone dealt with this issue before? Any ideas on how to prevent this?

 

Thanks

Is it possible to concatenate two or more columns into a single field in the field mapping file when using data loader with batch mode?

And if so, what is the syntax?

 

Thanks

What kind, if any, limitations are set for Chatter External Users when using the REST API?

Is it possible to have a select element open its dropdown options box by clicking on the label for the element? I tried achieving this with javascript by calling focus() and click() on the select element but giving it focus does not open the box with the options.

I have a field on a custom object that I use to display one of the attachments on the record. I use servlet file download link to get the image to display and that is fine. However, these pictures are being uploaded from mobile devices and whenever this is done for an image taken and uploaded from an iOs device in portait mode, it is automatically being rotated 90 degrees into landscape when displayed on the page. If I go into the attachment and click view file it displays properly though.

Has anyone dealt with this issue before? Any ideas on how to prevent this?

 

Thanks

I have a URL list button on opportunity that I am trying to use on the related list on both the account and contact detail pages. The button displays fine in the opportunity related list on the account detail but I can't get it to display on the contact detail. Has anyone else come across this issue?
This question is regarding Lightning Experience (formerly Lightning Desktop) and not Lightning Components.  The issue is that the Lightning Experience modal's interior content height does not seem to respect the Action's height nor appears to be settable anywhere.

In this simplified example, we have an Action that is set to a height of 750px that simply opens a VF page with some sample text.

User-added image

Instead of the contents of the modal being 750px (Action height) or the content height, you can see the scrollbars and small height.  Manually changing the 'cuf-content' element to a bigger height in developer tools shows the desired output.  We can't change the cuf-content element since this is 'outside' of the modal iframe.

User-added image

Is this an already known bug?  Any workarounds or different approaches? 

Hi All,

 

Still very new to apex and visualforce so back with basic questions that I can't find the answers to.  Thanks in advance for any help that can be offered.

 

I'm having an issue with a SOQL query in my extension controller.  Basically what I'm trying to do is a create a list of custom object records (pricing_exception__c) in an embedded visualforce page on the opportunity layout.

 

I have the section created fine in visualforce but I can't get the list to come back correctly.  My code is as follows.  The ????????? needs to essentially be account.name of the opportunity page I'm on but nothing I'm trying is producing a result.  I'm starting to wonder if it's not possible to do this with an embedded vf page in the opportunity layout?

 

public class retrievePEList {

public retrievePEList(ApexPages.StandardController controller) {

}

 

public List<Pricing_Exception__c> getExceptions() {
return [SELECT Name, Pricing_Exception__c.Account_Name__c, End_User_Account_Name__c, PE_Status__c, Exception_End_Date__c FROM Pricing_Exception__c
WHERE PE_Status__c = 'Approved' and Exception_End_Date__c > TODAY and ???????????

}
}

Hey Guys,

 

I have a requirement where: A contact already exists, they need a custom button that directs to a visual force page where I have a created a form that has a subset of fields on the contac they need to fill out. When they are done they save and need to update the contact.

 

So far I have completed:

1. Directing to the page

2. Querying the subset of contact fields in the controller that will be used in the page since we cannot use a standard controller

3. Built the page

Error 4. Updating the record using a page refrence

 

Here is the controller:

 

public class IntakeController{

public static Contact currentContact {get; set;}
public final Id cId {get; set;}


public IntakeController() {

cId = ApexPages.currentPage().getparameters().get('cid');
currentContact = new Contact();
currentContact = [SELECT
                  //All the fields
FROM Contact
WHERE Id =: cId];

}

public PageReference SaveContact(){
system.debug(currentContact);

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

PageReference returnPage = new PageReference('/' + cId);
returnPage.setRedirect(true); 
return returnPage; 
} 
}

 

Problem is everytime I go to save I get a null value for currentContact in that debug. I am updating the values of contact Record in the page using input fields. What am I doing wrong here, and how do I get the updated values from the page? 

 

Thanks

 

  • September 10, 2013
  • Like
  • 0

I'm a total newbie to writing controllers, but I would like to learn.

 

How do I sort a PageBlockTable?  I have read several posts on here and understand I need to use the ORDER BY statement but I'm lost how to implement it in a controller.

 

Please Help!

Hello,

I have the following trigger that is designed to change an Opportunity owner to a new account owenr after an account DLoader upsert. It compares the owners of Opportunity to new owenrs of accounts and users who share accounts (indicated by UserID inserted in SLS2__c upon account update).

 

The trigger works when I change account owners manually in SFDC, but does not work wehn I use that DataLoader to update ownership. It returns the following ERROR:

updateOppOwner: execution of AfterUpdate

caused by: System.NullPointerException: Attempt to de-reference a null object

Trigger.updateOppOwner: line 17, column 1.

 

Please help.

this is the trigger inserted in Account:Triggers

====

 

Line 17 : optyMap.get(acct.id).OwnerID= acct.OwnerID;

======

Full trigger:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

 

trigger updateOppOwner on Account (after insert, after update) {
  if (Trigger.isAfter) {
  Set<Id> acctIds = new Set<Id>();
    for (Account acct : Trigger.new) {
       acctIds.add(acct.Id);
       }     
Map<id,Opportunity> optyMap = new Map<Id,Opportunity>( [SELECT OwnerId  FROM Opportunity WHERE AccountId in :acctIds]);

    if ( !optyMap.isEmpty() ) {

    for (Account acct : Trigger.new) {

        for(Opportunity opty : optyMap.values() ) {      

            if(opty.OwnerId != acct.OwnerId && opty.OwnerId != acct.SLS2__c){

               optyMap.get(acct.id).OwnerID= acct.OwnerID;
                    } else {
          opty.OwnerId = opty.OwnerId ;
                   }
            }

        update optyMap.values();

        }
  }
    }
    }

  • February 15, 2013
  • Like
  • 0

Is it possible to concatenate two or more columns into a single field in the field mapping file when using data loader with batch mode?

And if so, what is the syntax?

 

Thanks

What kind, if any, limitations are set for Chatter External Users when using the REST API?

Hi,

 

How to populate a default value in <apex:inputText> .So that when user enters the text box ,the value should disapper.

(like <input type="text" placeholder="Search "  in html />).

 

Can anyone please suggest me on how to implement this in salesforce apex.

 

Thanks in advance.