• JeffStevens
  • NEWBIE
  • 200 Points
  • Member since 2011

  • Chatter
    Feed
  • 8
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 24
    Questions
  • 51
    Replies
I have a site, with a page, and a custom controller.  The custom controller need to write a flat to a custom object.  This all needs to be done anonymous.  When I do the insert from the APEX controller - I get the Authorization Required message.  I want this to happen all anonymous.

Is that possible?

Here is the example I got, but it triggers off of ONCLICK. I want to be able to use the JSRemoting to run an APEX class which would return data and ultimately the data would be shown on the first rendering of the visualforce page. I've tried a dozen different things, but no luck. What do I need to do to this code to get the desired result ...

 

<apex:page controller="MyJSRemoting">
<script type="text/javascript">
function getAccountJS() {
var accountNameJS = document.getElementById('accountname').value;

MyJSRemoting.getAccount( accountNameJS, function(result, event)
  {
    if (event.status)
    {
        document.getElementById("{!$Component.theBlock.pbs.pbsi2.accId}")
        .innerHTML = result.Id;
        document.getElementById("{!$Component.theBlock.pbs.pbsi1.name}")
        .innerHTML = result.Name;
   }
}, {escape:true});
}
</script>


<input id="accountname" type="text"/>

    <button onclick="getAccountJS();">Get Account</button>


      <apex:pageblock id="theBlock">
        <apex:pageblocksection columns="2" id="pbs">

               <apex:pageblocksectionitem id="pbsi1">
               <apex:outputtext id="name">
               </apex:outputtext>
        </apex:pageblocksectionitem>

        <apex:pageblocksectionitem id="pbsi2">
                  <apex:outputtext id="accId">
                   </apex:outputtext>
         </apex:pageblocksectionitem>

    </apex:pageblocksection>
</apex:pageblock>
</apex:page>

 

TIA, Mike

When I change the owner of a record, on the "Select New Owner" screen, there is a "Send Notification Email".  When the email is sent, I'm trying to change the FROM address of the email that is being sent.  

 

Is it an email template?

 

Thanks,

 

Jeff

When you click on Setup-Checkout Summary-Proceed to Checkout - you can see your account contact.  Does anybody know - is that account accessible from apex code somewhere?

 

Thanks,

 

Jeff

I have a managed package that was developed and published from one org with a namespace.  I would like to make some changes to that package, but really think that I shoud be making the changes in a "Development" org.  Then promote those changes to the "Production" org, then upload to the app exchange from there.  I might even want three org's ... Development ->  Pre-Production/Testing -> Production....

 

I'm having two issues and was wanting suggestions...

 

1) What's the best way to get a copy of the entire Production org down to a Development org?

 

2) Is there a standard or accepted way of controlling the development and publication process?

 

Thanks for your input.

 

Jeff

I have a dataTable like below.  I want a border between each column, AND I can do that for each line that is renderend in the table... BUT I have the "height:240px;" set in the style, and my borders don't go down for the entire height of the table.  

 

I've tried using the Frame, Rules, and ColumnClasses attributes - none of them seem to effect it at all.  Any suggestions?

 

Thanks,

 

Here is my markup...

<!-- Main Table -->
<apex:dataTable value="{!invoiceItems}" var="ii" cellPadding="5" cellspacing="0" width="750" style="border:1px solid black;height:240px;" headerclass="tableHeader" >
<apex:column headervalue="quantity" value="{!ii.quantity}" width="80" style="text-align:center;" />
<apex:column headervalue="description" value="{!ii.description}" width="350" />
<apex:column headervalue="ref.#" width="60" />
<apex:column headervalue="unit price" width="115" />
<apex:column headervalue="amount" width="145" style="text-align:right;" >
<apex:outputText value="{0,number,$##,##0.00}" >
<apex:param value="{!ii.amount}" />
</apex:outputText>
</apex:column>
</apex:dataTable>

When creating a deployment outbound change set, is there a way to include the email services?  Or do those have to be re-created in production manually?

 

Thanks

I've used Dan Boris sample at http://danlb.blogspot.com/2010/10/salesforcecom-rest-api.html to get my oAuth2.0 connecting, and calling a sample query with this code...

string results = HttpGet(token.instance_url + @"/services/data/v26.0/query?" + "SELECT Id,Name FROM Account", "");

 

And this is working just fine.   But if I want to call a webservice called sampleWS - how is that done?  It's not just like this is it?

 

string results = HttpGet(token.instance_url + @"/sampleWS", "");

 

thanks.

 

I use Chrome, and have been using the developer console for about 2 weeks now.  The code assist - just quit working yesterday.  Any thoughts on what happened?

 

Thanks,

Is there a way to find the current API count for the last 24 hours?

 

I have plans to do some testing, where I want to get the current API count for the last 24 hours, and run some stuff, then get the count again.

 

Thanks,

 

Jeff

I have a quote that is synced, but when I try to add a Quote Line Item - I get "An internal error occured during:" (details = java.lang.NullPointerException) .  I'm just running it under Execute-Anonymous.  If I stop the Sync - it runs just fine.  I do have triggers on my Quote/QLI and Opportunity/OLI - but I have all four of them InActive right now. Here is my code...

 

PriceBookEntry PBEtax = [SELECT Id FROM PriceBookEntry WHERE Product2.Name = 'Tax' LIMIT 1];
system.debug('PBEtax='+PBETax);

List<QuoteLineItem> QLIsToUpdate = new List<QuoteLineItem>();

QuoteLineItem QLI = new QuoteLineItem();
QLI.Quantity = 1;
QLI.UnitPrice = 5.00;
QLI.PricebookEntryId = PBETax.Id;
QLI.Total_Price__c = 5.00;
QLI.QuoteId = '0Q0Z00000008XLb';
QLIsToUpdate.add(QLI);


system.debug('QLIsToUpdate='+QLIsToUpdate);
upsert QLIsToUpdate;

 

Any thoughts?

 

Thanks,

Jeff

 

I have a Quote template.  It looks pretty good when building the page, but when I do a Save and Preview, or when I actually select it and generate a PDF, there is no formatting.  All of the fields are in the left hand column, with the field label on one line, and the field value on the next line.  I've tried it in IE and Chrome - same result.

 

Anybody else have that issue?

 

Thanks.

I keep getting this error...

Content cannot be displayed: Not Serializable: ApexPages.Message

 

I have This in my controller extension...

public  ApexPages.Messagemsg{get;set;}

...

msg = new ApexPages.Message(ApexPages.Severity.WARNING, 'Must have a Re-Formatted file first...');
ApexPages.addMessage(msg);

 

And I have this in my markup...

<apex:Messages />

 

Do I have to create a custom exception message?  Or is there another way to display a custom error message?

 

Thanks


Could I get simple example of how to loop through a multi-select picklist field?

 

Thanks!

I have contract expiration notice turned on for account and contract owners.  However, I would like my Office manager to get notified instead of the contract owner.  Is that possible?  Or would I need to create a specific apex class to do it?

 

Thanks

The contract has the CustomerSigned field that is the ID to a contact.  However in my SOQL - I can't seem to figure out the relationships, etc.

 

I have this...

 

ctrcList = [SELECT ContractNumber,
CustomerSignedId,
CustomerSignedId__r.name,
CustomerSignedDate
FROM Contract];

 

But I get the error "Didn't understand relationship 'CustomerSignedId__r'"

 

I'm trying to get the relationship info from the CustomerSignedId off of the contract. 

 

Any thoughts?

 

Thanks

 

I know that you can render a VF page as excel by using the contentType attribute on the Page tag. 

 

My page has selection criteria at the top and a table of information at the botton. But I don’t want to have to re-create the entire page (or even the table information) , and maintain two pages that are basically the same.  So, I’m wondering if somehow custom Components can be used?

 

Has anybody done this?  Any examples?

 

Thanks

I'm using Fore.com Explorer to test this soql...

 

Select RL_Batch_Line_Number__c, count(Id)
    from rebate_History__c  
    Where RL_Batch_Number__c = 999
    group by RL_Batch_Line_Number__c
    Having Count(Id) > 1

 

But I get a malformed query Error at my "group by" clause.

 

Anybody know what I might be doing wrong?

I have an Aggregateresult that I'm displaying like this...

 

<apex:column headervalue="Revenue">
<apex:outputText value="${!ar['revenue']}"/>
</apex:column>

 

But the output is always displayed with only one decimal place.  How can I get it to display two decimal places?

 

Thanks.

I have a goup of users that have read only access to certian types of accounts - but I don't want them to see or have access to the contracts for those types of accounts.  I have removed the contract from their page layout.  However when they go to the contracts tab they still have access to the contract there.  

 

Is there a way to restrict access to certian types of contracts?

 

Thanks,

I'm trying to write a class that will delete all records in a custom object with a specific status.  Can't seem to get pass the syntax.

 

I've got this...

 

public with sharing class DeletePostedToHistory{

 

List<CustomObj__c> CustomObj = [

select status__c  

from CustomObj__c  

where status__c = 'Posted to History'];  

 

delete CustomObj;

 

}

 

But I get the error "expecting right curly bracket, found 'delete'

 

What am I missing here?

 

Thanks,



 

 

I need to get the actual Parent ID from the Account object while querying a custom child object.  

 

I have an existing soql that looks like this...

 

// Build IDNumber list

Map<String,ID_Number__c> IDNumbers = new Map<String,ID_Number__c> (

    [select ID__c, Parent_Rate__c ),

    from ID_Number__c

    Where ID__c IN :idsToQuery] );

 

 

 

When I try this - I get an "enexpected token; 'from' error...

 

Map<String,ID_Number__c> IDNumbers = new Map<String,ID_Number__c> (

    [select ID__c, Parent_Rate__c ), (Select Parent, from Account),

    from ID_Number__c

    Where ID__c IN :idsToQuery] );

 

Any guidance?

 

Thanks!

Could I get simple example of how to loop through a multi-select picklist field?

 

Thanks!

Hi

I am having a custom object as master object and a child object.which is similar to opportunity and opportunity products.(custom master object,custom child object)
I am using them in Visualforce email template.
But i am not able to get that.
I want to show line items of custom child object when i send email
here is my code.How can i call line items on This template.
Please help me where i am going wrong
<messaging:emailTemplate subject="customobjectlineitems: {!relatedto.Name}" 
        recipientType="User" 
        relatedToType="master custom object (LIKE OPPORTUNITY)">

<messaging:htmlEmailBody >        
    <html>
        <body>
         
         <font face="arial" size="2">
         <p>List of products related to the Custom master object:<b> {!relatedTo.name}</b>.</p>  
         <p/>                  
         <table border="0" >
           <tr> 
            <th>Name</th>
             <th>Unit Price</th>
               <th>Total Price</th>
           </tr>
           <apex:repeat var="co" value="{!relatedTo.child custom object (LIKE OPPORTUNITYLINEITEMS)}">

//ERROR HERE  because i am using line items wrong here NOt sure how can i.

               <tr>
               <td>{!co.Name)}</td>
               <td>{!(co.UnitPrice)}</td>
               <td>{!(co.TotalPrice)}</td>
               </tr>
           </apex:repeat>                 
         </table>
       <p/>
     </font>
    </body>
    </html>
</messaging:htmlEmailBody> 
       
</messaging:emailTemplate>



 
I have a site, with a page, and a custom controller.  The custom controller need to write a flat to a custom object.  This all needs to be done anonymous.  When I do the insert from the APEX controller - I get the Authorization Required message.  I want this to happen all anonymous.

Is that possible?
Whenever a new contact is created for a account update the corresponding account phone with the new contact??

trigger updatephonenocontact on Account (After insert) {

    List <Contact> Con = new List <Contact>();

    For (Account A: Trigger.new){

    Contact C = new Contact();
 
    C.phone= A.phone;

    C.AccountId = A.Id;
    
    Con.add(C);

    }

    

    Insert Con;

}
 im getting this error message 
Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger updatephonenocontact caused an unexpected exception, contact your administrator: updatephonenocontact: execution of AfterInsert caused by: System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Last Name]: [Last Name]: Trigger.updatephonenocontact: line 19, column 1
Hi All,

I am having a requirement to integrate QuickBooks online with Salesforce. In this, I am successfully getting authorized from Salesforce to my app on QuickBooks. I am using version V1 to getting request token and access token, secret credentials. But, when I am trying to make a request to getting all Accounts from QuickBooks app with using V3, got the Authentication error: Unauthorized. If anyone faces this type of exception and got success to make request from SF to QB please help me to getting out from this exception.

Thanks in advance!

When I change the owner of a record, on the "Select New Owner" screen, there is a "Send Notification Email".  When the email is sent, I'm trying to change the FROM address of the email that is being sent.  

 

Is it an email template?

 

Thanks,

 

Jeff

I have a dataTable like below.  I want a border between each column, AND I can do that for each line that is renderend in the table... BUT I have the "height:240px;" set in the style, and my borders don't go down for the entire height of the table.  

 

I've tried using the Frame, Rules, and ColumnClasses attributes - none of them seem to effect it at all.  Any suggestions?

 

Thanks,

 

Here is my markup...

<!-- Main Table -->
<apex:dataTable value="{!invoiceItems}" var="ii" cellPadding="5" cellspacing="0" width="750" style="border:1px solid black;height:240px;" headerclass="tableHeader" >
<apex:column headervalue="quantity" value="{!ii.quantity}" width="80" style="text-align:center;" />
<apex:column headervalue="description" value="{!ii.description}" width="350" />
<apex:column headervalue="ref.#" width="60" />
<apex:column headervalue="unit price" width="115" />
<apex:column headervalue="amount" width="145" style="text-align:right;" >
<apex:outputText value="{0,number,$##,##0.00}" >
<apex:param value="{!ii.amount}" />
</apex:outputText>
</apex:column>
</apex:dataTable>

we have a workflow rule in the account object that triggers an email alert when 

Account status='new'

But i would like to add the product name in this to workflow rule.

As i can't directly include the product name from the account as each account has multiple opportunities and each opp has multiple products, i am thinking of creating a look up of product in the account(in this case i guess that can only be one product

mapped which can be populated with a mass update)

 

any best solutions for this!

 

Thanks!

How can I access the first element in a set?  Example in a list, you can use this to get the first element in the list  

 

Integer x = xList.get(0);

 

What would be a quick equivalent way of doing this in a set?

Hello !

 

I have begun a trigger to copy on the Actions page (Opportunity page) ,the picklist values of 3 fields from the Account related list

 

But I meet troubles to do the mapping.

 

I can't map the AccountId field from Oppty(Actions), I have the following error :

 

Error: Compile Error: Illegal assignment from Schema.SObjectField to String at line 30 column 10 

 

Here here my code... I have done my best using other existing triggers in my org but it is probably wrong...

 

Trigger UpdateIndustrySegmentSubSegment on Opportunity (Before insert,Before Update) 
{
    // Initialise ID maps for related sObjects
    map<Id, Account> mapAccount   = new map<Id, Account>();
    
    // Fill the Id -- > sObject maps for Accounts
  for(Account[] arrAccount: [
                                    select  Id,
                                            Name,industry__c,segment__c,sub_segment__c
                                    from    Account
                                   where   id in :mapAccount.keySet()
                                ])
   {
        for(Account sAccount : arrAccount)
        {
            mapAccount.put(sAccount.Id, sAccount);
        }
    }
    
   for(Opportunity sOppty : trigger.new)
    {
        
        Account  thisAccount   = mapAccount.get(sOppty.Account.Id);
 
        if(
        sOppty.Business_group__c == 'Amcor Flexibles Europe & Americas' && 
        //thisAccount.industry__c != null && 
        sOppty.RecordTypeId != '012200000002HdgAAE')
        
        {sOppty.industry__c = Account.industry__c;
        sOppty.segment__c = Account.segment__c;
        sOppty.sub_segment__c = Account.sub_segment__c;}
  
    }
}

 Thanks a lot for your help

Is there a way to find the current API count for the last 24 hours?

 

I have plans to do some testing, where I want to get the current API count for the last 24 hours, and run some stuff, then get the count again.

 

Thanks,

 

Jeff

how to write a condition in child class

which will bases the datamember in parent class

I am trying to update the field: IsUnreadByOwner - when a lead status changes to: Unqualified.

 

this is my trigger:

trigger UnqualifiedLead on Lead (before update) {
	for(Lead lead: Trigger.new)
	{
		if (lead.Status == 'Unqualified')
		{
			lead.IsUnreadByOwner = false;	
			update lead;
		}
	}
}

 

And my trigger:

@isTest
private class UnqualifiedLeadTest {

    static testMethod void myUnitTest() {
        // Setup the lead record
        Lead lead = new Lead();
        lead.LastName = 'last';
        lead.FirstName = 'First';
        lead.Company = 'Company';
        lead.Status = 'Unqualified';
        insert lead;
        lead.IsUnreadByOwner = True;
        update lead;
    }
}

 

i have a feeling, that the "update lead;" line is wrong, but not sure how to check if the change works.

 

Appreciate the help.

 

This is the error log I get

 

*** Deployment Log ***
Result: FAILED
Date: July 17, 2012 5:49:07 PM IDT

# Deployed From:
   Project name: Email2Lead
   Username: saar....@.com
   Endpoint: www.salesforce.com

# Deployed To:
   Username: saar.....@.com
   Endpoint: www.salesforce.com

# Deploy Results:
   File Name:    package.xml
   Full Name:  package.xml
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    triggers/UnqualifiedLead.trigger
   Full Name:  UnqualifiedLead
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

# Test Results:

Run Failures:
  UnqualifiedLeadTest.myUnitTest System.DmlException: Update failed. First exception on row 0 with id 00QD000000VgQJHMA3; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, UnqualifiedLead: execution of BeforeUpdate

caused by: System.SObjectException: DML statment cannot operate on trigger.new or trigger.old

Trigger.UnqualifiedLead: line 7, column 1: []

 

Hi All,

 

I have written two apex classes in sandbox. Code for both the classes are similar except  type being differnet. I have two types of opportunities ie. recurrig and non-recurring. So the only difference in code is for type of opportunity. Rest of the code is same for both the classes.They are working fine in sandbox. But when I deploy these to production, One class

works well but for the other I get an error saying "Attempt to derefernce a null object".

 

I am unable to understand why I am getting this error when it is working fine in sandbox .Can someone please give me some pointer/reason why I am getting this error and solution.

 

Thanks,

Alok

I want to know if a test method can execute two triggers.

My test class should test a trigger after insert lead but to test this, i should insert account and i have a trigger after insert account too.

I feel that only the first trigger run.

Can you help me to understand ? 

  • July 17, 2012
  • Like
  • 0

Hello Everyone, i want to create an archive of a custom object, so is it posible? , if YES then How can we make that?

  • July 17, 2012
  • Like
  • 0

Hi,

 

Is it possible to get to know the new Owner of the new created Objects Account/Contact in a trigger while a lead is being converted?

 

In the After/Before Insert Trigger of Account/Contact the OwnerID is set to the Owner of the Lead.

In After/Before Update Trigger of Lead, if I try to query Accounts/Contacts OwnerID (Using [SELECT OwnerID from Account where ID=:ConvertedAccountID]), I still get the ID of the user that owns the Lead, not the new User.

The After/Before Update Trigger of Account/Contact is NOT executed.

 


Any Ideas/Help?

Hi,

 

Up front I do not see any scheduled job reporting capabilities--bummer!

 

So I thought what a great opportunity for me to write some code and iterate through the CronTrigger table--bummer again!


To be specific my goal is to be able to report on all scheduled reports that are a year from reaching the scheduled end date.  Thr ConTrigger object does not seem to have a field for what is scheduled, be it a report or an apex class.

 

Is there any undocumented information for a possible hidden field that gives me this information on the CronTrigger object?

 

I see this is a big issue and high maintenance because you can only schedule 5 years out.  If you are not baby-sitting these jobs then you could potentially code or reports that stop running!

 

Any support on this would be appreciated very much.

 

 

HI, I made a managed package and uploaded it to appexchange.I upgraded it many times.Yesterday evening(at 1 st March 2011, 6 pm Indian time) also I upgraded the managed package with a bug fix. I am able to install the package in a developer edition successfully. But while I was installing the same package in enterprise edition, I got this error 

"Package Not Found 
The requested package does not exist or has been deleted. Please contact the package publisher for assistance. If this is a recently uploaded package, please try again soon. " 

After that I tried many times, I got the same error. After 20 hrs also I am getting the same error. 

Another thing is, now I am unable to install the same package in developer edition also. Because I am getting the same error.But I was installed the same package successfully once yesterday. 

 

 

Please help me. I am unable to find any info related to this.

 

Thanks,

Naresh