• SeAlVa
  • SMARTIE
  • 1310 Points
  • Member since 2011

  • Chatter
    Feed
  • 48
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 228
    Replies
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
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
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;
    }


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;}

}}


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.