• James Kent
  • NEWBIE
  • 5 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 6
    Replies

Is it possible to create an image in memory using APEX? Something like the Graphics2D class in Java.

Hi all,

 

At present, I can create a Task via the web services but am unable to create a task of type email.  Does anyone lklnow how to create an email in salesforce via the webservices?

 

Cheers,

James

Hi,

 

Is it possible to use a custom button to change a page layout for a contact?  I have a number of related objects and the page is getting long.  Also -- the related objects are only relevant in certain contexts so being able to choose a template would be handy in managing the user's context.

 

Regards,

James

In my code stuff below, ID mapped from $Component.xxx is always blank in Javascript.
I tried all the below options. none of them worked
alert('{!$Component.studentName}')
alert('"{!$Component.studentName}"')

however it's mapped correctly in Visualforce code stuff, like
<apex:outputLabel value="{!$Component.studentName}"/>

any idea how to use $Component.xxx correctly in Javascript?

here's the sample code

 

<apex:page controller="LearnWebService1">
<apex:form >
<apex:pageblock >
<apex:messages />
<apex:pageBlockSection columns="1">
<apex:pageBlockSectionItem >
<apex:outputLabel value="{!$Component.studentName}"/> <apex:inputText id="studentName"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:commandButton value="Create Through Ajax Call" onclick="alert('{!$Component.studentName}')"/>
</apex:pageBlockButtons>
</apex:pageblock>
</apex:form>
</apex:page>

 

Hi all,

 

At present, I can create a Task via the web services but am unable to create a task of type email.  Does anyone lklnow how to create an email in salesforce via the webservices?

 

Cheers,

James

hi,

 

i import data though csv file but when data is more than 1000 then it gives me Error

 

 

System.LimitException: Regex too complicated

 

Can anybody give me Explanation ?

I'm writing an integration to a REST API that takes JSON as the API input. Several of the objects have properties like "number" and "currency" which are reserved words in Apex. So I've renamed those as "card_number", etc. I want to translate the Apex objects to JSON objects, which will create JSON objects with properties that don't correspond exactly with the API.

 

Is there a better way to fix the resulting JSON other than just doing string manipulation after the fact?

I'm new to Apex; though not to programming as such.

 

I have run into a situation where 2 AJAX requests to a controller method (action function) are running simulataneously and their flow of control depends on a shared variable (class level instance variable). Am facing a classic Race Condition - value set by one is not read by another.

 

Is there a way I can put a lock or mutex on a variable to make sure this doesn't happen?

 

Thanks in advance!

  • July 26, 2011
  • Like
  • 0

I am getting a ‘Regex too complicated’ error below when loading data into our org using the following process:

 

1) an email service to receive the CSV data,

2) an APEX class to split and validate the CSV data, and then

3) a set of @future calls to upsert the data.

 

The same data works in smaller volumes, but not beyond a certain threshold. This applies whether we reduce the number of rows, or reduce the width of certain columns of data by truncating them to 3000 characters (a small number of columns have 10,000 characters of text included). When we do either or both of these steps in any combination to reduce the file size, we don't get this problem. It’s not a problem with a specific badly formatted row either, because reducing the number of rows in various combinations always causes the problem to go away.

 

So we don’t believe it is actually a regex problem, because the regular expression is just finding commas to split up a comma separated file/string - i.e. it's very simple.

 

This is why we think there's an undocumented storage or capacity limit somewhere within the APEX processing that is being exceeded - but one that doesn't have a governor limit associated with it, or indeed an accurate error message. We think it is an erroneous error message - i.e. it's not to do with complicated regex – and that this error message is a symptom of another issue.

 

This error has occurred in code that has been stable to date, but has appeared since the filesize we're uploading has increased to beyond about 4600-4800KB, which seems to be the threshold beyond which this problem occurs. There seem to be some undocumented limits in the volume of data than can be processed using the solution architecture we've designed.

 

We want to be able to code around this problem, but unless we know exactly what the error is, any changes we make to our code may not actually fix the problem and result in wasted effort. So I don't want to start changing this until I know exactly which part of the solution needs to be changed!

 

I’ve raised this with Salesforce as a potential bug or to see if they could clarify any undocumented limits on processing large volume datasets using the process we’ve designed, but they seem to have decided it’s a developer issue so won’t help.

 

The error message is below:

 

Apex script unhandled exception by user/organization: 

Failed to invoke future method 'public static void PrepareCSV(String, String, String, Integer, Boolean)'

caused by: System.Exception: Regex too complicated

Class.futureClassToProcess.GetList: line 98, column 17
Class.futureClassToProcess.parseCSV: line 53, column 38
Class.futureClassToProcess.PrepareCSV: line 35, column 20 External entry point

 The relevant code snippet is below:

 

 

 

public static list<List<String>> GetList(String Content)
        {
        Content = Content.replaceAll(',"""',',"DBLQT').replaceall('""",','DBLQT",');
            Content = Content.replaceAll('""','DBLQT');
            List<List<String>> lstCSV = new List<List<String>>();
            Boolean Cont = true;
            while (Cont == true){
                List<String> lstS = Content.Split('\r\n',500);
                if(lstS.size() == 500){
                    Content =lstS[499];
                    lstS.remove(499);
                }else{
                    Cont = false;
                }
                lstCSV.add(lstS);
            }
            return lstCSV;
        }

 

Any suggestions gratefully received as to whether we're missing something obvious, whether 4MB+ files just can't be processed this way, or whether this might actually be a SFDC APEX bug.

 

 

 

public static list<List<String>> GetList(String Content)
        {
            //Sanjeeb
            Log('GetList started.');
            Content = Content.replaceAll(',"""',',"DBLQT').replaceall('""",','DBLQT",');
            Log('Replaing DBLQT.');
            Content = Content.replaceAll('""','DBLQT');
            Log('Replaing DBLQT.');
            List<List<String>> lstCSV = new List<List<String>>();
            Boolean Cont = true;
            while (Cont == true){
                List<String> lstS = Content.Split('\r\n',500);
                Log('Split upto 500 Rows.');
                //List<String> lstS = Content.Split('\r\n',1000);
                if(lstS.size() == 500){
                    Content =lstS[499];
                    lstS.remove(499);
                }else{
                    Cont = false;
                }
                lstCSV.add(lstS);
            }
            Log('GetList ends.');
            return lstCSV;
        }