• BGrimes
  • NEWBIE
  • 55 Points
  • Member since 2007

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 27
    Questions
  • 45
    Replies

 

trigger UpdateReportsTo on User (after update) {
// user.Reports_to__c is a USER Id // contact ReportsTo is a CONTACT Id
 for (User u : Trigger.New) { if(u.Reports_to__c != null && u.Contact_Id__c != null){ // does the new Reports_to__c user have a contact id? User mgr = [Select Id, Contact_Id__c FROM User Where Id = :u.Reports_to__c]; if(mgr.Contact_Id__c != null){ // user has the contact linkage needed // update the target's contact record.ReportsTo with the mgr.Contact_Id__c value Contact targetmgr = [Select Id From Contact Where Id = :mgr.Contact_Id__c];   Contact userContact = new Contact(Id = u.Contact_Id__c); userContact.ReportsTo = targetMgr; update(userContact);  } } }}

 

The above trigger isn't firing both in unit tests as well as in the UI.  I get no errors...just no update to the contact record.  Any ideas at all?

 

Thanks.

 

I'm working on some functionality that alters sharing rule on custom objects.  I'm looking to create general methods like:

CreateReadonlyShare(recordId, userId, object) where the calling code injects the object into the method.  Is is possible to create a generic in Apex?  I can't seem to find anything other than sObjects which might work here, but I'm still curious.

 

Thanks.

 

I'm working on a simple proof which uses the Metadata API.  As I understand it you login to the standard data API and set the Metadata svc session values then you can make calls.  Here's a sample of that (I have another wrapped assembly that handles all data calls).

internal MetaWrapper()
        {
            _svc = new sforce_meta.MetadataService();
            _wrapper = new MetadataWrapper();

            Main.sforce.LoginResult _lr = _wrapper.Login();
            _svc.SessionHeaderValue = new sforce_meta.SessionHeader {sessionId = _lr.sessionId};
            _svc.Url = _lr.serverUrl;
        }

That's all fine and dandy and I can see in my watch that I have a session URL and Id set. URL in this instance is :

Url    "https://cs3-api.salesforce.com/services/Soap/u/18.0/00DQ0000000Ahhk"

 

Now at this point I'm just trying to do a simple query on all custom objects to test the connectivity and whatnot. 

 

sforce_meta.ListMetadataQuery query = new  sforce_meta.ListMetadataQuery {folder = null, type = "CustomObject"};

sforce_meta.FileProperties[] prop = _svc.listMetadata(new sforce_meta.ListMetadataQuery[] {query}, 20);

 

Here's the error I always get:

 

 

[System.Web.Services.Protocols.SoapHeaderException]    {"No operation available for request {http://soap.sforce.com/2006/04/metadata}listMetadata"}

 

Am I missing something simple?  Do I need to do something different withthe URL returned from the data svc binding? I've tried using various other API versions as the second arg in the listMetadata() method, with the same results.

 

Any direction at all would be helpful.

 

-Bryan

I can't find anything that says yes or no, but then again I can't find anything that lets me pull as well.  I have some requirements where using standard workflow rules as the Business Rules Engine would make life 100 times easier and the code insanely flexible....but all of this hinges on being able to pull workflow rules and then figure out a way to make sense of them.  Am I out of luck?

 

Thanks.

Until Salesforce gives us some way to organizing files my org is stuck with 200+ classes, triggers, etc lumped onto one page view.  In the past we've come up with naming schemes to try and keep files together, but that stops really working after 70 or so files IMO.  Has anyone else tried to implement some type of naming convention or organization to the mess of classes and triggers?

 

I'm getting more pressure to do more Apex-only development for small projects (ROI I suppose), but it's hard when I know I can just create a .NET sln and then be able to FIND (not to mention debug) the classes 6 months down the road. 

 

Bryan

Hi -

 

I'm trying to see if there is any documentation or if anyone has done this.  I have a custom object that will have an approval process tied to it.  We're designing some .NET pages to handle the front end of all of this, but the issue I have is that I need a user to be able to invoke, or start, the approval.  Is this possible?  Right now my workaround on paper is to have the page be the custom object's page, or even a VF page, and use an IFRAME for the .NET stuff, but that seems hacked at best.

 

Any help would be greatly appreciated.  Thanks.

 

- Bryan

I know that unit tests are private, so this might be a no go.  But is it at all possible, in the confines of Salesforce's platform, to create a master test that in turn runs all tests?  With the private scope of tests it's a nightmare to track down various classes and currently we have over 250 individual tests with about 40 more to deploy this week in another project.  It is possible to set something up to run unit tests daily?  This is to catch rogue admins who add validation rules (the bane of Salesforce) which kill classes and in turn unit tests.

 

Before I post this to ideas.salesforce.com, to watch it sit idle, is there something I'm missing with unit test set up?

 

Cheers.

Bryan

I've gotten maybe 10 of these from an integration we have that simply pulls Contract records from production.  Iv'e had these one and off (maybe like 1 every 10 days) for a couple months, but this morning I've gotten just a landslide.    Using reflector, the endpoint I'm pointing to currently (in the app config) is: "https://www.salesforce.com/services/Soap/u/16.0".  

 

Is there something change that I missed or something like that with Salesforce connectivity?  Thanks. 

 

Machine: CSMSIIS1

Date: 2/19/2010 8:12:40 AM

Type: System.Net.WebException

Assembly: CSG.MSI.Contracts.SFDCWrapper, CSG.MSI.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

Codebase: file:///C:/Program Files/Metastorm BPM/Engine/dotnetbin/CSG.MSI.Contracts.DLL

Message: The underlying connection was closed: An unexpected error occurred on a receive.

Source: CSG.MSI.Contracts

Stacktrace:    at CSG.MSI.Contracts.SFDCWrapper.ExecuteSOQL(String soql) in C:\Documents and Settings\bryang\Desktop\CSG.MSI.Contracts\CSG.MSI.Contracts\DAL\Util\SFDCWrapper.vb:line 127

   at CSG.MSI.Contracts.SFDCContractMapper.SelectMultipleInternal(String SOQL) in C:\Documents and Settings\bryang\Desktop\CSG.MSI.Contracts\CSG.MSI.Contracts\DAL\Data\Mappers\SFDCContractMapper.vb:line 77

   at CSG.MSI.Contracts.SFDCContractMapper.Select(String id) in C:\Documents and Settings\bryang\Desktop\CSG.MSI.Contracts\CSG.MSI.Contracts\DAL\Data\Mappers\SFDCContractMapper.vb:line 25

   at CSG.MSI.Contracts.ContractStatus.GetContractStatus(String contractid) in C:\Documents and Settings\bryang\Desktop\CSG.MSI.Contracts\CSG.MSI.Contracts\BLL\ContractStatus.vb:line 6

   at CSG.MSI.Contracts.Contract.GetContractStatus(String contractId) in C:\Documents and Settings\bryang\Desktop\CSG.MSI.Contracts\CSG.MSI.Contracts\Contracts.vb:line 6

Exception Custom Data: 

SOQL Statement = SELECT Id, AccountId, OwnerId, Status, Opportunity__c, Contract_Status__c, Contract_Begin_Date__c, Contract_Type__c  FROM Contract  WHERE Id = 'XXXXXXX'  

 

Any ideas would be most welcome.  Thanks. 

Since this morning (8 AM Eastern) I'm getting random errors in various apps that read/write to Salesforce (na3 specifically).  These errors are apparently from the XML and .NET treats them differently in various scenarios.  As of right now I've changed our main middle layer's API from 17 to 16 and that allowed events and opportunities to be read from and written to.  But now it looks like task creation is failing, and that works all day everyday.  Is it possible that we're the only org having this problem today?  I don't get it...  

 

here's pert of an error email:

 

Date: 2/15/2010 1:54:58 PMType: CSG.Exceptions.CSGExceptionAssembly: CSG.Salesforce.sObjects.Task, MiddleTier, Version=1.5.9.0, Culture=neutral, PublicKeyToken=nullCodebase: file:///C:/XXXXXX/MiddleTier.DLLMessage: There is an error in XML document (1, 672).Source: MiddleTierStacktrace: at CSG.Salesforce.sObjects.Task.CreateUserTask(String SalesforceID, String Subject, String Comments, DateTime DueDate, Uri TaskURL, String Priority, String Status) at CSG.Salesforce.sObjects.Task.CreateUserTask(String SalesforceID, String Subject, String Comments, DateTime DueDate, String eFolderID, String Priority, String Status) at CSG.Salesforce.Functions.CreateUserTask(String SalesforceID, String Subject, String Comments, DateTime DueDate, String eFolderID, String Priority, String Status) at CSG.MSI.Fulfillments.Fulfillments.CreateScrubTask(String eFolderID, String Subject, String Comments, DateTime DueDate)Exception Custom Data: eFolderID = 0000000000000000000000000029166 Subject = Letter Scrubbing Comments = There are 291 records to be scrubbed today DueDate = 2/15/2010 1:54:55 PM

 Any insight would be helpful.

 

 

Hi - I'm having a problem doing something in an Apex classe/trigger that I've been able to do in .NET, and that is add users to the AccountTeamMember object and then set their AccountShare access levels.  Currently I have a trigger that fires and at the tail end of it calls a class that will insert group members onto the account team (AccountTeamMember table) and then attempts to set their access levels.  I get the members added as well as the access levels set..both verified by my unit tests. Here is my test after adding two members to the account team, setting their access and then verifying the results (once I parse out the other team members/sharing users that I don't care about):
 

20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 108, column 11: listMembers size = 220100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 111, column 41: SOQL query with 4 rows finished in 3 ms20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 113, column 4: listAccessShare size = 420100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 117, column 4: SelectLoop:LIST:SOBJECT:AccountTeamMember20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 119, column 5: SelectLoop:LIST:SOBJECT:AccountShare20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 119, column 5: Number of iterations: 420100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 119, column 5: SelectLoop:LIST:SOBJECT:AccountShare20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 119, column 5: Number of iterations: 420100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 117, column 4: Number of iterations: 220100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 127, column 10: listShare size = 220100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 130, column 11: SelectLoop:LIST:SOBJECT:AccountShare20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 134, column 13: user: USERXXXXXXX account access: Edit20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 135, column 13: user: USERXXXXXXX contact access: Edit20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 136, column 13: user: USERXXXXXXX oppty access: None20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 137, column 13: user: USERXXXXXXX case access: None20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 134, column 13: user: USERYYYYYY account access: Edit20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 135, column 13: user: USERYYYYYY contact access: Edit20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 136, column 13: user: USERYYYYYY oppty access: None20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 137, column 13: user: USERYYYYYY case access: None

It all looks good in the unit tests.  But when I try this in the UI the trigger fires as expected, but the results are that the two people have Read Only for account and contact, and None for opportunity and case (which I'm cool with).

 

Any ideas?   I can also query Salesforce db and see that they two people are in the AccountShare table with the PROPER access rights...but still nothing in the UI.  Am I missing something on the AccountTeamMember table?  I want to alter the AccountAccessLevel value there, but it's not accessable in the API.  

 

I'm beyond stuck on this one.  

 

Cheers,

Bryan 

Hi - I'm stuck and maybe this will help me out. 

 

Here's the setup:  I'm working on a solution where there is a related list off of the Case object.  This related object is a mater detail to Case.  I've overridden both the New and Edit with VF pages.

 

The rub here is that the VF page needs to honor the parent case's record type, to then show the correct VF page which all just differ in layout only (they share the same extension).  Ok, so what I have is just Javascript in a "Gateway" page that then redirects to the proper VF page for input.

 

Ok, so here's a snippet of the Gateway page:

 

apex:form > <script type="text/JavaScript" src="/js/functions.js"></script> <script src="/dJS/en/1196898152000/library.js" type="text/javascript"></script> <script src="/soap/ajax/17.0/connection.js" type="text/JavaScript"></script> <script> sforce.connection.sessionId = '{!$Api.Session_ID}'; var caseId = '{!NewObj__c.Case__c}'; var caseNumber = ''; var website = "https://na3.salesforce.com"; if (window.top.location.href.indexOf('//na3.salesforce') == -1) { website="https://cs3.salesforce.com"; } /* REMOVED THE SOQL CALLS FOR THE SAKE OF SPEEDING UP THE PAGE LOAD CONFIG THE REC TYPE IDS FOR PRODUCTION WHEN RELEASING */ var bvipRecordTypeId = 'xxx'; var clientSolutionRecordTypeIds = 'xxx,xxx,xx,xx'; var marketingRecordTypeIds = 'xxx,xx,xx,xx'; var caseRecordTypeId = findCaseRecordTypeId(); var caseFieldId = 'CF00N50000001or5d'; if (caseRecordTypeId == '' ) alert('Error: Record Type not found, please contact support'); function findCaseRecordTypeId() { var recordType = sforce.connection.query("Select CaseNumber, RecordTypeId from Case where Id = '" + caseId + "'"); var rit = new sforce.QueryResultIterator(recordType); while(rit.hasNext()) { var r = rit.next(); caseNumber = r.CaseNumber; return r.RecordTypeId; } return ''; } if(bvipRecordTypeId.indexOf(caseRecordTypeId) >= 0){ // BVIP Case window.parent.location.href = website + '/apex/BVIPOverride?' + caseFieldId + '=' + caseNumber + '&' + caseFieldId + '_lkid=' + caseId + '&scontrolCaching=1&retURL=%2F' + caseId + '&sfdc.override=1'; } else if(clientSolutionRecordTypeIds.indexOf(caseRecordTypeId) >= 0) { // CS Case window.parent.location.href = website + '/apex/CSOverride?' + caseFieldId + '=' + caseNumber + '&' + caseFieldId + '_lkid=' + caseId + '&scontrolCaching=1&retURL=%2F' + caseId + '&sfdc.override=1'; } else if(marketingRecordTypeIds .indexOf(caseRecordTypeId) >= 0) { // Marketing Case window.parent.location.href = website + '/apex/MarketingOverride?' + caseFieldId + '=' + caseNumber + '&' + caseFieldId + '_lkid=' + caseId + '&scontrolCaching=1&retURL=%2F' + caseId + '&sfdc.override=1'; } else { alert('Error: Record Type not found, please contact support'); } </script> </apex:form>

 You'll see that I'm calling a SOQL query to see what the parent case's record type is, then using that Id in some logic. 

 

This works.  But the problem is that with this page rendering, the SOQL call, and then the redirect to the other page which renders, it'll take 5-6 seconds for the final page to render.  Not acceptable.

 

All of this would be solved if I could do something like {!NewObj.Case__r.RecordTypeId} but that always returns a blank string, so I guess that's out in the JS API.  

 

Is it possible to create a property to hold the record type Id in the Controller Extension (class) an then access that property via JS?  Or would I be better off to create a Component for all of this with an exposed property and then wire the page up to the Component?  I'm not 100% at all on the architecture of VF pages, but this seems so simple yet my current solution is a hack at best, and I'd like to get this to load in like 2 seconds.

 

Any pointers here would be most welcome.

 

Cheers,

Bryan

 

Hi -

 

I have a question on something that I've done in the past, but can't recall how I did it.  I need to query account teams, to pull a list of all people of a certain role and their access to the case object.  

 

The hitch here is that the AccountTeamMember table is just the Account access.  Ok.  So then I go to the UserAccountTeamRole table and see that the columns are there that I want, UserId and CaseAccessLevel.  Super!

 

But

 

When I query that table via SQL or Apex Explorer I only get 148 UserAccountTeamMember records returned.  That's like 1% of the account team data.  Am I just missing something?

 

I think in the past I was able to pull the team role data using te UserId as the Key between AcccountTeamMember and UserAccountTeamMember with no problem.  But now I get 1% of the access data for some reason.

 

Has anyone else done this before?  I'm missing something, and of cource Salesforce doesn't support anything regarding what I'm trying to do.

 

Thanks 

- Bryan

Hello  -

we are trying to create new (and even just a simple update) APEX classes and triggers in our Sandbox.  We were 'upgraded' about a week ago to Summer '08...and now we cannot connect via the Force.com IDE/Eclipse.  We can't be the only ones with this problem, yet at the same time there seems to be nothing out there for help on this.

Does anyone have any idea what might going on here?  We're on na3 if that matters at all.  This is just the latest is what is now a broken Sandbox integration with Summer '08.

Thanks.
Bryan
    Hello. 

I have an odd issue that appears to have been occuring since users were given the Console view.  When cloning a case we override the retURL to redirect to an integration s-control.  All is fine and well when you do this outside of the Console as the javascript is: window.top.location.href = redirectURL.

Great.  the problem is that this fails with the Console is sends the user outside of by virtue of 'window.top'.  Now, if I replace that line with: window.location.href = redirectURL, it works while int he Console, but when cloning a case in the normal tab view, only the right frame is affected, and it looks off.

Is it possible to use something like document.referrer to tell me if they're in the Console and then to set the location accordingly?  In playing around, this is what I get as the referrer when cloning a case in the Console:

https://tapp0.salesforce.com/50050000003d5dq/e?clone=1&retURL=%2F50050000003d5dq%3Fisdtp%3Dmn%26retURL%3D%2Fui%2Fdesktop%2FDesktopMainDefaultPage%3Fisdtp%3Dmn&scontrolCaching=1&isdtp=mn

Has anyone had to do something like this?  Any help would be greatly appreciated.

Cheers.
Bryan
I might have an odd request, who knows.

I have an s-control that has a link which pops...another s-control.  That's all well and good.  What I'm needing to do is pass the second s-control an Id value, but have no clue how.  Can I treat the second s-control like any other javascript page in that I can process querystring values? 

I haven't been able to find anything on doing this for s-controls, and I'm dead in the water if I can't get this to work.

Many thanks.
Bryan
Hi.  In the past I had no problems at all with the Apex toolkit for Eclipse.  In wanting to use the latest API and tools, I decided (stupidly) to use the new Force.com plugin for Eclipse 3.3.x.x. 

Now the fun part.  When I create a new project and hook up to our org's sandbox, I get a list of folders and one that contains our s-controls, triggers and classes (src>unpackaged).  My question to anyone who can help:  first, is this the project layout for everyone as well?  I see folders for various app exchange items we placed up there months ago, and some other fodlers that I don't understand the point of.  Why are they in the IDE?  And second, and the biggest headache at the moment....why arean't all of the s-controls in our sandbox being listed?   Maybe 25% of the controls are available and the same is true for the triggers. 

I've tried to get an answer from our premire support rep to no avail.  This is really messing our team up as we're in development on some items and now have to edit in a text editor and then copy and save in the UI.  That gets pretty old over the course of a day or week.

Any hlope would be greatly appreciated.  Thanks,
Bryan

Hi all.  I'm working on utilizing the campaing heirarchy in some update s-controls and need to get at the 11.0 endpoints.  I've gotten the latest Eclipse update and still can't connect via the 11.0 endpoints.  The connection fails and therefore I can't retrieve the objects.  10.0 endpoint won't work with the campaign pieces as they're not available in 10.0.

Any help would be appreciated.  For now I'm going to write in the IDE with just pasting the stuff into the s-control UI...but for a long term solution this isn't going to work.  Any ideas?

Many thanks.
Bryan.
Hi all. 

I have an s-control that mimcs the listing of a related object.  All well and good.  My one hitch right now is that I'd like the iframe that the s-control is shown in to be flexible.  I don't want to make the height of the field containing the s-control to be 300px if the result set back is only something like 80px.  Is this at all possible?  I could calculate something like 20px per table row created to return the right height.

Am I just dreaming on this one?  Are we really stuck with scrollbars and fixed height?

Many thanks.
Bryan
Hello.  I'm a .NET developer learning my way around Java and the Eclipse IDE.  I need to move another developer's trigger from our Sandbox to production in a few days for a release but have no real clue how to do this.  I know I need to use the Apache Ant tool, but I'm totally lost.  Is there any documentation out there on how to do this?  I've heard that it's a command line program, and that's fine...but I'm totally lost on this.

Any help or direction is GREATLY appreciated.
Bryan
Hi -

I'm trying to set the value of a dependent picklist to a valid value and nothing is happening.  The parent picklist is of the correct value to allow this to happen in the UI, but via the API nothing is set.  Can this even be done?

Many thanks!
Bryan

 

trigger UpdateReportsTo on User (after update) {
// user.Reports_to__c is a USER Id // contact ReportsTo is a CONTACT Id
 for (User u : Trigger.New) { if(u.Reports_to__c != null && u.Contact_Id__c != null){ // does the new Reports_to__c user have a contact id? User mgr = [Select Id, Contact_Id__c FROM User Where Id = :u.Reports_to__c]; if(mgr.Contact_Id__c != null){ // user has the contact linkage needed // update the target's contact record.ReportsTo with the mgr.Contact_Id__c value Contact targetmgr = [Select Id From Contact Where Id = :mgr.Contact_Id__c];   Contact userContact = new Contact(Id = u.Contact_Id__c); userContact.ReportsTo = targetMgr; update(userContact);  } } }}

 

The above trigger isn't firing both in unit tests as well as in the UI.  I get no errors...just no update to the contact record.  Any ideas at all?

 

Thanks.

 

I'm working on a simple proof which uses the Metadata API.  As I understand it you login to the standard data API and set the Metadata svc session values then you can make calls.  Here's a sample of that (I have another wrapped assembly that handles all data calls).

internal MetaWrapper()
        {
            _svc = new sforce_meta.MetadataService();
            _wrapper = new MetadataWrapper();

            Main.sforce.LoginResult _lr = _wrapper.Login();
            _svc.SessionHeaderValue = new sforce_meta.SessionHeader {sessionId = _lr.sessionId};
            _svc.Url = _lr.serverUrl;
        }

That's all fine and dandy and I can see in my watch that I have a session URL and Id set. URL in this instance is :

Url    "https://cs3-api.salesforce.com/services/Soap/u/18.0/00DQ0000000Ahhk"

 

Now at this point I'm just trying to do a simple query on all custom objects to test the connectivity and whatnot. 

 

sforce_meta.ListMetadataQuery query = new  sforce_meta.ListMetadataQuery {folder = null, type = "CustomObject"};

sforce_meta.FileProperties[] prop = _svc.listMetadata(new sforce_meta.ListMetadataQuery[] {query}, 20);

 

Here's the error I always get:

 

 

[System.Web.Services.Protocols.SoapHeaderException]    {"No operation available for request {http://soap.sforce.com/2006/04/metadata}listMetadata"}

 

Am I missing something simple?  Do I need to do something different withthe URL returned from the data svc binding? I've tried using various other API versions as the second arg in the listMetadata() method, with the same results.

 

Any direction at all would be helpful.

 

-Bryan

I can't find anything that says yes or no, but then again I can't find anything that lets me pull as well.  I have some requirements where using standard workflow rules as the Business Rules Engine would make life 100 times easier and the code insanely flexible....but all of this hinges on being able to pull workflow rules and then figure out a way to make sense of them.  Am I out of luck?

 

Thanks.

Until Salesforce gives us some way to organizing files my org is stuck with 200+ classes, triggers, etc lumped onto one page view.  In the past we've come up with naming schemes to try and keep files together, but that stops really working after 70 or so files IMO.  Has anyone else tried to implement some type of naming convention or organization to the mess of classes and triggers?

 

I'm getting more pressure to do more Apex-only development for small projects (ROI I suppose), but it's hard when I know I can just create a .NET sln and then be able to FIND (not to mention debug) the classes 6 months down the road. 

 

Bryan

I'm semi-new to SFDC, so please be patient ... :smileyhappy:

 

We have workflow rules that automatically email case comment notifications back and forth between the owner of the case and the Case Team members.  Below are the two rules that we have right now ...

 

AND(ISCHANGED( Last_Comment_Text__c ) ,
Last_Comment_Author__c <> (Submitted_By__r.FirstName + " " + Submitted_By__r.LastName) ,
NOT(ISNULL(Submitted_By__c)))

 

AND
(NOT(ISBLANK(Parent.Originator__c)),
CreatedById <> Parent.Originator__c)

 

The rules work great --- until the request is placed as a result of a phone call and the Submitter field (custom) is the same as the person entering the comment.  I can see where the problem is (first rule), and would like to change it to say "if the last comment author is not equal to CST Case Submitter (a specific role in the Case Team).  However, I can't find the Case Team roles in the list of options --- can anyone help me with this?  Thanks!

  • August 10, 2010
  • Like
  • 0

Hi -

 

I'm trying to see if there is any documentation or if anyone has done this.  I have a custom object that will have an approval process tied to it.  We're designing some .NET pages to handle the front end of all of this, but the issue I have is that I need a user to be able to invoke, or start, the approval.  Is this possible?  Right now my workaround on paper is to have the page be the custom object's page, or even a VF page, and use an IFRAME for the .NET stuff, but that seems hacked at best.

 

Any help would be greatly appreciated.  Thanks.

 

- Bryan

Since this morning (8 AM Eastern) I'm getting random errors in various apps that read/write to Salesforce (na3 specifically).  These errors are apparently from the XML and .NET treats them differently in various scenarios.  As of right now I've changed our main middle layer's API from 17 to 16 and that allowed events and opportunities to be read from and written to.  But now it looks like task creation is failing, and that works all day everyday.  Is it possible that we're the only org having this problem today?  I don't get it...  

 

here's pert of an error email:

 

Date: 2/15/2010 1:54:58 PMType: CSG.Exceptions.CSGExceptionAssembly: CSG.Salesforce.sObjects.Task, MiddleTier, Version=1.5.9.0, Culture=neutral, PublicKeyToken=nullCodebase: file:///C:/XXXXXX/MiddleTier.DLLMessage: There is an error in XML document (1, 672).Source: MiddleTierStacktrace: at CSG.Salesforce.sObjects.Task.CreateUserTask(String SalesforceID, String Subject, String Comments, DateTime DueDate, Uri TaskURL, String Priority, String Status) at CSG.Salesforce.sObjects.Task.CreateUserTask(String SalesforceID, String Subject, String Comments, DateTime DueDate, String eFolderID, String Priority, String Status) at CSG.Salesforce.Functions.CreateUserTask(String SalesforceID, String Subject, String Comments, DateTime DueDate, String eFolderID, String Priority, String Status) at CSG.MSI.Fulfillments.Fulfillments.CreateScrubTask(String eFolderID, String Subject, String Comments, DateTime DueDate)Exception Custom Data: eFolderID = 0000000000000000000000000029166 Subject = Letter Scrubbing Comments = There are 291 records to be scrubbed today DueDate = 2/15/2010 1:54:55 PM

 Any insight would be helpful.

 

 

Hi - I'm having a problem doing something in an Apex classe/trigger that I've been able to do in .NET, and that is add users to the AccountTeamMember object and then set their AccountShare access levels.  Currently I have a trigger that fires and at the tail end of it calls a class that will insert group members onto the account team (AccountTeamMember table) and then attempts to set their access levels.  I get the members added as well as the access levels set..both verified by my unit tests. Here is my test after adding two members to the account team, setting their access and then verifying the results (once I parse out the other team members/sharing users that I don't care about):
 

20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 108, column 11: listMembers size = 220100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 111, column 41: SOQL query with 4 rows finished in 3 ms20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 113, column 4: listAccessShare size = 420100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 117, column 4: SelectLoop:LIST:SOBJECT:AccountTeamMember20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 119, column 5: SelectLoop:LIST:SOBJECT:AccountShare20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 119, column 5: Number of iterations: 420100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 119, column 5: SelectLoop:LIST:SOBJECT:AccountShare20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 119, column 5: Number of iterations: 420100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 117, column 4: Number of iterations: 220100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 127, column 10: listShare size = 220100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 130, column 11: SelectLoop:LIST:SOBJECT:AccountShare20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 134, column 13: user: USERXXXXXXX account access: Edit20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 135, column 13: user: USERXXXXXXX contact access: Edit20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 136, column 13: user: USERXXXXXXX oppty access: None20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 137, column 13: user: USERXXXXXXX case access: None20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 134, column 13: user: USERYYYYYY account access: Edit20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 135, column 13: user: USERYYYYYY contact access: Edit20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 136, column 13: user: USERYYYYYY oppty access: None20100121143947.267:Class.AccountTeamAdditionTests.TestContext.BulkAssertions: line 137, column 13: user: USERYYYYYY case access: None

It all looks good in the unit tests.  But when I try this in the UI the trigger fires as expected, but the results are that the two people have Read Only for account and contact, and None for opportunity and case (which I'm cool with).

 

Any ideas?   I can also query Salesforce db and see that they two people are in the AccountShare table with the PROPER access rights...but still nothing in the UI.  Am I missing something on the AccountTeamMember table?  I want to alter the AccountAccessLevel value there, but it's not accessable in the API.  

 

I'm beyond stuck on this one.  

 

Cheers,

Bryan 

Hi - I'm stuck and maybe this will help me out. 

 

Here's the setup:  I'm working on a solution where there is a related list off of the Case object.  This related object is a mater detail to Case.  I've overridden both the New and Edit with VF pages.

 

The rub here is that the VF page needs to honor the parent case's record type, to then show the correct VF page which all just differ in layout only (they share the same extension).  Ok, so what I have is just Javascript in a "Gateway" page that then redirects to the proper VF page for input.

 

Ok, so here's a snippet of the Gateway page:

 

apex:form > <script type="text/JavaScript" src="/js/functions.js"></script> <script src="/dJS/en/1196898152000/library.js" type="text/javascript"></script> <script src="/soap/ajax/17.0/connection.js" type="text/JavaScript"></script> <script> sforce.connection.sessionId = '{!$Api.Session_ID}'; var caseId = '{!NewObj__c.Case__c}'; var caseNumber = ''; var website = "https://na3.salesforce.com"; if (window.top.location.href.indexOf('//na3.salesforce') == -1) { website="https://cs3.salesforce.com"; } /* REMOVED THE SOQL CALLS FOR THE SAKE OF SPEEDING UP THE PAGE LOAD CONFIG THE REC TYPE IDS FOR PRODUCTION WHEN RELEASING */ var bvipRecordTypeId = 'xxx'; var clientSolutionRecordTypeIds = 'xxx,xxx,xx,xx'; var marketingRecordTypeIds = 'xxx,xx,xx,xx'; var caseRecordTypeId = findCaseRecordTypeId(); var caseFieldId = 'CF00N50000001or5d'; if (caseRecordTypeId == '' ) alert('Error: Record Type not found, please contact support'); function findCaseRecordTypeId() { var recordType = sforce.connection.query("Select CaseNumber, RecordTypeId from Case where Id = '" + caseId + "'"); var rit = new sforce.QueryResultIterator(recordType); while(rit.hasNext()) { var r = rit.next(); caseNumber = r.CaseNumber; return r.RecordTypeId; } return ''; } if(bvipRecordTypeId.indexOf(caseRecordTypeId) >= 0){ // BVIP Case window.parent.location.href = website + '/apex/BVIPOverride?' + caseFieldId + '=' + caseNumber + '&' + caseFieldId + '_lkid=' + caseId + '&scontrolCaching=1&retURL=%2F' + caseId + '&sfdc.override=1'; } else if(clientSolutionRecordTypeIds.indexOf(caseRecordTypeId) >= 0) { // CS Case window.parent.location.href = website + '/apex/CSOverride?' + caseFieldId + '=' + caseNumber + '&' + caseFieldId + '_lkid=' + caseId + '&scontrolCaching=1&retURL=%2F' + caseId + '&sfdc.override=1'; } else if(marketingRecordTypeIds .indexOf(caseRecordTypeId) >= 0) { // Marketing Case window.parent.location.href = website + '/apex/MarketingOverride?' + caseFieldId + '=' + caseNumber + '&' + caseFieldId + '_lkid=' + caseId + '&scontrolCaching=1&retURL=%2F' + caseId + '&sfdc.override=1'; } else { alert('Error: Record Type not found, please contact support'); } </script> </apex:form>

 You'll see that I'm calling a SOQL query to see what the parent case's record type is, then using that Id in some logic. 

 

This works.  But the problem is that with this page rendering, the SOQL call, and then the redirect to the other page which renders, it'll take 5-6 seconds for the final page to render.  Not acceptable.

 

All of this would be solved if I could do something like {!NewObj.Case__r.RecordTypeId} but that always returns a blank string, so I guess that's out in the JS API.  

 

Is it possible to create a property to hold the record type Id in the Controller Extension (class) an then access that property via JS?  Or would I be better off to create a Component for all of this with an exposed property and then wire the page up to the Component?  I'm not 100% at all on the architecture of VF pages, but this seems so simple yet my current solution is a hack at best, and I'd like to get this to load in like 2 seconds.

 

Any pointers here would be most welcome.

 

Cheers,

Bryan

 

Hi,
 
I perform the Functional Admin for my org and currently all error emails generated from Apex triggers go to the Apex Developer Admin.
 
Since i have taken over his responsibilities I want to receive the same rather than him.
 
Can anyone help me in changing this? I am thinking there is some place on the UI where i can change the current email address to mine so as to receive the same.
 
Thanks
Hello  -

we are trying to create new (and even just a simple update) APEX classes and triggers in our Sandbox.  We were 'upgraded' about a week ago to Summer '08...and now we cannot connect via the Force.com IDE/Eclipse.  We can't be the only ones with this problem, yet at the same time there seems to be nothing out there for help on this.

Does anyone have any idea what might going on here?  We're on na3 if that matters at all.  This is just the latest is what is now a broken Sandbox integration with Summer '08.

Thanks.
Bryan
Can anyone supply an ETA for the new Force.com IDE that integrates with Eclipse.

It appears the current version does not work with Summer08 and the new 13.0 API.

This is the error:





Message Edited by TehNrd on 05-18-2008 08:47 AM
    Hello. 

I have an odd issue that appears to have been occuring since users were given the Console view.  When cloning a case we override the retURL to redirect to an integration s-control.  All is fine and well when you do this outside of the Console as the javascript is: window.top.location.href = redirectURL.

Great.  the problem is that this fails with the Console is sends the user outside of by virtue of 'window.top'.  Now, if I replace that line with: window.location.href = redirectURL, it works while int he Console, but when cloning a case in the normal tab view, only the right frame is affected, and it looks off.

Is it possible to use something like document.referrer to tell me if they're in the Console and then to set the location accordingly?  In playing around, this is what I get as the referrer when cloning a case in the Console:

https://tapp0.salesforce.com/50050000003d5dq/e?clone=1&retURL=%2F50050000003d5dq%3Fisdtp%3Dmn%26retURL%3D%2Fui%2Fdesktop%2FDesktopMainDefaultPage%3Fisdtp%3Dmn&scontrolCaching=1&isdtp=mn

Has anyone had to do something like this?  Any help would be greatly appreciated.

Cheers.
Bryan