• Praetorian65
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 17
    Questions
  • 10
    Replies
I am trying to create a formula field as a number. What I need to do is work out the time difference between Now and a date on my custom object rounded up to the nearest month. This would be easy to do in code but I can't work out how to do it in the formula field.

Hi, I am a .net developer and new to salesforce.

I want to add the webservice api to my project.

But  I am unable to start.

Is there any video or step by step tutorials for this ?

 

Is there a way to increase the timeout on an outbound message? I have an outbound message that generates product data on an external database but with a large amount of products this takes time. If the webservice times out it causes the data to be generated again. This is very very bad.

 

I could return immediately and process asynchronously but this defeats the object of outbound messaging. Just because the webservice is active it doesn't mean it will succeed.

  

I am trying to access the salesforce production environment using the eclipse plugin. I can do this with the sandbox but it doesn't appear to recognise my login credentials when I try to go into production. I can login fine via the web but in the logs for my user it says "Invalid Password" next to my login attempt. My password was not wrong and neither was my security token. What is going on here?
Hi, I am new to apex trigger programming, though a long-time programmer.

I would like to track the date and time of day when tasks are marked "Completed". This functionality is not captured by Due Date or Date of Last Activity.

trigger DateCompleted on Task ( before insert, before update )
{
try
{
// task.DateCompleted = todaysDate();
// task.TimeCompleted = now;
}
catch ( Exception ex )
{
}
}

I'd appreciate your help on this - also (and related), I looked around for some time, but could not find a resource with a bunch of example Apex triggers - this would be really helpful.
Hi
I have found an exception :

System.Exception: Too many SOQL queries: 101
I explain my problem with simple example.This example look like as my application:

public class class1
{
    void show()
    {
        for(Integer i=0;i<5;i++)
        {
            Double d1=class2.getData();
            Double d2=class3.getData();
        }
    }
public pageReference save()
{
show();
}
}




// Another Apex class


global class class2
{
    Webservice static Double getData()
    {
        Double d=0.0;
        for(Integer i=0;i<12;i++)
        {
            // perform SOQL Query
            //just like......
            for(Object__ c:[select id__c from Object__c])
            {
                d=c.id__c;
            }
        }
        return d;
    }
}

// Another Apex class



global class class3
{
   
Webservice static Double getData()
    {
        Double d=0.0;
        for(Integer i=0;i<12;i++)
        {
            // perform SOQL Query
            //just like......
            for(Object__ c:[select id__c from Object__c])
            {
                d=c.id__c;
            }
        }
        return d;
    }
}


When i call save() from visual force page i am getting exception Too many SOQL queries.
Please solve my problem.

Thanks & Regards
Brijesh Kumar Baser

A : List<Account> flstAccount = new List<Account>([select id from account]);
B: List<Account> flstAccount = [select id from account];

 What is the difference between A and B?

thank you.


Message Edited by china.leaf on 01-12-2009 11:24 PM
I have a Visualforce page that contains a javascript function:
 
Code:
       function reportSuccessOrFail()
        {
          try {
                 var success = sforce.apex.execute("ReadResult","GetResult",{});
                
                if(success ==true)
                    alert('Salesforce data successfully updated');
                else
                    alert('There was an error with the update');
                
            } catch (e) {
                alert(e.name + ' ' + e.message);
            }
        }

This uses the following apex class:

Code:
global class ReadResult{
    webservice static boolean GetResult()
    {
        boolean returnresult = false;
    
        DateTime timefrom = DateTime.now();
        DatabaseRequest__c[] dbr = [select Result__c from DatabaseRequest__c order by Time__c desc];
        
        if(dbr.size()>0)
        {
            returnresult  = dbr[0].Result__c;
        }
        
        return returnresult;
    }
} 

 
When I run it I get the error: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session
 
How do I fix this?


Message Edited by Praetorian65 on 01-07-2009 06:05 AM
Error: Compile Error: Initial term of field expression must be a concrete SObject: Datetime at line 53 column 61
 
Apex is driving me up the wall. I am trying to convert from a datetime to a date. Line 53 is in bold. It will not let me use licenseArray[i].StartDate to access the date (licenseArray is an array of License objects). I have successfully used licenseArray[i].StartDate in the creation of a custom object (License__c) but I need to change this object to have Date fields instead of DateTime. I am getting the data from a webservice which provides DateTime. StartDate and EndDate can both be null. How can I fix this?
 
Code:
        try{
            While(licenseArray.Size() > 0)
            {               
                for(Integer i = 0; i < licenseArray.Size(); i++)
                {
                    date endD;
                    date startD;
                    
                    if(licenseArray[i].StartDate != null)
                    {
                        //DateTime startDateTime = licenseArray[i].StartDate;
                        Integer startYear = licenseArray[i].startDate.Year;
                        Integer startMonth = licenseArray[i].startDate.Month;
                        Integer startDay = licenseArray[i].startDate.Day;
                        startD = date.newinstance(startYear,startMonth,startDay);
                    }
                    if(licenseArray[i].EndDate != null)
                    {
                        DateTime endDateTime = licenseArray[i].EndDate;
                        Integer endYear = endDateTime.Year;
                        Integer endMonth = endDateTime.Month;
                        Integer endDay = endDateTime.Day;
                        endD = date.newinstance(endYear,endMonth,endDay);
                    }
                                   
                    
                    License__c newLicense = new License__c(ContactName__c = licenseArray[i].ContactName, NetworkCode__c = licenseArray[i].NetworkCode, Period__c = licenseArray[i].Period,
                                            Number__c = licenseArray[i].Number_x, EndDate__c = endD, StartDate__c = startD);
                                            
                                            
                    myList.Add(newLicense);
                    if(myList.Size() == 1000)
                    {
                        myListList.Add(myList);
                        myList = new List<License__c>();
                    }
                    
                }   
                index = index + count;
                licenses = data.GetLicenseData(index,count);
                licenseArray = licenses.License;
            }
            
        } catch (Exception ex)
        {
            
        }