• seven23
  • NEWBIE
  • 10 Points
  • Member since 2013
  • Developer
  • Danfoss

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
How can I set a lightning component's visibility on a contact lightning record page to show if the contact is a partner user? NOT the logged in, current user; this is to show a button to internal users depending on whether or not the contact being viewed is a partner user.
Partner portal users receive an email after submitting a record with a link to the record. How do I construct the URL to redirect the user to login (and then back to the record) if they're not already logged in when they open the link? This is in an HTML email template.

This works if they're already logged in -
https://<company>.secure.force.com/<portalname>/<recordID>

Thanks,
Erin

We have a custom field on our Content Types and do not want this field visible for portal users since it contains other customers' library names. I see no sort of field-level security for Content fields nor a way to control the "page layout" for Content.

Partner portal users receive an email after submitting a record with a link to the record. How do I construct the URL to redirect the user to login (and then back to the record) if they're not already logged in when they open the link? This is in an HTML email template.

This works if they're already logged in -
https://<company>.secure.force.com/<portalname>/<recordID>

Thanks,
Erin

public with sharing class Utils_SDF_Methodology {
.
.
.
    public static final String BypassVar;//List of triggers that can be bypassed
    
    static{
        System.Debug('## >>> Utils_SDF_Methodology constructor :BEGIN <<< run by ' + UserInfo.getName());
        User user=[SELECT UserRole.Name,Profile.Name,BypassTriggers__c FROM User WHERE Id =:UserInfo.getUserId() LIMIT 1];
        BypassVar=';'+user.BypassTriggers__c+';';
        System.Debug('## >>> Utils_SDF_Methodology constructor : END <<<');
    }
.
.
.
}

I have to write a Test Class in which I have to user runAs(userX){ inside of which I want static init block of above class should run.}

I have created below code in my TEST method:

        User LCRTestUser = Utils_TestMethods.createStandardUser('LCROwner');
        LCRTestUser.BypassTriggers__c = 'AP33;AP20;AP_Case_CaseHandlerCaseBeforeInsert;AP10;AP41'; 
        System.debug('LCRTestUser.BypassTriggers__c:'+LCRTestUser.BypassTriggers__c);
        //Insert LCRTestUser ;
        System.debug('UserInfo.getName():'+UserInfo.getName());
    system.runas(LCRTestUser) {
        Test.startTest();
        System.debug('runAs Started');
//        Test.startTest();
            System.debug('UserInfo.getName():'+UserInfo.getName());
                System.debug('Utils_SDF_Methodology.PAD_BypassTrigger:'+Utils_SDF_Methodology.PAD_BypassTrigger);

        Test.stopTest();

But still it is initializing with main user, Not the user which is in runAs().
            System.debug('UserInfo.getName():'+UserInfo.getName()); in TEST method is providing name of the user who is in runAs. Static init block is executing after runAs but before this debug and is considering actual user.

Can I do anything so that it will consider user mentioned in runAs in static initialization block?

We have an existing class that uses the Test.isRunningTest() method.  Today we tried making changes to that class (completely unrelated to the isRunningTestMethod) and weren't able to save it because of a "method doesn't exist or incorrect signature" error on that method.  Did something change with the Winter 12 release where we can no longer use this in code?  If so, is there something replacing this functionality?  If we should still be able to use it, any thoughts on why we are receiving this error now?


Save error: Method does not exist or incorrect signature: Test.isRunningTest()


  • October 27, 2011
  • Like
  • 1