• Nani
  • NEWBIE
  • 0 Points
  • Member since 2009

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

Hi,

 

On the Account object, I have a field called 'Language'. The requirement is to default this field with the logged in users languge.

 

Could someone please help me with the approach?

 

Thanks in advance.

  • December 08, 2009
  • Like
  • 0
Hi all,

I have an trigger on a custom object, which is working fine when a record is created from Admin. However, when a record is created on the same object from Partner Portal, the trigger is not being fired.

Please let me know, whats missing. Am I missing some setting?

- SalesForce Developer
  • November 05, 2009
  • Like
  • 0
Hi all, Following is the scenario: I have an Account (PA1) with 3 Contacts (C1, C2, and C3) and each contact has a user associated; i.e., C1, C2 and C3 are associated to users U1, U2 and U3 respectively. I have another account CA1 with 'Parent Account' as PA1 (this is the one mentioned above). Now, I want PA1 users U1, U2 and U3 to have access to the second account CA1. I would like to know how this can be achieved (by config or APEX coding); if this can be done by APEX, please help me with the logic.  PS: Does adding contacts C1, C2 and C3 to second account CA1 solve the issue? Thanks in advance,

New SFDC Developer.

  • October 29, 2009
  • Like
  • 0

Hi,

 

On the Account object, I have a field called 'Language'. The requirement is to default this field with the logged in users languge.

 

Could someone please help me with the approach?

 

Thanks in advance.

  • December 08, 2009
  • Like
  • 0
Hi all,

I have an trigger on a custom object, which is working fine when a record is created from Admin. However, when a record is created on the same object from Partner Portal, the trigger is not being fired.

Please let me know, whats missing. Am I missing some setting?

- SalesForce Developer
  • November 05, 2009
  • Like
  • 0
Hi all, Following is the scenario: I have an Account (PA1) with 3 Contacts (C1, C2, and C3) and each contact has a user associated; i.e., C1, C2 and C3 are associated to users U1, U2 and U3 respectively. I have another account CA1 with 'Parent Account' as PA1 (this is the one mentioned above). Now, I want PA1 users U1, U2 and U3 to have access to the second account CA1. I would like to know how this can be achieved (by config or APEX coding); if this can be done by APEX, please help me with the logic.  PS: Does adding contacts C1, C2 and C3 to second account CA1 solve the issue? Thanks in advance,

New SFDC Developer.

  • October 29, 2009
  • Like
  • 0

Hi all, I am running into some problems trying to use Apex to manipulate the sharing rules. SFDC lets you do this for custom objects, but their doc says that std objects aren't supported. However - if I look at the schema I can see that OpportunitySharing is available, and creatable, so theory goes I should be able to write to it.

 

I am trying to make some additions to sharing for a particular opportunity by inserting into this object - I can set all the fields I need to, but doing a database.insert gives me 'insufficient access on cross-reference object'. Now I'm not sure if this is a red herring for not being able to insert at all, or if I am missing something else. I am the owner of the record I'm trying to change - would this exclude me from being able to add an explicit sharing record for myself?

 

If anyone has tried Apex sharing on std objects or has some advice I'd be most grateful.

 

Thanks,

Stephen

London, UK

   
In a testMethod, I have following code:

Account_Auditor__c Account_auditor = new Account_Auditor__c(Account__c = a.id, auditor__c = u.id, Audit_Type__c = 'Garbage');
insert Account_auditor;
The intent is to execute the following trigger and give the "Auditor" read rights to the Account .

The testMethod runs fine in developer org, it croaks in the org that it is being installed it - it croaks on the Insert statement with the message:

caused by: System.DmlException: Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id

trigger grantAuditorReadAccessToAccount on Account_Auditor__c (after insert) {

Account_Auditor__c[]  Account_auditor_list = trigger.new;

for (Account_Auditor__c Account_auditor: Account_auditor_list) {
AccountShare ashare = new AccountShare();
ashare.AccountAccessLevel = 'Read';
ashare.OpportunityAccessLevel = 'None';
ashare.CaseAccessLevel = 'None';
ashare.AccountId = Account_auditor.Account__c;
ashare.UserorGroupId = Account_auditor.Auditor__c;
Insert ashare;
}
}

I suspect it has something to do with the user rights - I am fetching an active user from the database in the test method (u.id). In the org that I am installing, I have two users, one is system admin, another is a test user I created, so that i could install. I assume I am installing as a


Things looked great at the APEX day demo yesterday.  My first concern, though, was over the security context in which code executes. I asked about this and was told that the code runs at adminstrator level.

This is something that seriously needs to be changed.  Of course it's the developer's responsibility to manage code to avoid undesirable results.  However, this is going to be extremely difficult.

If write some code that displays query results (or modifies data?!), but a user is normally not allowed to view or  those records, unwanted information will be displayed.  How would you even write code that would exclude those results? (sorry, there may be functions to do this, I'm just getting started writing code).  And if you did, you'd have to make everything conditional or have multiple controls or triggers.  I'm just trying to picture how even an advanced user would manage something like that - and your goal is to make "everyone" a developer?

Not good.  It's highly critical to have an option for functions to run at the user level.  In fact, that should be the default.  I hope that this is something that will be addressed soon.