• Dan1126
  • NEWBIE
  • 50 Points
  • Member since 2015

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 11
    Replies
I can't figure out why this validation rule isn't working.  I want to make it so that if C4A or C4A Single-Channel is selected from my "Product" pick list, then the opportunity cannot move past the "Qualified" stage when "N/A" is selected from the "Product Engineer" picklist.  I also only want this to apply only to the record type "Sales".  But for some reason, when I apply this validation rule, I get the error message even when I'm in the Qualified stage.  

Here are the picklists I have, including what fields are available for each pick list:

Product:  C4A, C4A Single-Channel, C4N
Product Engineer:  N/A, (then multiple product engineers)
Opportunity Stages:  Qualified, Scoping/Presentation, Negotiation/Proposal, In Contract, Closed Won, Closed Lost
Record Type: Sales

Here is my validation rule:

And (
ISPICKVAL(Product_Engineer__c, "N/A"),
($RecordType.Name = "Sales"),
OR (
ISPICKVAL(Product__c, "C4A"),
ISPICKVAL(Product__c, "C4A Single-Channel"),
OR ( 
ISPICKVAL(StageName, "Scoping/Presentation"),
ISPICKVAL(StageName, "In Contract"),
ISPICKVAL(StageName, "Negotiation/Proposal"))))
Hey everyone,

I am trying to use JavaScript Remoting to return a dynamic Visualforce component. My use case is that a user can select from a variety of actions, each corresponding to a pre-defined Visualforce Component. Once they select an action the component should be rendered dynamically. When I attempt this, nothing is returned and I receive the following error in the browser's console: Visualforce Remoting Exception: Internal Service Error: java.lang.NullPointerException (342168595-56884 (1246936158)). I've also attempted to return the Component directly from the JS Remoting method, which generated the same error. 

Does anyone know what I might be doing wrong? Or if there is an alternative way of accomplishing this task (generating a specific Visualforce component from a user click)?

Here is my code: 

Visualforce Page:
<apex:page controller="PageCtrl">
    <script type="text/javascript">
        var openComponent = '{!$RemoteAction.PageCtrl.openComponent}';

        function open() {
            Visualforce.remoting.Manager.invokeAction(
                openComponent,
                function(result, event) {
                    console.log(result);
                    console.log(event);
                }
            );
        }
    </script>

    <apex:dynamicComponent componentValue="{!selectedComponent}" />
</apex:page>

Page Controller:
public with sharing class PageCtrl
{
    public static ApexPages.Component serviceActionComponent {get; set;}

    @RemoteAction
    public static void openComponent()
    {
        selectedComponent = new Component.ExampleComponent();
    }
}

Thanks in advance for any help. 
 
Hello,

I'm building a Visualforce page with some JavaScript to build a content DataTable based off the following example:
http://www.verticalcoder.com/2014/11/21/datatables-in-visualforce-part-1/

This page works well and looks great in Salesforce, but when I try to open it in the community it looks like the JavaScript is not working. The page references the same public static resource file, so I'm not sure why this would work in Salesforce and not the community.

Any help would be greatly appreciated. 

Thanks!
Hey everyone,

I am trying to use JavaScript Remoting to return a dynamic Visualforce component. My use case is that a user can select from a variety of actions, each corresponding to a pre-defined Visualforce Component. Once they select an action the component should be rendered dynamically. When I attempt this, nothing is returned and I receive the following error in the browser's console: Visualforce Remoting Exception: Internal Service Error: java.lang.NullPointerException (342168595-56884 (1246936158)). I've also attempted to return the Component directly from the JS Remoting method, which generated the same error. 

Does anyone know what I might be doing wrong? Or if there is an alternative way of accomplishing this task (generating a specific Visualforce component from a user click)?

Here is my code: 

Visualforce Page:
<apex:page controller="PageCtrl">
    <script type="text/javascript">
        var openComponent = '{!$RemoteAction.PageCtrl.openComponent}';

        function open() {
            Visualforce.remoting.Manager.invokeAction(
                openComponent,
                function(result, event) {
                    console.log(result);
                    console.log(event);
                }
            );
        }
    </script>

    <apex:dynamicComponent componentValue="{!selectedComponent}" />
</apex:page>

Page Controller:
public with sharing class PageCtrl
{
    public static ApexPages.Component serviceActionComponent {get; set;}

    @RemoteAction
    public static void openComponent()
    {
        selectedComponent = new Component.ExampleComponent();
    }
}

Thanks in advance for any help. 
 
I have the below class that updates the status on an agreement request and it's associated agreeemnt (parent record). It is giving me the below error and I can't figure out why. This is my first time using 'try' so im not sure if i am using it correctly or not. Thanks in advance for the help. 
 
public class SubmitUpdateToLegal {
 
try{
    // Query for the agreement request, which has been associated with an agreement.
    Agreement Request queriedAR = [SELECT Agreement_Request__c.Master_Agreement__c 
                              FROM Agreement_Request__c 
                              WHERE Master_Agreement__c != ''
                              ];

    // Update the agreement requests's status
    queriedAR.Status__c = 'Update from Opportunity';

    // Update the related agreement's status
    queriedAR.APTS_Agreement.Apttus__Status__c = 'Update From Opportunity	';

    // Make two separate calls 
    // 1. This call is to update the agreement request's status.
    update queriedAR;
    // 2. This call is to update the related agreement's status field.
    update queriedAR.APTS_Agreement; 
} catch(Exception e) {
    System.debug('An unexpected error has occurred: ' + e.getMessage());
}
}

 
Hi - I am trying to execute the following code

public class AccountHandler {
public static Account insertNewAccount(String name) {
Account a = new Account();
a.Name = name;
try
{
insert a;
} catch (Exception e) {
return null;
}
return a;
}
}

i tried executing it in anonymous window as below :

AccountHandler.Account insertNewAccount(String name);

I would need some help on this . Please let me know if the way i execute in anonymous window is correct .

Thanks!!
  • January 22, 2016
  • Like
  • 0
Hi there,

I'm quite new to Apex Triggers, so just trying to find my feet here.

On the Campaign object we have a lookup to a custom object called 'Course Templates'. We also have a lookup on the Campaign object to another custom object called 'Course Archives'.

All of the 'Course Template' records have duplicates 'Course Archive' records. So - for example - the Course Template record 'Acting - Beginners' has a Course Archive equivalent (also called 'Acting - Beginners').

The trigger below is intended to populate the Course Archive lookup on the Campaign, using the name of the Course Template. The error I'm receiving seems to suggest that I actually need the ID of the record in order to input into this lookup field, but I only have the name of the record.
 
trigger CourseArchiveInclusion on Campaign (before insert, before update) { 
    for (Campaign c : Trigger.new) {
        if(c.status != null && (c.Status.equals('Completed') ||  c.Status.equals('Cancelled'))){
            c.course_archive__c = c.Template_Name_for_Archive__c;
        }
    }
}

Is there a workaround for this?

Many thanks.
 
I want to automatically create a new record in custom Object B when a specific record type is selected in  custom Object A. How would I go about doing this? Please help
User-added image
Not able to cover the else block.Below is the test Class

@isTest
public class TestConTrigg 
{
    static testmethod void testFun()
    {
        account acc = new account();
        acc.name ='less';
        insert acc;
        
        contact con = new contact();
        con.lastname = 'ram';
        con.password__c = 'sdaf';
        con.Accountid = acc.Id;
        insert con;
        
        account acc1 = new account();
        acc1.name ='less';
        insert acc1;
        
        contact con1 = new contact();
        con1.Accountid = acc1.Id;
        con1.account.name = con1.lastname = ' ';
        con1.password__c = 'sdaqwe';
        update con1;
    }    
}
I want to capture Chatter's LIKE event in Apex. Is there any way to achieve it. Any solution(s)?
I am creating a demo for an interview and I have to create custom fields for Accounts, Contacts and Opps, 2 fields per object.

1 of the 6 custom fields has to be a Lookup Relationshop. I know how to do this technically, however when I do it I find it redundant since in the Lookup relaitonship I have to chose a standard object and all standard objects seem to already be linked. Am I missing something.

For example, I can create a custom Lookup relationship field in Opportunity and pick a Contact. But there is already standard functionality that does that.

Please advise
Hello-

Was hoping someone could help me. Currently, I'm unable to deploy code as Salesforce reports insufficient code coverage.

Specifically, I have a trigger called 'ResourceTrigger'. The Developer's console reports 87% code coverage on this class. Picture below.

User-added image

But when I attempt to deploy (or validate the deployment of the trigger), the system prevents me from deploying, saying I have zero percent coverage for ResourceTrigger. This is contradictory.

User-added image

Any ideas or help is appreciated.
I can't figure out why this validation rule isn't working.  I want to make it so that if C4A or C4A Single-Channel is selected from my "Product" pick list, then the opportunity cannot move past the "Qualified" stage when "N/A" is selected from the "Product Engineer" picklist.  I also only want this to apply only to the record type "Sales".  But for some reason, when I apply this validation rule, I get the error message even when I'm in the Qualified stage.  

Here are the picklists I have, including what fields are available for each pick list:

Product:  C4A, C4A Single-Channel, C4N
Product Engineer:  N/A, (then multiple product engineers)
Opportunity Stages:  Qualified, Scoping/Presentation, Negotiation/Proposal, In Contract, Closed Won, Closed Lost
Record Type: Sales

Here is my validation rule:

And (
ISPICKVAL(Product_Engineer__c, "N/A"),
($RecordType.Name = "Sales"),
OR (
ISPICKVAL(Product__c, "C4A"),
ISPICKVAL(Product__c, "C4A Single-Channel"),
OR ( 
ISPICKVAL(StageName, "Scoping/Presentation"),
ISPICKVAL(StageName, "In Contract"),
ISPICKVAL(StageName, "Negotiation/Proposal"))))