• SeAlVa
  • SMARTIE
  • 1295 Points
  • Member since 2011

  • Chatter
    Feed
  • 48
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 228
    Replies
Can someone help me with this compile error?  I'm not a developer and this is my first time to try and create a trigger.  I was given some sample code and modified it just a little bit.  For the life of me, I can't see what might possibly be wrong with line 3.

User-added image
I have a before update trigger on Opportunity where I am avoiding a SOQL for loop using the example at https://developer.salesforce.com/page/Best_Practice:_Avoid_SOQL_Queries_Inside_FOR_Loops. Before I did this and used for(Opportunity o: trigger.new), the code worked fine (except, of course, on my load tests, which caused me to change this).

List<Opportunity> oppsWithOLIs = [select id, IsWon, Assets_Created__c,(select id from OpportunityLineItems where
                                  (product2.family = 'Subscription'or product2.family = 'Support'))
                                   from Opportunity  where Id in :Trigger.newMap.keySet()];

The problem is, my IsWon is returning as false when I'm changing the stage to a Won stage and returning as true when I'm change from a Won stage to an Open stage. I've tried using stagenames too and it keeps returning the old value. With Trigger.newMap, shouldn't it be returning the newly set value?

The other issue I'm running into is that in the for loop (for Opportunity o: oppsWithOLIs), I'm trying to set the opp value Assets_Created__c to true and this is not happening. However, the rest of the code where I do a for loop on the OLIs, add to a list and then outside of a loop add those to an apex class is running fine.  
  • April 28, 2014
  • Like
  • 0
Hi All,

List<CronTrigger> lstJobs = [SELECT Id FROM CronTrigger WHERE CronJobDetail.Name LIKE '%myReports%'];
for(CronTrigger ct : lstJobs) system.abortJob(ct.Id);

I run the above code on a daily basis to clean up some old scheduled batch jobs, and I am getting the limitexception:
System.LimitException: ads:Too many DML statements: 151

I undestand that bulkifying the above would solve the issue - similar to other DML operations on standard and custom objects.

My question is - how to do bulkify this operation? Is there a way to mass delete schduled jobs as abortJob() function seems to take only one Job Id at a time?

Kind Regards
Madhav

Hi , I was trying to fix below issue. can anyone help on this.

Save error: member variable not visible for assignment oppIds = ApexPages.currentPage().getParameters().get( 'id');

 

publicString oppIds

{

get

{

if ( oppIds == null)

{

oppIds = ApexPages.currentPage().getParameters().get( 'id');

}

returnoppIds;

}

 

}

  • December 16, 2013
  • Like
  • 0

Hello,

 

I am trying to put an IF statement into my Class that determines if an Aggregate Result is NULL then place a 0 in its place.

Iv tried a few different ideas and just can't get it to work.

 

Public Integer getShowJanuarySales() {
    if (ShowJanuarySales > 0){
        return ShowJanuarySales;
    } else {
        return 1;
    }
 

 

Iv got the following statement that works fine as long as a record exists and I know that it changes the value for me. But if I replace the "> 0" with "== null" I just get an error on my page saying it can't reference a null object.

Anyone got any ideas?

Matt

Hello,

I am using IF statements to change the colour of text determined on its value. I have it working to show either "RED"  if the value is below 15 and Green thereafter.

 

<font size="6" color="{!IF((ShowNovemberSales<15),"RED","GREEN")}">{!ShowNovemberSales}</font>

 I'd like to add in an extra colour and that is if the value is GREATER than 15 but LOWER than 26 to show orange. 

Can anyone tell me how i write this as im having no luck!

Thanks,

Matt

Hi,

 

Got two objects. When saving on one, a trigger creates a bunch on the other referecing back with a lookup. When I delete from the former, I want it to delete everything that it created when saving.

 

This is what I have so far:

 

trigger CleanRelatedPCMActivities on Week__c (before delete) 

{
set<id> setActIds = Trigger.newmap.keySet();
 
//query for related Activities
 
list<PCM_Time_Record__c> ActivityRecords = [select Id from PCM_Time_Record__c where Weekly_Time__c in:setActIds];
if(ActivityRecords.size() > 0)
delete ActivityRecords;
}

Theory sounds good. Before deleting, set the ID of what you are deleting. Then query in the other object to find what it is related to, deleting whatever is found.

 

This is giving me this error though:

 

execution of BeforeDelete caused by: System.NullPointerException: Attempt to de-reference a null object: Trigger.CleanRelatedPCMActivities: line 4, column 1"

 

Anyone got a pointer on where I may have gone wrong?

Hi,

 

I am just wondering if someone can explain when I am supposed to use Test.StartTest() and Test.StopTest() ? 

 

If I have a testmethod already, and the @istest notation, are the aforementioned methods necessary to perform a test? Can I run the test without them? When should I be starting-stopping? 

 

Thanks!!

Hello All,


I have question, if i need to change the lookup relationship to master detail relationship in prod what are the steps and precautions i need to take.

If that object is having data how to change, please explain the steps to change from lookup to master details in prod. 

 

Thank you,

Can we use----var x={!method} ?? in javascript...not working for me..

 

Using <action function >we can access controller method but the method is 'pagereferece' type so it will return null...I want to return a value from controller method to javascript.....How to do?

 

 

 

Hi,

 

I am trying to get fields of parents into my child visual force page. i am missing something which thorws error to get the values from parent

 

<apex:page standardController="Job_Posting__c" recordSetVar="Job_Postings" tabstyle="Job_Application__c" sidebar="false">
<apex:pageBlock >
<apex:pageBlockTable value="{!Job_Postings}" var="a">
<apex:column value="{!a.name}"/>
<apex:column value="{!a.Position__c}"/>
<apex:column value="{!a.Position__c.Min_pay__c}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

 

Job_posting__c is the child of Poistion__c. min_pay__c is a field in Position object. first 2 fields are displaying correcty which is name name and position__c (there is also a custom field with the name position directly in child object)

Hi,

 

I need help in updating a parent record field with Yes or No value.

 

When I create a child record with lookup field value as hardcoded value, trigger get save but doesnt allow to save child record.

This is the code i am not able to save the child record. On child record I have visualforce page.

 

trigger PopulateDAA on DAA__c (after insert, after update)
{
    set<id> DealIDs = new set<id>();
    set<id> DdataIDs = new set<id>();
    
    for(DAA__c l : trigger.new)
    {
        DealIDs.add(l.Deal__c);
    }
   
    List<Deal__c> deals= [select id, PovRate2530__c from Deal__c where id in :DealIDs ];
    
      deals[0].PovRate2530__c = 'No';
      
        
  for(DAA__c l : trigger.new)
        { 
        
           if(l.Deal__c == 'Poverty Rates Greater Than 25 Percent')
           {
            deals[0].PovRate2530__c = 'Yes';
           
           }

        else

         {
             deals[0].PovRate2530__c = 'No';  
         }
        }
    update deals;    
}

 

This code executes but doesnt work...

As i have VF page on child object its not allowing me to save the record.

 

I feel its a lookup field (Deal__c) so its not reading the value.. may be I am wrong.

 

Please help!!!!

 

Hi,

Is there any method in Apex to print the the given input number in 4 digit format. For example my input numbers are 2,3,4,5,6,23,24. Then the output should be like 0002,0003,0004,0005,0006,0023,0024.

How could I achieve this with out writing general logic? If any methods resulting this output could appreciate. Please help on this....

 

 

Regards-

Shiv Kumar

I'm getting this error:

 

Description	Resource	Path	Location	Type
Save error: Unknown property 'OpportunityStandardController.getLines'	AlexHelloWorld.page	/SFDC/src/pages	line 0	Force.com save problem

 Here is my visual force page:

<apex:page standardController="Opportunity" extensions="AlexHelloWorld">
    <apex:form >
        <apex:pageBlock title="Edit account for {!$User.FirstName}">
            <apex:pageMessages />
            <apex:pageBlockButtons >
                
            </apex:pageBlockButtons>
            <apex:pageBlockSection >
                <apex:outputText value="Test - {!retVal}">
                </apex:outputText>
            </apex:pageBlockSection>
            <apex:pageBlockSection >
                <apex:outputText value="OppId - {!opportunity.id}" />
                <apex:outputText value="UserId - {!$User.Id}" />
            </apex:pageBlockSection>
            <apex:pageBlockSection>
            	<apex:repeat value="{!getLines}" var="line" id="theRepeat">
            		<tr>
            			<td valign="top"><apex:outputField value="{!line.Id}" /></td>
            			<td valign="top"><apex:outputField value="{!line.OpportunityId}" /></td>
            			<td valign="top"><apex:outputField value="{!line.PricebookEntryId}" /></td>
            			<td valign="top"><apex:outputField value="{!line.Quantity}" /></td>
            		</tr>
            	</apex:repeat>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 Here is my controller:

public with sharing class AlexHelloWorld {

    public boolean 	showFedEx{get;set;}
    public String	mystr{get;set;}
    public Id		opportunityId{get;set;}
    
    //public Opportunity opportunity{get;set;}
    public Decimal retVal{get;set;}
    
    //Main controller class
    public AlexHelloWorld(ApexPages.StandardController controller)
    {
    	mystr = [SELECT Email from User where Id =:Userinfo.getUserId()].Email;
        showFedEx = true;
        retVal = 5*5;
        System.debug('zzzzz');
    }
    
    public List<OpportunityLineItem> getLines()
    {    	
		List<OpportunityLineItem> oli = [SELECT Id, OpportunityId, PricebookEntryId, Quantity FROM OpportunityLineItem where id =:System.currentPageReference().getParameters().get('id')];
		
		return oli;    	
    }
}

 

Any ideas?

Hello,

 

Does anyone know how to change the color of a PageBlockSection title bar and the title text, or if it is even possible?  I know I can use other options, but I need the collapsible sections.  Thanks.

  • December 06, 2012
  • Like
  • 0

Dear Experts,

 

I am very new to SFDC and trying to understand some basic features.

I tried to call a sample outofbox Login Web service to generate a session token which can be used for calling custom webservices.

I took the Enterprise WSDL from Setup-Develop-API and imported that in SOAP UI.

While calling this web service I was trying to hit the following URL : https://login.salesforce.com/services/Soap/c/25.0

But this call was getting blocked with following exception : ERROR:java.lang.ClassCastException: org.apache.http.message.BasicHttpRequest cannot be cast to org.apache.http.impl.client.RequestWrapper

 

When I tried to hit the HTTP url (not HTTPS) request was going through but getting following error UNSUPPORTED_CLIENT: HTTPS Required. This means that request was going through but HTTPS was expected. I tried to suppress the setting for HTTPS but could not do so because I am using a developer edition(Administration Set Up ->Session Settings -> Require Secure connections)

 

I need to know can I make a HTTPS call from SOAP UI to a salesforce webservice? If so what extra settings are needed ?

 

Below is my soap request:

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com">
   <soapenv:Header>
     </soapenv:Header>
   <soapenv:Body>
      <urn:login>
         <urn:username></urn:username>
         <urn:password></urn:password>
      </urn:login>
   </soapenv:Body>
</soapenv:Envelope>

 

Much thanks in advance for help.

 

Regards,

Anchal

 

HI

 

I need to specify (a condition to not enter duplicate names in salesforce)for standard field object Account,

through validation rules (or) any way in Admin part not through coding(Triggers should not be used).

 

please help me out.

 

Narendra 

I'm having trouble writing a validation rule where I would compare now() to a set time.

 

What I'm trying to do is say when a custom date field is changed if the time the change is happening is after 12 noon to fire the validation.

 

Here are the different ways I've attempted this:

AND(
ISCHANGED(Date__c),
Date__c = Today()+1,
NOW()> DATETIMEVALUE(TEXT(YEAR(TODAY()))+"-" +TEXT(MONTH(TODAY()))+"-" +TEXT(DAY(TODAY()))+" "+"12"+ ":00"+":00")
)

 I've also tried:

AND(
ISCHANGED(Date__c),
Date__c = Today()+1,
NOW()> VALUE(MID(TEXT(NOW()),12,2))>12
)

 Any help would be appreciated.

 

Thanks!

My controller class is returning an array of string to my apex page. How do I loop over the array items and display them?

 

In the code below I am just trying to access the first index in the array and display the value. But this does not work.

 

<apex:page standardController="Account" extensions="RECALLFDMServiceController">

<h1>TTM Revenues</h1>
    <apex:pageBlock >
        <apex:pageblocktable value="{!TTMByListBillingID}" var="TTMResponse">            


          <apex:column >
                {!TTMResponse['0'].TTM}
            </apex:column>

 

        </apex:pageblocktable>
    </apex:pageBlock>
    
</apex:page>

 

Hello everyone, 

lets see if someone can give me a hint about how this happened.

I have a record that is locked, but going to the related list of approval processes, it is empty.
Moreover, I don't have the button to unlock the record, and yes, I'm system admin.

Kind regards
  • February 04, 2015
  • Like
  • 0
Hello, 

I have a couple of batches that are taking elements from an object that we use as a queue of integration.

the problem is that sometimes they overlap, and I'm getting ENTITY_IS_DELETED.

I decided to add a
 
Queue__c lock;
try{
    lock = [SELECT Id FROM Queue__c WHERE ID = :theProcessingElement FOR UPDATE];
} catch (Exception e){
    return;
}

// rest of the logic

delete lock;

But I'm still getting a lot of ENTITY_IS_DELETED exceptions

Any ideas?

(I did in all batches)

Thank you in Advance
Kind Regards
  • November 18, 2014
  • Like
  • 0
Hi there!, 

I'm having an exception (CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY) in my code when I change from this code
public void recalculateAccountSegmentation(List<Opportunity> lOppty){
    List <Account> accounts = new List <Account>();
    List <Account> acctoupdate = new List <Account>();
    
    for(Opportunity o: lOppty){
        accounts.add(o.Account);        
    }
    acctoupdate = [Select Id from Account where Id IN: accounts];
    update acctoupdate;
}

to this one
public void recalculateAccountSegmentation(List<Opportunity> lOppty){
    Set <Account> accountsSet = new Set <Account>();
    for(Opportunity o: lOppty){
        accountsSet.add(new Account(ID=o.AccountID));
    }
    update new List<Account>(accountsSet);
}

What might be the explanation? (that is the ONLY thing I am changing, and tests are running OK without this change)

Thanks in advance

Hi everyone, 

I'm having the following Error

Upsert failed. First exception on row X with id a0XD00... ; first error: INVALID_ID_FIELD, invalid record id: []

The line that causes the error is 
 

upsert aNewMap.values();
aNewMap is a Map which values are records that might or might not have ID.

The point is,
1) why it says that "invalid record id: []" if it says the error before.
2) an upsert call without specifying a field, should take the ID field to know if its an insert or upsert call. if has no ID, why it does not make an Insert?

Kind regards
Hi there, 
I'm trying to use Analytics API to fetch the results of a report (syncronous) and this report contains a field that might have a JSON inside.

The problem is that the API is returning 

<pre>{
          "value" : "{\n20:{Net:0.0,VAT:0.0,Total:0.0,VAT(%):...",
          "label" : "{\n20:{Net:0.0,VAT:0.0,Total:0.0,VAT(%):..."
        }</pre>

(is cutting out part of the information).

Is there any parameter that I can use or some way to prevent the API from cutting out this information?

Thanks and regards.
  • January 20, 2014
  • Like
  • 0

Hi, 

 

In order to allow backing-up and restoring our system, we need to create External IDs on every object, so external items would store the custom object.

 

My initial Idea was to create a field called ID__c marked as unique and External ID.

on after insert, if this field is null, I would assign its real ID.

It would be left as it is, otherwise.

 

Now suppose that we create a record
ID: A

Name: Data1
ID__c: null
this would make ID__c --> A

 

if I delete this record and restore it from a back-up, I would have

ID: B (would assign a different, as you cannot control which ID is given on insert)

Name: Data1

ID__c: A

 

The question is, is it possible that at some point in the future, I try to create a record and salesforce give it the ID A (as it is no longer used)?

In the scenario I stated, It would fail the insert, cause ID__c is unique, but I want to know if salesforce reuses IDs.

 

I know that it is very unlikely, but I'm just wondering.

  • December 03, 2013
  • Like
  • 0

Hi everybody, 

 

lets see if I'm missing anything or something because I think this might be a salesforce bug.

 

I am developing a REST webservice, see the following code snippet.

 

...
        returned.signatures = new List<Map<String,String>>();
        for(Attachment att : [
            SELECT
                Body,
                ParentID
            FROM
                Attachment
            WHERE 
                ParentID IN :new Map<ID,Order__c>(returned.orders).keyset() AND
                Name like 'Signature%']){
                

                System.debug(att.id);
                System.debug(att.parentID);
                system.debug(EncodingUtil.base64Encode(att.body));

                returned.signatures.add(new Map<String,String>{'Id'=>String.valueOf(att.parentID),'signatureBody'=>EncodingUtil.base64Encode(att.body)});        
        }
...

 

 

The thing is that if I go to the debug logs, 

I see the attachment ID and the parentID properly, but the att.body is from another file :S (if I navigate to the AttachmentID and click on View, I see the good one)

 

Is there anything that I am doing wrong?

  • February 13, 2013
  • Like
  • 0

Hey, 

I thought that a single item can only be in a single approval Process, if so...

How is this possible?

 

Action Date Status Assigned To Actual Approver Comments Overall Status 21/01/2013 12:14 21/01/2013 12:14

Step: Step 1 (Pending for first approval)    
Pending
Reassign | Approve / RejectPendingCL1-RSACL1-RSA  
Step: Step 1 (Pending for first approval)    
Pending
Reassign | Approve / RejectPendingCL1-RSACL1-RSA 

 

Is that a bug or there is something that I'm missing?

 

Thanks

  • January 22, 2013
  • Like
  • 0

Hello everyone.

 

I need to call a Webservice with multiple files (base64 encoded).

 

As I don't like dealing with WSDL, I decided to create the following class

global class MyWSClass{
    webservice static Blob myWSMethod (List<Blob> inputs){
        return null;
    }
}

 After that, I clicked on "Generate WSDL" and cleaned it a little bit (remove all headers but SessionHeader) and save it.

 

Then, I tried to use that WSDL to generate the Class that will use the webservice (using WSDL2Apex) that generates the following prototype.

 

...
public String myWSMethod(String[] inputs) {
...

 

The webservice works fine as long as I don't send too much information.

If I send 3 files of 300k each, it throws the following exception 

 

"System.CalloutException: Web service callout failed: String length exceeds maximum: 1000000"

 

on the line that calls to WebServiceCallout.invoke().

 

As the only field that depends on the files I choose is request_x and the response, I tried to change them to Blob (one, the other and both), but it didn't work.

 

Any idea?

 

Thanks

  • August 31, 2012
  • Like
  • 0

Hi everyone, 

 

I'm currently facing a business requirement that I think it might be accomplished with force.com sites. 

 

This is the part of the model involved (3 custom objects)

-  License

-  Contributor

-  Joint object (License, Contributor)

 

Each license might need many contributors, and each contributor might be involved in many Licenses.

Initially, each contributor is not a regular user of Salesforce (actually, he/she will only interact with salesforce to change License records linked to each of them).

 

I’ve thought about using Force.com sites (I’m not sure if they are called like that, but I refer to the ones that allow visualforces).

 

Logic would be as follows:

-  A real user of salesforce will create contributors (and store a random token that will be sent to each contributor to allow them to register).

-  One of those contributors will get into the site and click on Register. The form will ask for all the information required and the token (to check that he really is the one he claims to be). If everything goes OK, a user will be created and will be ready to log-in.

-  About security, there will be a trigger on Joint object that includes each user on License__share.

 

Do you think this can be done using sites (the ones that allow the use of VisualForce)?

Do you think this is the best option?

Hello, 

 

I am trying to do a $.get() method (jquery) to retrieve the source code of a visualforce.

 

If I use the code while I'm in the domain c.xxx.visual.force.com/apex/myVF it works fine.

BUT If I use the code while I'm in a standard page (domain xxx.salesforce.com ) I get a redirect message and my code fails.

 

What leads me to the following questions.

- Is there any way to load a visualforce avoiding the redirect to the domain c.xxx.visual.force.com ?

- or... Is there any way to send session information to let it load properly?

 

Regards.

Hello, 

 

I need to grant access through hierarchy, but only to one user of the hierarchy above.

 

Lets say I have the following hierarchy

 

-Role1 (User A, B)

---Role2 (User C [whose manager is A], D [whose manager is B])

 

I want A to access records owned by C, but not by D, and the same with B and D.

 

How can I do this with standard Objects? (take into account that 'Grant access using hierarchy is active and cannot be modified).

 

 

Regards.

  • March 01, 2012
  • Like
  • 0

Hi all, 

 

I know that it is possible to pre-populate fields by adding some parameters to the URL.

 

What I need is to retreive the Field ID to be able to pre-populate any field I want knowing the Object name and the field name.

 

Is it possible?

 

How?

 

Thank you in advance.

  • September 02, 2011
  • Like
  • 0
We have two batch jobs that run just after midnight. When I run it manually via the Developer Console Anonymous window, they run fine. But last night, the "Apex Jobs" window showed that they failed. The Status states:
               Completed First error: Attempt to de-reference a null object
Now I know what that means, but I have no information to debug it. As I said, when I run it manually I can turn on the debug logs, but it does not fail.

It seems odd that there is no "master error log" where I can see more about what happened... or is there?scheduled-apex
Hello everyone, 

lets see if someone can give me a hint about how this happened.

I have a record that is locked, but going to the related list of approval processes, it is empty.
Moreover, I don't have the button to unlock the record, and yes, I'm system admin.

Kind regards
  • February 04, 2015
  • Like
  • 0
I tried almost all the available snippets and code samples to get this thing work but no success till now. Can you please suggest me a working model to transfer a JS array to Apex controller? Whenever I tried to see the value in log. I didn't found anything. And its been two days now I'm unable to accomplish this simple thing. Please help. Thanks.
This is javascript string on the vf page, It still giving SQL injection Issue on sceurity review.
how to avooid sql Injection in jquery??? 
My code is.. 
var q_text = "select JId__c from JOauth__c where SetupOwnerId= '";
var q_text1 = $('#currnetUserId').text();
// "currnetUserId" is the ID of span tag in another page
var q_text2 = "'";
var q = q_text.concat(q_text1, q_text2);
Am just executing hello world statement.
System.debug('hello world');
developer console not showing any logs.
why?
please help me

When i send the  image in the htmlbody using img tag , i have stored the image in document .
i have checked "externally available use" checkbox on document also .. 
I am able to see that image from my cell phone but , when  I login desktop  i cant see any image there in the mail 

it says click here to see image when i click there is no image , although i am able to see image in my cell phone
 

mail.setHtmlBody(' Hello Chadda !! <image src="https://chitral-dev-ed--c.ap1.content.force.com/servlet/servlet.ImageServer?id=01590000006MdbA&oid=00D90000000vuPf&lastMod=1418471178000" ');
 


I am using html email status related list to track #times opened mail  and other .

Hello, 

I have a couple of batches that are taking elements from an object that we use as a queue of integration.

the problem is that sometimes they overlap, and I'm getting ENTITY_IS_DELETED.

I decided to add a
 
Queue__c lock;
try{
    lock = [SELECT Id FROM Queue__c WHERE ID = :theProcessingElement FOR UPDATE];
} catch (Exception e){
    return;
}

// rest of the logic

delete lock;

But I'm still getting a lot of ENTITY_IS_DELETED exceptions

Any ideas?

(I did in all batches)

Thank you in Advance
Kind Regards
  • November 18, 2014
  • Like
  • 0
I'd like to get the workaround equivalent to the posted code, but it does not seem possible to run a count on the UserRecordAccess object?


if ([select count() from UserAccessRecord
            where UserId = :UserInfo.getUserId() and AccountId = :sc.getId()] > 0) {
        return true;
    }


  • September 12, 2014
  • Like
  • 0
I'm trying to write a class and trigger that allows me to call out to a webservice - Jira. However, my url is getting a 'null' status. I realized there were spaces in the url, so I added %20 in the url. I still got the same message. I've included the debug log below:

req = System.HttpRequest[Endpoint=http://jira.zzz/rest/customware/connector/1.0/B6DB-9597-179C-LL4Y/Case/500n0000001OXcrAAG/LEV/Client%20Issue%20-%20Level%201/john%doe/test/issue/synchronize.json, Method=PUT]


08:55:20.064 (64488504)|SYSTEM_METHOD_EXIT|[32]|System.debug(ANY)
08:55:20.064 (64503763)|SYSTEM_METHOD_ENTRY|[34]|System.Http.send(ANY)
08:55:20.064 (64580655)|CALLOUT_REQUEST|[34]|System.HttpRequest[Endpoint=http://jira.zzz/rest/customware/connector/1.0/B6DB-9597-179C-LL4Y/Case/500n0000001OXcrAAG/LEV/Client%20Issue%20-%20Level%201/jiohn%doe/test/issue/synchronize.json, Method=PUT]
08:55:30.077 (10077030307)|EXCEPTION_THROWN|[34]|System.CalloutException: Read timed out
08:55:30.077 (10077113104)|SYSTEM_METHOD_EXIT|[34]|System.Http.send(ANY)
08:55:30.077 (10077198962)|SYSTEM_METHOD_ENTRY|[38]|System.HttpResponse.toString()
08:55:30.077 (10077291506)|SYSTEM_METHOD_EXIT|[38]|System.HttpResponse.toString()
08:55:30.077 (10077319303)|SYSTEM_METHOD_ENTRY|[38]|System.debug(ANY)
08:55:30.077 (10077335189)|USER_DEBUG|[38]|DEBUG|

exception caught = System.HttpResponse[Status=null, StatusCode=0]

Hi there!, 

I'm having an exception (CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY) in my code when I change from this code
public void recalculateAccountSegmentation(List<Opportunity> lOppty){
    List <Account> accounts = new List <Account>();
    List <Account> acctoupdate = new List <Account>();
    
    for(Opportunity o: lOppty){
        accounts.add(o.Account);        
    }
    acctoupdate = [Select Id from Account where Id IN: accounts];
    update acctoupdate;
}

to this one
public void recalculateAccountSegmentation(List<Opportunity> lOppty){
    Set <Account> accountsSet = new Set <Account>();
    for(Opportunity o: lOppty){
        accountsSet.add(new Account(ID=o.AccountID));
    }
    update new List<Account>(accountsSet);
}

What might be the explanation? (that is the ONLY thing I am changing, and tests are running OK without this change)

Thanks in advance
Wny is it that when we are enabling person accounts one of the pre requisite steps we need to do is:
*Ensure the organization-wide sharing settings have been set for the Contact records to be "Controlled by Parent"?

Hi everyone, 

I'm having the following Error

Upsert failed. First exception on row X with id a0XD00... ; first error: INVALID_ID_FIELD, invalid record id: []

The line that causes the error is 
 

upsert aNewMap.values();
aNewMap is a Map which values are records that might or might not have ID.

The point is,
1) why it says that "invalid record id: []" if it says the error before.
2) an upsert call without specifying a field, should take the ID field to know if its an insert or upsert call. if has no ID, why it does not make an Insert?

Kind regards
Can someone help me with this compile error?  I'm not a developer and this is my first time to try and create a trigger.  I was given some sample code and modified it just a little bit.  For the life of me, I can't see what might possibly be wrong with line 3.

User-added image
I have a button that should take most of the fields from the current case, pop up a box asking for new values for 5 fields and then create a new case with the previous case field values and the 5 new values.  It works this way, but this is SO convoluted.  Please help me simplify this.  There has to be a way to pass all the previous cases info without doing it one field at a time, I just have no idea how.  Any help is GRATELY appreciated

Button:
/apex/CW_Recurring_Incident?retURL={!Case.Id}&00N30000006aSCK={!Case.Product__c}&00N30000006aSCE={!Case.Application__c}&00N30000006aSCF={!Case.Component__c}&00N30000006aSCN={!Case.Subsystem__c}&00Na0000009yTvW={!Case.Additional_email_1__c}&00Na0000009yTvX={!Case.Additional_email_2__c}&00Na0000009zDPm={!Case.Impact__c}&00Na0000009zDPp={!Case.Urgency__c}&cas6={!Case.Reason}&cas14={!Case.Subject}&cas3={!Case.Contact}&00Na0000009zDPj={!Case.CW_Type__c}&cas15={!Case.Description}&cas4={!Case.Account}&00N30000007Pq9o={!Case.Machine_ID__c}&00Ne0000000illW={!Case.Machine_Model__c}&00Ne0000000j67X={!Case.Date_Code__c}&00Ne0000000im8Q={!Case.Onboard_Software_Version__c}&00Ne0000000im8V={!Case.Onboard_Hardware__c}&00Ne0000000j67T={!Case.Serial__c}&00Ne0000000j67S={!Case.Part__c}&cas28={!Case.CaseNumber}&00Ne0000000illM={!Case.Workaround_ICA__c}&00Ne0000000ilkx={!Case.Problem_Number__c}&00Na0000009zDPl={!Case.Declined_Reason__c}&00N30000007PqGR={!Case.Problem_Tracking_Link__c}&00Na0000009zDPo={!Case.Root_Cause_Description__c}&00Na0000009zDPi={!Case.CPI_Numbertext__c}&00Ne0000000ill2={!Case.CPI_Tracking_Link__c}&00Na0000009zDPn={!Case.NPI_Numbertext__c}&00Na000000A0KZY={!Case.NPI_Tracking_Link__c}&00Ne0000000ill7={!Case.Change_Number__c}&00Na0000009yPyY={!Case.Change_Tracking_Link__c}&00Ne0000000illb={!Case.Machine_Serial__c}&00Na0000009zDPk={!Case.Caused_by_Change__c}



VF Page:
<apex:page standardController="Case" extensions="CW_recurringIncident">
<apex:form id="frm">
<apex:detail subject="{!Case.Id}" relatedList="false" title="false"/>
<apex:outputPanel id="tstpopup" rendered="{!IF(isDisplayPopUp ==true,true,false)}" >
<apex:outputPanel styleClass="popupBackground" layout="block" />
<apex:outputPanel styleClass="custPopup" layout="block">
<apex:pageMessages >
</apex:pageMessages>
<apex:pageBlock >
<apex:pageBlockSection >
<apex:inputField label="Incident First Response" value="{!Case.Incident_First_Response__c}"  required="true"/>
<apex:inputField label="Incident Start" value="{!Case.Incident_Start__c}" onclick="" required="true"/>
<apex:inputField label="Service Restored" value="{!Case.Incident_Resolved__c}" onclick="" required="true"/>
<apex:inputField label="Defect Type" value="{!Case.Defect_Type_Multi__c}" required="true"/>
<apex:inputField label="Service Restoration Description" value="{!Case.Service_Restoration__c}" onclick="" required="true"/>

<apex:outputPanel >
<apex:CommandButton action="{!Save}" value="Save"/>
<apex:CommandButton action="{!cancel}" value="Cancel"/>
</apex:outputPanel>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:outputPanel>
</apex:outputPanel>





</apex:form>



<style type="text/css"> .errorMsg{ width:159px; }
.custPopup{ background-color: white; border-width: 3px;
border-style: solid;
z-index: 9999;
left: 25%;
padding:10px;
position: absolute;
width: 1000px;
//margin-left: -80px; top:100px; margin-left: -170px;
//top:305px;
border-radius: 5px;
}

.datePicker{z-index:10000}



.popupBackground{ background-color:black; opacity: 0.20; filter: alpha(opacity = 20);
position: absolute; width: 100%; height: 100%; top: 0; left: 0;
z-index: 997 } a.actionlink:hover{ text-decoration:underline; }
.customactionLink { color: #015BA7; font-weight: normal; text-decoration: none; } </style>

<script>
      function setFocusOnLoad() { }
</script>
</apex:page>



Class:
public class CW_recurringIncident
{
public Boolean isDisplayPopUp {get; set;}

public string product,  Serial, Change_Tracking_Link, Change_Number, NPI_Tracking_Link, NPI_Numbertext, CPI_Tracking_Link, CPI_Numbertext, Root_Cause_Description, Problem_Tracking_Link, Problem_Number, Declined_Reason, Workaround_ICA, Parent_Case, Part, Machine_Serial, Date_Code, Onboard_Software_Version, Onboard_Hardware, Application, Account_Name, Machine_Model, Machine_ID, Implementation, Component, Contact, Type, Description, Reason, Subject, Subsystem, Additional_email_1, Additional_email_2, Impact, Urgency;
public CW_recurringIncident(ApexPages.StandardController controller)
{
if(System.currentPageReference().getParameters().get('00N30000006aSCK') <> null ){
product = System.currentPageReference().getParameters().get('00N30000006aSCK');
}
if(System.currentPageReference().getParameters().get('00N30000006aSCE') <> null ){
Application = System.currentPageReference().getParameters().get('00N30000006aSCE');
}
if(System.currentPageReference().getParameters().get('00N30000006aSCF') <> null ){
Component = System.currentPageReference().getParameters().get('00N30000006aSCF');
}
if(System.currentPageReference().getParameters().get('00N30000006aSCN') <> null ){
Subsystem = System.currentPageReference().getParameters().get('00N30000006aSCN');
}
if(System.currentPageReference().getParameters().get('00Na0000009yTvW') <> null ){
Additional_email_1 = System.currentPageReference().getParameters().get('00Na0000009yTvW');
}
if(System.currentPageReference().getParameters().get('00Na0000009yTvX') <> null ){
Additional_email_2 = System.currentPageReference().getParameters().get('00Na0000009yTvX');
}
if(System.currentPageReference().getParameters().get('00Na0000009zDPm') <> null ){
Impact = System.currentPageReference().getParameters().get('00Na0000009zDPm');
}
if(System.currentPageReference().getParameters().get('00Na0000009zDPp') <> null ){
Urgency = System.currentPageReference().getParameters().get('00Na0000009zDPp');
}
if(System.currentPageReference().getParameters().get('cas6') <> null ){
Reason= System.currentPageReference().getParameters().get('cas6');
}
if(System.currentPageReference().getParameters().get('cas14') <> null ){
Subject= System.currentPageReference().getParameters().get('cas14');
}
if(System.currentPageReference().getParameters().get('cas3') <> null ){
Contact= System.currentPageReference().getParameters().get('cas3');
}
if(System.currentPageReference().getParameters().get('00Na0000009zDPj') <> null ){
Type= System.currentPageReference().getParameters().get('00Na0000009zDPj');
}
if(System.currentPageReference().getParameters().get('cas15') <> null ){
Description= System.currentPageReference().getParameters().get('cas15');
}
if(System.currentPageReference().getParameters().get('00N30000006aSCH') <> null){
Implementation= System.currentPageReference().getParameters().get('00N30000006aSCH');
}
if(System.currentPageReference().getParameters().get('00N30000007Pq9o') <> null ){
Machine_ID= System.currentPageReference().getParameters().get('00N30000007Pq9o');
}
if(System.currentPageReference().getParameters().get('00Ne0000000illW') <> null ){
Machine_Model= System.currentPageReference().getParameters().get('00Ne0000000illW');
}
if(System.currentPageReference().getParameters().get('cas4') <> null ){
Account_Name= System.currentPageReference().getParameters().get('cas4');
}
if(System.currentPageReference().getParameters().get('00Ne0000000im8Q') <> null ){
Onboard_Software_Version= System.currentPageReference().getParameters().get('00Ne0000000im8Q');
}
if(System.currentPageReference().getParameters().get('00Ne0000000im8V') <> null ){
Onboard_Hardware= System.currentPageReference().getParameters().get('00Ne0000000im8V');
}
if(System.currentPageReference().getParameters().get('00Ne0000000j67S') <> null ){
Part= System.currentPageReference().getParameters().get('00Ne0000000j67S');
}
if(System.currentPageReference().getParameters().get('00Ne0000000j67T') <> null ){
Machine_Serial= System.currentPageReference().getParameters().get('00Ne0000000j67T');
}
if(System.currentPageReference().getParameters().get('00Ne0000000j67X') <> null ){
Date_Code= System.currentPageReference().getParameters().get('00Ne0000000j67X');
}

if(System.currentPageReference().getParameters().get('cas28') <> null ){
Parent_Case= System.currentPageReference().getParameters().get('cas28');
}

if(System.currentPageReference().getParameters().get('00Ne0000000illM') <> null ){
Workaround_ICA= System.currentPageReference().getParameters().get('00Ne0000000illM');
}

if(System.currentPageReference().getParameters().get('00Na0000009zDPl') <> null ){
Declined_Reason= System.currentPageReference().getParameters().get('00Na0000009zDPl');
}

if(System.currentPageReference().getParameters().get('00Ne0000000ilkx') <> null ){
Problem_Number= System.currentPageReference().getParameters().get('00Ne0000000ilkx');
}

if(System.currentPageReference().getParameters().get('00N30000007PqGR') <> null ){
Problem_Tracking_Link= System.currentPageReference().getParameters().get('00N30000007PqGR');
}

if(System.currentPageReference().getParameters().get('00Na0000009zDPo') <> null ){
Root_Cause_Description= System.currentPageReference().getParameters().get('00Na0000009zDPo');
}

if(System.currentPageReference().getParameters().get('00Na0000009zDPi') <> null ){
CPI_Numbertext= System.currentPageReference().getParameters().get('00Na0000009zDPi');
}

if(System.currentPageReference().getParameters().get('00Ne0000000ill2') <> null ){
CPI_Tracking_Link= System.currentPageReference().getParameters().get('00Ne0000000ill2');
}

if(System.currentPageReference().getParameters().get('00Na0000009zDPn') <> null ){
NPI_Numbertext= System.currentPageReference().getParameters().get('00Na0000009zDPn');
}

if(System.currentPageReference().getParameters().get('00Na000000A0KZY') <> null ){
NPI_Tracking_Link= System.currentPageReference().getParameters().get('00Na000000A0KZY');
}

if(System.currentPageReference().getParameters().get('00Ne0000000ill7') <> null ){
Change_Number= System.currentPageReference().getParameters().get('00Ne0000000ill7');
}

if(System.currentPageReference().getParameters().get('00Na0000009yPyY') <> null ){
Change_Tracking_Link= System.currentPageReference().getParameters().get('00Na0000009yPyY');
}

if(System.currentPageReference().getParameters().get('00Ne0000000j67T') <> null ){
Serial= System.currentPageReference().getParameters().get('00Ne0000000j67T');
}



isDisplayPopUp = true;
{Case c = (Case) controller.getRecord(); c.Serial__c=Serial; c.Change_Tracking_Link__c=Change_Tracking_Link; c.Change_Number__c=Change_Number; c.NPI_Tracking_Link__c=NPI_Tracking_Link; c.NPI_Numbertext__c=NPI_Numbertext; c.CPI_Tracking_Link__c=CPI_Tracking_Link; c.CPI_Numbertext__c=CPI_Numbertext; c.Root_Cause_Description__c=Root_Cause_Description; c.Problem_Tracking_Link__c=Problem_Tracking_Link; c.Problem_Number__c=Problem_Number; c.Declined_Reason__c=Declined_Reason; c.Workaround_ICA__c=Workaround_ICA; c.Onboard_Software_Version__c=Onboard_Software_Version; c.Onboard_Hardware__c=Onboard_Hardware; c.Part__c=Part; c.Machine_Serial__c=Machine_Serial; c.Date_Code__c=Date_Code; c.Machine_Model__c=Machine_Model; c.Machine_ID__c=Machine_ID; c.Description = Description; c.CW_Type__c = Type; c.Subject= Subject; c.Reason=Reason; c.Urgency__c=Urgency; c.Impact__c=Impact; c.Additional_email_2__c=Additional_email_2; c.Additional_email_1__c=Additional_email_1; c.Subsystem__c=Subsystem; c.Component__c=Component; c.Application__c=Application; c.Status = 'New'; c.RecordTypeId = '012e00000004RxSAAU';c.Product__c=product;}

}}


  • May 02, 2014
  • Like
  • 0
I have a simple controller that is designed to act as a time. As so:

public class timerController {

    public static dateTime startTime {get;set;}
    public static dateTime stopTime {get;set;}
 
    public static void startTimer(){

        startTime = system.now();

        system.debug(startTime);
    }
    
    public static void stopTimer(){
        
        stopTime = system.now();

        system.debug(startTime);
        system.debug(stopTime);
    }

}

Each method is tied to a button ('Start Timer' and 'Stop Timer'). When I run the startTimer method, I can see the startTime value in my debug.
When I run the stopTimer method, I can see the stopTime value in my debug, but the startTime has been reset to null.

Why is the startTime value not being maintained in the state? I know I must be missing something small, but I can't for the life of me spot it.

Any suggestions would be greatly appreciated.