• J Dove
  • NEWBIE
  • 15 Points
  • Member since 2015
  • Database Manager
  • Rare


  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 3
    Replies
Hi there,

I am trying to use Ant to deploy metadata and I'm running across an error that I cannot for life of me resolve. I get this error when trying to deploy a QuickAction:
Error: Target object does not have a valid lookup or master-detail reference to the parent object
The QuickAction just creates a child Campaign object. I get the exact same metadata set up when I create a QuickAction in the UI and then pull down the metadata. The relevant portion of the metadata looks thusly:
<targetObject>Campaign</targetObject>
<targetParentField>Parent</targetParentField>
<type>Create</type>
Clearly Campaign has a lookup to itself. I've double-checked permissions to make sure my user has access to it, which it does. I can't think of anything else to look for and the Internet has been no help, so far. I'd appreciate any guidance.

Thank you!
  • October 16, 2017
  • Like
  • 1
I'm getting an error when checking the Using Visualforce Pages in Page Layouts and Mobile Cards challenge. The error says that the page isn't evaluating the 'Prospecting' stage, yet the code works when I insert an Opportunity Id where the Stage = Prospecting.

The code:
<apex:page docType="html-5.0" standardController="Opportunity">
    <style>
    </style>
    
    <apex:remoteObjects >
        <apex:remoteObjectModel name="Opportunity" fields="Id,StageName" />
    </apex:remoteObjects>
    
    <div class="myPage">
        <h2>Tip for when you're in the {!Opportunity.StageName} Stage:</h2>
        <p id="stageTip" />
    </div>
    
    <script>
        var opportunityStage = "{!Opportunity.StageName}";
        document.getElementById("stageTip").innerHTML = createStageTip();
        
        function createStageTip() {
            if(opportunityStage){
                switch(opportunityStage){
                    case "Prospecting":
                        return "You need to ask really good questions"
                        break;
                    case "Needs Analysis":
                        return "Determine the needs by asking really good questions"
                        break;
                    case "Proposal/Price Quote":
                        return "Make sure the price doesn't exceed the budget"
                        break;
                    case "Negotiation/Review":
                        return "Maybe go down, but don't go down too much"
                        break;
                    default:
                        return "Use your best judgement";
                }
            }
        }
    </script>
</apex:page>
If you have any ideas as to why this isn't working, I'd love to hear them.

Cheers,
Justin
 
  • December 07, 2015
  • Like
  • 1
I'm getting an error when checking the Using Visualforce Pages in Page Layouts and Mobile Cards challenge. The error says that the page isn't evaluating the 'Prospecting' stage, yet the code works when I insert an Opportunity Id where the Stage = Prospecting.

The code:
<apex:page docType="html-5.0" standardController="Opportunity">
    <style>
    </style>
    
    <apex:remoteObjects >
        <apex:remoteObjectModel name="Opportunity" fields="Id,StageName" />
    </apex:remoteObjects>
    
    <div class="myPage">
        <h2>Tip for when you're in the {!Opportunity.StageName} Stage:</h2>
        <p id="stageTip" />
    </div>
    
    <script>
        var opportunityStage = "{!Opportunity.StageName}";
        document.getElementById("stageTip").innerHTML = createStageTip();
        
        function createStageTip() {
            if(opportunityStage){
                switch(opportunityStage){
                    case "Prospecting":
                        return "You need to ask really good questions"
                        break;
                    case "Needs Analysis":
                        return "Determine the needs by asking really good questions"
                        break;
                    case "Proposal/Price Quote":
                        return "Make sure the price doesn't exceed the budget"
                        break;
                    case "Negotiation/Review":
                        return "Maybe go down, but don't go down too much"
                        break;
                    default:
                        return "Use your best judgement";
                }
            }
        }
    </script>
</apex:page>
If you have any ideas as to why this isn't working, I'd love to hear them.

Cheers,
Justin
 
  • December 07, 2015
  • Like
  • 0
I'm trying to execute an Apex method through the anonymous execution via Developer Console. The class basically mimics navigating to a V-force page and clicking a button. However, I'm trying to get out of hitting the too many SOQL queries error that frequents me when doing bulk operations with the Process Builder.

I know this isn't a best practice. It's just a temporary solution to get me out of having to click a button 30 times. The irony is that the amount of time it's taken me to solve the issue, I could've clicked the button 60 times. But, the principle, man! 

 My code is thus:
public class ManualScorecardSend { 
    public void sendScorecard() { 
        Rare_Campaign__c [] cResults = [SELECT Id FROM Campaign__c where Status__c = 'Active' AND Program__r.Name IN ('SomeProgram')]; 

        For (Campaign__c c: cResults) { 
            SetupNewScoreCardExtension setupnsc = new SetupNewScoreCardExtension(new ApexPages.StandardController(c)); 
            setupnsc.SendScorecard(); 
        }
    } 
} 

ManualScorecardSend mss = new ManualScorecardSend(); 
mss.sendScorecard();


Every time I execute this code I get the 'too many SOQL' queries error from Process Builder. But if I go to the V-force page for each Id and kick off the process manually, it works fine.

Could it be that even though it's not a bulkified operation the flows are getting kicked off too quickly and thus hitting limits? I thought about adding a sleep method to slow things down a bit. 

Also, I tested this limiting the query to just one result and it worked fine. It's only when I try it with all resuls (~ 60 records total) that I get errors.

Please let me know if you have any questions or need more information.
Hi there,

I am trying to use Ant to deploy metadata and I'm running across an error that I cannot for life of me resolve. I get this error when trying to deploy a QuickAction:
Error: Target object does not have a valid lookup or master-detail reference to the parent object
The QuickAction just creates a child Campaign object. I get the exact same metadata set up when I create a QuickAction in the UI and then pull down the metadata. The relevant portion of the metadata looks thusly:
<targetObject>Campaign</targetObject>
<targetParentField>Parent</targetParentField>
<type>Create</type>
Clearly Campaign has a lookup to itself. I've double-checked permissions to make sure my user has access to it, which it does. I can't think of anything else to look for and the Internet has been no help, so far. I'd appreciate any guidance.

Thank you!
  • October 16, 2017
  • Like
  • 1
I'm getting an error when checking the Using Visualforce Pages in Page Layouts and Mobile Cards challenge. The error says that the page isn't evaluating the 'Prospecting' stage, yet the code works when I insert an Opportunity Id where the Stage = Prospecting.

The code:
<apex:page docType="html-5.0" standardController="Opportunity">
    <style>
    </style>
    
    <apex:remoteObjects >
        <apex:remoteObjectModel name="Opportunity" fields="Id,StageName" />
    </apex:remoteObjects>
    
    <div class="myPage">
        <h2>Tip for when you're in the {!Opportunity.StageName} Stage:</h2>
        <p id="stageTip" />
    </div>
    
    <script>
        var opportunityStage = "{!Opportunity.StageName}";
        document.getElementById("stageTip").innerHTML = createStageTip();
        
        function createStageTip() {
            if(opportunityStage){
                switch(opportunityStage){
                    case "Prospecting":
                        return "You need to ask really good questions"
                        break;
                    case "Needs Analysis":
                        return "Determine the needs by asking really good questions"
                        break;
                    case "Proposal/Price Quote":
                        return "Make sure the price doesn't exceed the budget"
                        break;
                    case "Negotiation/Review":
                        return "Maybe go down, but don't go down too much"
                        break;
                    default:
                        return "Use your best judgement";
                }
            }
        }
    </script>
</apex:page>
If you have any ideas as to why this isn't working, I'd love to hear them.

Cheers,
Justin
 
  • December 07, 2015
  • Like
  • 1
Hello, 
We create a case to track purchases. I would like to update contact fields such as date first purchased, date last purchased, first license #, last license # etc. using the information from the case. How would I go about it? I am new to SOQL but I think something like this may work.

1) Get all the contacts with the purchases
2) For each contact 
  1. Get all the cases for purchases 
  2. Use Min (Created Date) and Max(Created Date) for first and last purchases
  3. Find the License info for case with Min (Created Date) and Max(Created Date)
  4. Set the values on the contact fields
3) Update the list of  contacts 

After the one time update, I plan to use triggers for future purchases.

Thanks in advance.

Regards,
Yogesh
 
We are trying to test some funcitonality and found that the below snippet of code, when executed anonymously, can have different results. When executed on a sandbox using Developer Console, we get an error, saying that it is impossible to do this. But when executed anonymously through the Illuminated Cloud plugin from IntelliJ we get the result 'Success'. 
// Create account
Account a = new Account(Name = 'Donald Duck');
Database.insert(a);
// create contact and relate to account
Contact ct = new Contact(FirstName = 'Donald', LastName = 'Duck', AccountId = a.Id);
Database.insert(ct);

// get recordtype Id
RecordType rt = [SELECT Id FROM RecordType WHERE IsPersonType = true And SobjectType = 'Account'];
// set record type id to person account
Account acc = [SELECT Id, RecordTypeId FROM Account WHERE Id = :a.Id];
acc.RecordTypeId = rt.Id;
// update account to person account
Database.update(acc);
Anyone any ideas why this might happen? 
 
I'm getting an error when checking the Using Visualforce Pages in Page Layouts and Mobile Cards challenge. The error says that the page isn't evaluating the 'Prospecting' stage, yet the code works when I insert an Opportunity Id where the Stage = Prospecting.

The code:
<apex:page docType="html-5.0" standardController="Opportunity">
    <style>
    </style>
    
    <apex:remoteObjects >
        <apex:remoteObjectModel name="Opportunity" fields="Id,StageName" />
    </apex:remoteObjects>
    
    <div class="myPage">
        <h2>Tip for when you're in the {!Opportunity.StageName} Stage:</h2>
        <p id="stageTip" />
    </div>
    
    <script>
        var opportunityStage = "{!Opportunity.StageName}";
        document.getElementById("stageTip").innerHTML = createStageTip();
        
        function createStageTip() {
            if(opportunityStage){
                switch(opportunityStage){
                    case "Prospecting":
                        return "You need to ask really good questions"
                        break;
                    case "Needs Analysis":
                        return "Determine the needs by asking really good questions"
                        break;
                    case "Proposal/Price Quote":
                        return "Make sure the price doesn't exceed the budget"
                        break;
                    case "Negotiation/Review":
                        return "Maybe go down, but don't go down too much"
                        break;
                    default:
                        return "Use your best judgement";
                }
            }
        }
    </script>
</apex:page>
If you have any ideas as to why this isn't working, I'd love to hear them.

Cheers,
Justin
 
  • December 07, 2015
  • Like
  • 1