• JPClark
  • NEWBIE
  • 125 Points
  • Member since 2009

  • Chatter
    Feed
  • 5
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 45
    Replies

Hi There. I have a simple controller and VF page.

Here's my controller:

 

 

public class RepPlanningController { public String selectedSegmentation { get; set; } public String selectedStatus { get; set; } public String selectedRating { get; set; } public String selectedFilterLetter { get; set; } public Id idOfEventAccount { get; set; } public List<AccEventRecord> recordDataList { get; set; } private Map<Id,Event> cachedAccEventsMap { get; set; } public class AccEventRecord { public Account acc { get; set; } public Event ev { get; set; } //Each event field in each record in the VF pageBlockTable bind to this property. public AccEventRecord(Account acc) { this.acc = acc; this.ev = new Event(); } } public void queryForAccounts() { recordDataList = new List<AccEventRecord>(); cachedAccEventsMap = new Map<Id,Event>(); for(Account a : [Select Name, Id, Activity_Rating__c, Visit_Threshold_Rating__c From Account ORDER BY Name ASC]) recordDataList.add(new AccEventRecord(a)); } public PageReference saveSingleEvent() { if(idOfEventAccount != null) { for(AccEventRecord aer : recordDataList) { if(aer.acc.Id == idOfEventAccount) { System.debug('***** ACCOUNT TO ADD EVENT TO IS: ' + aer.acc.Name + ' : ' + aer.ev.ActivityDate + ' : ' + aer.ev.Subject + ' : ' + aer.ev.Type); break; } } } return null; } }

 and here's my VF page:

 

 

<apex:page controller="RepPlanningController" action="{!queryForAccounts}" tabStyle="Account" id="VFPage"> <apex:sectionHeader title="Cuenta" subtitle="Planificación" /> <apex:form style="padding-top:15px;"> <apex:pageBlock title="Todas Cuentas" id="accountTable"> <apex:pageBlockTable value="{!recordDataList}" var="accountRec" style="width:100%;"> <apex:column > <apex:facet name="header">Account Name</apex:facet> <apex:commandLink value="{!accountRec.acc.Name}" /> </apex:column> <apex:column > <apex:facet name="header">Event Date</apex:facet> <apex:inputField value="{!accountRec.ev.ActivityDate}" /> </apex:column> <apex:column > <apex:facet name="header">Event Subject</apex:facet> <apex:inputField value="{!accountRec.ev.Subject}" /> </apex:column> <apex:column > <apex:facet name="header">Event Type</apex:facet> <apex:inputField value="{!accountRec.ev.Type}" /> </apex:column> <apex:column style="padding-top:8px;"> <apex:commandLink action="{!saveSingleEvent}" value="Guardar" immediate="true" styleClass="btn" style="color:#FFF; padding:2px 5px 2px 5px; text-decoration:none;"> <apex:param value="{!accountRec.acc.Id}" assignTo="{!idOfEventAccount}" name="{!accountRec.acc.Id}" /> </apex:commandLink> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>

 Unfortunately the system.debug in my controller method saveSingleEvent
 
always shows the Event fields as null for some reason even though there are inputFields binding

to the Event SObject in the class AccEventRecord. Has anyone got any ideas?
This is urgent!

 

many thanks

 

 

 

  • August 20, 2009
  • Like
  • 0

Hi

 

I have a visualforce controller with the following kind of get method

 

 

// For error handling public Boolean error { get{ if(error == null) error = false; return error; } set; }

 I want to cover these lines in my test method.I tried using .getError() but it says method doesn't exists or in correct signature. Can someone let me knowhow to cover these lines test method?

 

 

Hi,

 

I have an .net application utilizing salesforce api and I would like to update collection of sobject, but first to check which fields have been update withing specific date range if they fall under this range update them if not continue to the next field of the object and check if update necessary.

 

The main objective is to update only the value in fields from one object that fall withing the last modified date range.

 

Any help will be appreciated.

 

Thank you in advance.

  • August 04, 2009
  • Like
  • 0

Here is a RULE that makes no sense to me. 

 

 

"An Apex script contained in an unmanaged package that explicitly references a namespace cannot be uploaded"

[page 171 of the Apex Lanaguage Reference] 

 

Why can you develop with a namespace and not be allowed to upload it in an unmanaged package?

The namespace is still part of the unmanaged package. The custom buttons and links require the namespace, even in an unmanaged package.

Maybe there's a reason for it, but it just don't makes sense to me. Without the namespace, you don't even get the text highlighting in Eclipse.

 

 

All the Unit Tests pass, but ... 

I'm attempting to upload an UNMANAGED package from a development ORG and I get this message each time for a unit test class:

 

Package Upload Error

There are problems that prevent this package from being uploaded.

  

Component Type      NameProblem
Apex Class                            <Name of test class>                  line -1, column -1 

 

I remove the test class from the package and try to upload and it fails on another test class.

This wasn't a problem until we built a managed package. Now it seems impossible to get a package to upload.

This occurs after the propmt to enter the version number and description (which occurs after the unit testing).

 

Can making a managed package stop you from creating unmanaged packages?

I have a Custom Setting object (hierarchy style) that has two fields of  'Email' types. I've added values to them at the ORG level, and nothing at the profile or user level. I want to retrieve one of the email values as a string in Apex. Thinking these were static objects, just get the values from them.

 

Since there isn't an update to the IDE addin yet for Winter 10, had to add this code using the web editor:

String userEmail = i360_eLead_Settings__c.Appointment_Request_Notification__c; User userId = [SELECT ID FROM User WHERE Email = :userEmail];

 

 

This code gives us:
ErrorError: Compile Error: Illegal assignment from Schema.SObjectField to String at line 67 column 9 

 

 

So I tried using the r instead of c:

String userEmail = i360_eLead_Settings__r.Appointment_Request_Notification__c;

 

 

And received:
ErrorError: Compile Error: Variable does not exist: i360_eLead_Settings__r.Appointment_Request_Notification__c at line 67 column 28 

 

 

I have not been about to find any examples for using these custom settings.

Has anyone found out how these work?

 

 

 

 

 

 

We're trying to send out ICS attachments for calendar requests, but we can't seem to get this new feature to work correctly.

 

Are there any examples in apex to use these changes?

Are there any special configuration changes necessary?

 

I've done this many, many times, but today it is failing to work. All the other WSDLs download without a problem.

 

When I try right clicking on Generate Enterprise WSDL , and selecting Save Target As ...

I get this error:

 

WSDL ErrorInternet Explorer cannot download WSDL.jsp from na6.slaesforce.com.

Internet Explorer was not able to open this Internet site. The requested site is either unavailable to cannot be found. Please try again later.

 

 

 

JPC

I have several methods in Apex classes, most of them are public static methods.

I've written C# code to move large chunks of data up to the ORG and need to call a couple of the Apex methods for the final cleanup.

 

I've already got a web reference using the enterprise WSDL and can create my custom objects and insert them into the ORG.

 

What is my next step to call into the Apex code?

 

Thanks,

Jeff

When attempting to "Refresh from Server" in Eclisp  I'm getting this error:

Severity and Description Path Resource Location Creation Time Id Refresh error: Unable to retrieve file for id 00h80000001zSig of type Layout due to an internal error:1156419708-664 (-1741087027) i360CrmLite/src package.xml line 1 1242654231283 7255

 

 

 

This started happening Monday (May 18th, 2009) morning and worked correctly last Friday.

 

Additionally, I have another development org that I have sunc'd with this one and seems to be failing the same way:

Severity and Description Path Resource Location Creation Time Id Refresh error: Unable to retrieve file for id 00h80000001zVZn of type Layout due to an internal error:1232875371-384 (-1741087027) MyDevForce/src package.xml line 1 1242656886007 7257

 

 

 

Different ID and error number, but I'm currently assuming they are the same problem. Both worked last Friday.

 

Is anyone familiar with this type of error? I found a couple similar posts, but they didn't show any resolution.

 

Thanks,

 

Jeff

I'm attempting to query the service using the ListMetadataQuery and the ListMetadata() method for:

Documents, Email Templates, Reports, and Dashboards.

 

These items require a value in the ListMetadataQuery.folder value. But I'm unable to determine (via the API) the names of the folders.

 

When I initially call the describeMetadata(), it returns these components in the DescribeMetadataResult.metadataObjects. It also shows that these are in a folder

(DescribeMetadataObject.inFolder = true), but I cannot find a clue as to the names of the folders.

 

/// <summary> /// BuildMetadata queries the server for all the names of components (types) /// in the org. /// </summary> /// <returns>A Package object containing information for each type</returns> public Package BuildMetadata() { Package package = new Package(); package.version = apiVersion.ToString(); try { SortedDictionary<string, PackageTypeMembers> alltypes = new SortedDictionary<string, PackageTypeMembers>(); // Assuming that the SOAP binding has already been established. DescribeMetadataResult res = metaService.describeMetadata(apiVersion); if (res != null && res.metadataObjects.Count() > 0) { foreach (DescribeMetadataObject obj in res.metadataObjects) { if (obj.childXmlNames != null) { foreach (string name in obj.childXmlNames) { if (name != string.Empty) { PackageTypeMembers childcomponent = new PackageTypeMembers(); //childcomponent.name = obj.xmlName + "." + name; childcomponent.name = name; alltypes.Add(childcomponent.name, childcomponent); } } if (!alltypes.ContainsKey(obj.xmlName)) { PackageTypeMembers parentcomponent = new PackageTypeMembers(); parentcomponent.name = obj.xmlName; alltypes.Add(parentcomponent.name, parentcomponent); } } else { if (!alltypes.ContainsKey(obj.xmlName)) { PackageTypeMembers component = new PackageTypeMembers(); component.name = obj.xmlName; alltypes.Add(component.name, component); } } } } package.types = alltypes.Values.ToArray(); } catch (Exception ex) { Console.WriteLine("\nFailed to describe metadata, error message was: \n" + ex.Message); throw ex; } return package; } /// <summary> /// listMetadata retrives all the members of the requested component (type) /// </summary> /// <param name="component">Name of component (Report, CustomObject, ApexClass)</param> /// <returns>A list of names of the objects of that type</returns> public List<string> listMetadata(string component) { SortedList<string, string> results = new SortedList<string, string>(); FileProperties[] lmr = null; try { string optionalFolder = ""; string comp = component; if (component.Contains(".")) { string[] path = component.Split('.'); optionalFolder = path[0]; comp = path[1]; } // <=== These are hard coded folder names, because I don't know how to // find the names of the folders to request else if (component == "Dashboard") optionalFolder = "My Personal Dashboards"; else if (component == "Document") optionalFolder = "My Personal Documents"; else if (component == "EmailTemplate") optionalFolder = "My Personal Email Templates"; else if (component == "Report") optionalFolder = "My Personal Custom Reports"; ListMetadataQuery query = new ListMetadataQuery(); query.folder = optionalFolder; query.type = comp; try { lmr = metaService.listMetadata( new ListMetadataQuery[] { query }); } catch (Exception ex) { Console.WriteLine("\nFailed to list metadata, error message was: \n" + ex.Message); } if (lmr != null) { foreach (FileProperties n in lmr) { if (!results.ContainsKey(n.fullName)) results.Add(n.fullName, n.fullName); Console.WriteLine("Component fullName: " + n.fullName); Console.WriteLine("Component type: " + n.type); } } } catch (Exception ex) { Console.WriteLine("\nFailed to list metadata, error message was: \n" + ex.Message); throw ex; } return results.Values.ToList(); }

 

 

I'm using the metadata API and deleting some of the custom fields on custom sobjects. I'm able to get them deleted, but when I go into SalesForce Web, I then have to erase the deleted fields.

 

Is there any way to programatically erase the fields also?

 

 

Here's the code that is deleting the fields.

private List<AsyncResult> ThrottledDelete(List<Metadata> deleteItems, int ThrottleSize) { List<AsyncResult> AllResults = new List<AsyncResult>(); while (deleteItems.Count() > 0) { List<Metadata> SmallList; if (deleteItems.Count() < ThrottleSize) { SmallList = deleteItems; deleteItems = new List<Metadata>(); } else { SmallList = deleteItems.GetRange(0, ThrottleSize); deleteItems = deleteItems.Except(SmallList).ToList(); } AsyncResult[] results = metaService.delete(SmallList.ToArray()); results = WaitForResults(results, 1000); AllResults.AddRange(results); } return AllResults; }

 

 

Thanks for any input,

Jeff

Here is a RULE that makes no sense to me. 

 

 

"An Apex script contained in an unmanaged package that explicitly references a namespace cannot be uploaded"

[page 171 of the Apex Lanaguage Reference] 

 

Why can you develop with a namespace and not be allowed to upload it in an unmanaged package?

The namespace is still part of the unmanaged package. The custom buttons and links require the namespace, even in an unmanaged package.

Maybe there's a reason for it, but it just don't makes sense to me. Without the namespace, you don't even get the text highlighting in Eclipse.

 

 

Hi,

 

I have created some batch apex code alongwith other triggers and class/controller codes. 

 

When I run individual test methods on them, I am able to get test success result alongwith nice code coverage %. However when I run all tests together, I get following test failure errors:-

 

1)System.AsyncException: Database.executeBatch cannot be called from a batch or future method.

2)System.AsyncException: Future method cannot be called from a future method: changeOwners(String, String)

3)System.AsyncException: Future method cannot be called from a future method: getLead_Rollup_Amount(Id)

4)System.AsyncException: Future method cannot be called from a future method: changeOwners(String, String)

 

Please note again that the exceptions dont come when tested individually.

 

Please advise on same.

 

 

Thanks,

 

Vimal 

All the Unit Tests pass, but ... 

I'm attempting to upload an UNMANAGED package from a development ORG and I get this message each time for a unit test class:

 

Package Upload Error

There are problems that prevent this package from being uploaded.

  

Component Type      NameProblem
Apex Class                            <Name of test class>                  line -1, column -1 

 

I remove the test class from the package and try to upload and it fails on another test class.

This wasn't a problem until we built a managed package. Now it seems impossible to get a package to upload.

This occurs after the propmt to enter the version number and description (which occurs after the unit testing).

 

Can making a managed package stop you from creating unmanaged packages?

I have a Custom Setting object (hierarchy style) that has two fields of  'Email' types. I've added values to them at the ORG level, and nothing at the profile or user level. I want to retrieve one of the email values as a string in Apex. Thinking these were static objects, just get the values from them.

 

Since there isn't an update to the IDE addin yet for Winter 10, had to add this code using the web editor:

String userEmail = i360_eLead_Settings__c.Appointment_Request_Notification__c; User userId = [SELECT ID FROM User WHERE Email = :userEmail];

 

 

This code gives us:
ErrorError: Compile Error: Illegal assignment from Schema.SObjectField to String at line 67 column 9 

 

 

So I tried using the r instead of c:

String userEmail = i360_eLead_Settings__r.Appointment_Request_Notification__c;

 

 

And received:
ErrorError: Compile Error: Variable does not exist: i360_eLead_Settings__r.Appointment_Request_Notification__c at line 67 column 28 

 

 

I have not been about to find any examples for using these custom settings.

Has anyone found out how these work?

 

 

 

 

 

 

We're trying to send out ICS attachments for calendar requests, but we can't seem to get this new feature to work correctly.

 

Are there any examples in apex to use these changes?

Are there any special configuration changes necessary?

 

I've done this many, many times, but today it is failing to work. All the other WSDLs download without a problem.

 

When I try right clicking on Generate Enterprise WSDL , and selecting Save Target As ...

I get this error:

 

WSDL ErrorInternet Explorer cannot download WSDL.jsp from na6.slaesforce.com.

Internet Explorer was not able to open this Internet site. The requested site is either unavailable to cannot be found. Please try again later.

 

 

 

JPC

Does anyone know how to use setContentType and setInline methods on EmailFileAttachment? There is no documentation on code usage in the Winter 10 Release notes.

 

I'm trying to send an iCal invite from Apex. I would think the MIME content type would be text/Calendar but I'm not sure how to set that.

 

Thanks,
Rich 

  • October 03, 2009
  • Like
  • 0

I am trying to save user specific information in a custom object. However I am unable to create or update a record in my table. My table just has two columns, one is a reference to the user, one is a reference to a second custom object (to store the user's selection). I can create and edit entries using the default interface of salesforce and selecting entries from the controller works ok. I am unable to catch an exception (either with general exception or DMException). There is no information in the system log, even at the finest level.

 

I have a similar problem when updating. There I do not create my object using new but using a select statement.

 

Here is the essential part of my code

 

try

{

UserSettings__c settings = new UserSettings__c ();

settings.Product__c = (Id) product;

settings.User__c = (Id) Userinfo.getUserId ();

Database.SaveResult saveResult = Database.insert (settings);

System.debug(saveResult);

System.debug(System.LoggingLevel.DEBUG, 'Inserted settings);

}

catch (Exception e)

{

System.debug(System.LoggingLevel.DEBUG, e);

System.debug(System.LoggingLevel.DEBUG, 'Failed to insert settings');

}

 

In the system log everything comes out on one line (something to do with the error)

 

line 57, column 21: SOBJECT:BvD_UserSettings__c lsettings.Product__c <= Cast 20090922084653.442:Class.BvDProductSelectionController.setCurrentProduct:

line 58, column 21: SOBJECT:UserSettings__c settings.User__c <= Id userId 20090922084653.442:Class.BvDProductSelectionController.setCurrentProduct:

line 59, column 21: DeclareVar: Database.SaveResult saveResult 20090922084653.442:Class.BvDProductSelectionController.setCurrentProduct:

line 59, column 55: Database.insert(SOBJECT:UserSettings__c) 20090922084653.442:External entry point: Exiting user sharing mode Cumulative profiling information:

 

followed by all timings of the sql queries, including the insert query

 

Database.insert(SOBJECT:UserSettings__c): executed 1 time in 0 ms 3

 

And ending with the message that there was an error

 

j_id0:j_id1:j_id2:j_id4: An error occurred when processing your submitted information. ***Ending Page Log for /apex/BvDProductSelection?sfdc.tabName=01r70000000Pv9C

 

 

 

 

Hi,

 

I want the user to be redirected to the parent page of the current view when he/she clicks save. So say I have an object Building__c and inside it I have Storage__c. The user clicks on a storage for a building to edit it and after he's done editing he clicks on Save. Now I want him to be redirected to the Building view.

 

Thanks.

  • September 22, 2009
  • Like
  • 0

Hi there!

We're a Salesforce customer and evaluating expanding its use.  As such, we were wondering if there is an existing utility/connector that ties in to Microsoft's Visual Studio Team System -- i.e. something that would sending certain tickets to TFS as a work item and when the work item changes it would send the changes back to Salesforce.  Or is this something we'd have to write ourselves using the SDK.  TIA!

-Dan 

  • August 20, 2009
  • Like
  • 0

Helo All,

 

I have a situation where I have to load a large number of records using Salesforce webservice API.  With the current limit on the number of records (200) per API call, it is taking about 6 hours in total (with 50 cocnurrent threads). Is there any way to bump that number from 200 to a higher number, even by means of contacting Salesforce with a special request for the enterprise.

 

Note: We have enterprise license.

 

Thanks,

Ramana Maddikunta 

  • August 12, 2009
  • Like
  • 0

Hi,

 

I have an .net application utilizing salesforce api and I would like to update collection of sobject, but first to check which fields have been update withing specific date range if they fall under this range update them if not continue to the next field of the object and check if update necessary.

 

The main objective is to update only the value in fields from one object that fall withing the last modified date range.

 

Any help will be appreciated.

 

Thank you in advance.

  • August 04, 2009
  • Like
  • 0

Hi to all,

 

How to create Salesforce workflow Using .net code???

 

Is there any options???

 

or

 

How to integrate Windows workflow Foundation & salesforce to create workflow in Salesforce???

 

 

thanks,

Krishna.

Code:
            var rebateTrigger = new ApexTrigger();
            rebateTrigger.apiVersion = 14.0;
            rebateTrigger.fullName = "Contact.OnUpdateRebateContact";
            rebateTrigger.content = GetResourceFile("SourceCodes.ContactRebateUpdateTrigger.txt");
            
            metaApi.create(new[] { rebateTrigger });

That is how I try to add a trigger. 
But why do I receive
INVALID_TYPE: This type of object is not available for this organization 
?

SourceCodes.ContactRebateUpdateTrigger.txt contains trigger source code that is correct. I take its source code and cast it to byte[] to assign to content property.
Help please.

PS. I have a namespace prefix set in my organization. Maybe that's the case?



Message Edited by Doker on 11-30-2008 01:55 PM
  • November 30, 2008
  • Like
  • 0
So I never thought I would be hitting this limit but here I am. I did a search on this and nothing came up so it looks like I'm one of the few to hit this limit.

Maximum view state size limit (128K) exceeded. Actual viewstate size for this page was 174.281K.

Hmm. So what can I do to measure this and control it. Is there any field I can output to monitor what my viewstate while developing?

Thanks,
Jason




Message Edited by TehNrd on 08-26-2008 03:03 PM
  • August 26, 2008
  • Like
  • 0