• Swap50
  • NEWBIE
  • 0 Points
  • Member since 2010

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

Hi All

 

I'm facing a strange issue.. Need your suggestions.

 

I have a trigger on Case which changes the recordtype when the case owner changes to a queue.

 

So i'm using below statement to get the recordtype id based on the name.

 

Schema.SObjectType.Case.getRecordTypeInfosByName().get('case record type').getRecordTypeId();

 

We have many profiles in our org , this statement is working for everyone except one profile.

 

As apex runs in system mode, i dont think recordtype access is an issue.

I tried using a query instead of above statement and it works even for this profile.

 

Recordtype temprectypeid=[Select Id from RecordType where name='case record type'];

 

I checked running the same statement in system log and getting null pointer exception where as for other profiles it works.

 

I tried comparing all the profile settings, every thing seems to be same.

 

Can any one help me debug the issue. I may be missing something.

 

Any pointers will be of great help

 

Thanks

Swapna

 

  • September 23, 2010
  • Like
  • 0

Hi All

 

We have a user who has access to a queue because of his role as it says (Manager of Queue Member).

We would look like to remove access to this queue for this user, with out removing the role from the queue for which the user is the manager.

Is it possible? I did search the help and discussion forums but couldnt find anything related this.

Any pointers will be great help.

 

Thanks
Swapna

  • August 26, 2010
  • Like
  • 0

Hi All

 

Is there a way we can make a text field searchable in look up Dialogue Box?

I have tried external Id, which works from side bar but not from lookup.

 

Any work around, will be of great help.

I'm just trying to avoud visual force development.

 

Thanks
Swapna

  • August 02, 2010
  • Like
  • 0

I'm new to Apex and am trying to get this test script to work so that I can deploy the trigger over to production.  The trigger works in our Sandbox, but my test script keeps returning null.  I'm not sure what is going on.  On our account record we have a lookup field to the user table.  This is the id i'm trying to pull.  The account record is the master and we have a custom object that stems from account called program.  We then have another custom object that stems from program, RS.  The trigger is to take place on the RS record on the before update event.  This field is what will determine who gets an automated approval submission.  It's a funky setup, but due to other objects/setups, we had to go this route.  When I run my test, the system debug is always showing null after the update statement.  I'm not sure what to do next.  Please help!

 

Tigger Code:

trigger RMuserIDupdate on Revenue_Share__c (before update) {
    for(revenue_share__c rs: trigger.new){
        ID pID = [select RM_Detail_Link__c from revenue_share__c where id = :rs.id].rm_detail_link__C;
        ID aID = [select client__c from program__c where id = :pid].client__c;
        id rmID = [select relationship_manager__c from account where id = :aid].relationship_manager__C;
    
        rs.rm_user_id__c = rmID;
    }
}

 

Test Script:

public class Check_RMUserUpdate{
    static testMethod void testCheck_RMUserUpdate() {
    
    ID testRMID;
    ID actRMID;

    Account A1 = new Account();
    A1.name = 'Test1';
    A1.RecordTypeId = '01240000000DRwY';
    A1.billingcity = 'Kansas City';
    A1.billingstate = 'MO';
    A1.billingpostalcode = '64105';
    A1.site = 'Kansas City MO';
    A1.relationship_manager__C = '005400000012HxuAAE';
    insert a1;
    testrmid = a1.relationship_manager__c;
    
    Program__c P1 = new Program__c();
    P1.client__c = A1.id;
    insert p1;
    system.debug('********************Program****** ' + p1.id);
    
    Revenue_Share__C RS1 = new Revenue_Share__c();
    RS1.rm_detail_link__c = p1.id;
    //RS1.rm_user_id__c = '00540000000xC6yAAE';
    insert RS1;
    system.debug('********************rm detail****** ' + rs1.rm_detail_link__c);

    rs1.tier__c = 'B1';
    update rs1;
    actrmid = rs1.rm_user_id__c;
    
    system.debug('********************TEST****** ' + testrmid + ' ' + actrmid);
  }
}

Hi All

 

I'm facing a strange issue.. Need your suggestions.

 

I have a trigger on Case which changes the recordtype when the case owner changes to a queue.

 

So i'm using below statement to get the recordtype id based on the name.

 

Schema.SObjectType.Case.getRecordTypeInfosByName().get('case record type').getRecordTypeId();

 

We have many profiles in our org , this statement is working for everyone except one profile.

 

As apex runs in system mode, i dont think recordtype access is an issue.

I tried using a query instead of above statement and it works even for this profile.

 

Recordtype temprectypeid=[Select Id from RecordType where name='case record type'];

 

I checked running the same statement in system log and getting null pointer exception where as for other profiles it works.

 

I tried comparing all the profile settings, every thing seems to be same.

 

Can any one help me debug the issue. I may be missing something.

 

Any pointers will be of great help

 

Thanks

Swapna

 

  • September 23, 2010
  • Like
  • 0

The following trigger,  and an alternative suggested on this board, do not work as planned because the IF always evaluates to FALSE, even when the account manager field is non-blank.

 

Original Failing Trigger

trigger OpportunityTrigger on Opportunity (before ​insert) {

  for(Opportunity o : Trigger.new) {
    String accountManager = (String)o.Q2_Account_M​gr__c;
    
    if((accountManager != null && accountManager.l​ength() >= 15)) {      
      o.OwnerId = o.Q2_Account_Mgr__c;  
    } } }

 

Suggested Alternative

for (Opportunity o : trigger.New) {

if (o.Q2_Account_Mgr__c != null) {

o.OwnerId = o.Q2_Account_Mgr__c;

 

Related Info

  • field Q2_Account_Mgr__c is a lookup field on the Account record that is related to a User
  • Irrespective of whether this field conatins data or is empty, the IFs in either trigger always evaluate to FALSE

Is the problem that since this trigger runs on the Opportunity that it can't see a lookup field on the Account?  Or ??

 

 

  • September 23, 2010
  • Like
  • 0

Hi,

 

Can someone help me in mapping a custom object field with that of the Cases? Thanks

 

Praveen

praveenkumar.chandrashekar@altisource.com

Yesterday I tried for the first time sending a mass email to all our Salesforce users informing them of some new features.

Apparently these mass emails are considered as spam and are not delivered (see error message below) because they are blocked by our email system (Outlook 2007). When I send mass email to contacts/leads however I don't have this problem..

 

 

 

 

Anyone knows how to solve this?

 

 

Thanks in advance!

  • September 23, 2010
  • Like
  • 0

I am facing a problem like this

      1-I have a two user with different different role

             a) Board of director.

             b)Senior employee.

      2-And a single Object called meeting.

 

Problem is that-:1-When senior employee create meeting this meeting view by Board of director only after approval.

                               I want the meeting view for Board of director or other employee after approval.

                               but problem is that when senior employee create meeting than its view by all other user like board of                                        director, Junior employee before approval.

                              2-Means I want Meeting will be visible to creator until approved.

 

Hi,

 

Is it possible to view all data and manage dashboard without View All Data and Modify all Data rights.

 

Regards,

Mktg

  • September 13, 2010
  • Like
  • 0

I have a trigger that fires when contact object is updated and updates the related user's isActive checkbox when the spesific checkbox in the contact has been changed.

 

Because the user and contact cannot be updated in the same transaction contact trigger calls the future method that updates the user's isActive field.  This is simplified trigger code.

 

 

trigger InsertUpdateContactTrigger on Contact (after update) {
List<String> contactsToUpdate = new List<String>();
for (Contact c : trigger.new){
if(trigger.newMap.get(c.Id).IsActive__c != c.IsActive__c){
contactsToUpdate.add(c.Id);
}
}

AsyncUserUpdateHelper.updateContactUserInfo(contactsToUpdate);
}

This works fine in practice in other word when I update the contact in UI trigger fires and user is updated. I have also written a testMethod for trigger and test passes when I run it in Eclipse IDE. I am also able to deploy the trigger in production through IDE and during deployment tests run successfully. The problem is that when I try to 'Run Test' or 'Run All Tests' in Setup->Develop->Apex Classes tests fail because of MIXED_DML_OPERATION error from the row 4.

1 private static testMethod void testUpdateContact(){
2 //QUERY CONTACTS THAT HAVE PORTAL USER
3 Test.startTest();
4 update portalContacts;
5 Test.stopTest();
6 //ASSERTIONS
7 }

Does using startTest and stopTest case the both trigger and future method to run in same transaction and if so how can I test the trigger that calls @future method? And why the tests run fine when deploying the through IDE but not when running them directly from salesforce?

  • January 27, 2010
  • Like
  • 0