• Pablo Venturino
  • NEWBIE
  • -1 Points
  • Member since 2015
  • Software Engineer
  • Altimetrik


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 4
    Replies
I'm trying to create a Single Sign On link. My link so far is:
https://test.salesforce.com/services/auth/sso/<orgId>/community?community=https%3A%2F%2Fsite-name.cs3.force.com%2Fcustomers%2F&amp;startURL=%2FuserSetup%3Fgt%3Dhttps%253A%252F%252Fsite-name.cs3.force.com%252Fcustomers%252F

But every time I try to use that link I get the following error:

Problem Logging In
We can’t log you in because of the following error. For more information, contact your Salesforce administrator.
Portal_And_Community: Specified both a community and a portal

Any idea what am I missing here?
I have the following test that asserts that a portal user is able to update it's own contact first name.
@IsTest
public class MyTestClass {
    
    @IsTest
    static void portalUserSelfUpdateContact() {
        
        Account ac = new Account(Name = 'the account');
        insert ac;

        Contact ct = new Contact(LastName = 'contact_lastname', AccountId = ac.Id);
        insert ct;

        Profile pf = [SELECT Id FROM Profile WHERE UserType = 'CspLitePortal' LIMIT 1];

        User usr = new User(
            Alias                 = 'usralias',
            Email                 = 'theuser@email.com',
            Emailencodingkey      = 'UTF-8',
            Lastname              = 'user_lastname',
            Languagelocalekey     = 'en_US',
            Localesidkey          = 'en_US',
            Profileid             =  pf.Id,
            Timezonesidkey        = 'America/Los_Angeles',
            Username              =  Math.random() + 'test@testuser.com',
            ContactId             =  ct.Id,
            CompanyName           = 'the company',
            Salesforce_Edition__c = 'DE',
            IsPortalSelfRegistered = true
        );

        System.runAs(usr) {
            ct.FirstName = 'contact_firstname';
            update ct;
        }
    }
}
When I compile the class using API 33.0, the test passes. But when I try with API 34.0, the update fails with this message.
System.DmlException: Update failed. First exception on row 0 with id 005Q000000NtSmRIAV; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []
What has changed in API 34.0 that causes this issue. What other changes should I make in my code for this test to pass?

Note: same question in http://salesforce.stackexchange.com/questions/89697
I have the following test that asserts that a portal user is able to update it's own contact first name.
@IsTest
public class MyTestClass {
    
    @IsTest
    static void portalUserSelfUpdateContact() {
        
        Account ac = new Account(Name = 'the account');
        insert ac;

        Contact ct = new Contact(LastName = 'contact_lastname', AccountId = ac.Id);
        insert ct;

        Profile pf = [SELECT Id FROM Profile WHERE UserType = 'CspLitePortal' LIMIT 1];

        User usr = new User(
            Alias                 = 'usralias',
            Email                 = 'theuser@email.com',
            Emailencodingkey      = 'UTF-8',
            Lastname              = 'user_lastname',
            Languagelocalekey     = 'en_US',
            Localesidkey          = 'en_US',
            Profileid             =  pf.Id,
            Timezonesidkey        = 'America/Los_Angeles',
            Username              =  Math.random() + 'test@testuser.com',
            ContactId             =  ct.Id,
            CompanyName           = 'the company',
            Salesforce_Edition__c = 'DE',
            IsPortalSelfRegistered = true
        );

        System.runAs(usr) {
            ct.FirstName = 'contact_firstname';
            update ct;
        }
    }
}
When I compile the class using API 33.0, the test passes. But when I try with API 34.0, the update fails with this message.
System.DmlException: Update failed. First exception on row 0 with id 005Q000000NtSmRIAV; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []
What has changed in API 34.0 that causes this issue. What other changes should I make in my code for this test to pass?

Note: same question in http://salesforce.stackexchange.com/questions/89697
custom validation to check field is not empty while saving, if field is empty display error message
here is my code  is this code is ok?please let me known any allternation code from u guys
<apex:page controller="task43" sidebar="true" showHeader="true">
<apex:form >
<apex:pageBlock title="homepage" id="block1">
<apex:pageBlockSection >
<apex:pagemessages >
</apex:pagemessages>
<apex:inputText value="{!f1}"/>
<apex:inputText value="{!f2}"/>
<apex:commandButton value="login" action="{!log}" reRender="block1"/>

</apex:pageBlockSection>




</apex:pageBlock>



</apex:form>
</apex:page>



public with sharing class task43 {

    public PageReference log() {
    if(f1==''||f1==null&&f2==''||f2==null){
    apexpages.addmessage(new apexpages.message(apexpages.severity.warning,'please enter'));
    }
    
        return null;
    
    }


    public String f2 { get; set; }

    public String f1 { get; set; }
}
Hi Guyz,

I am running into a scheduling problem with my apex class. I have a batch apex class named 'MyBatchApex' which I want to schedule to run every 5 minutes. I created a class with implements the Schedulable interface and here goes the code..
 
global class MySchedulerClass{
    global void execute(SchedulableContext sc) {
        ID BatchId = Database.executeBatch(new MyBatchApex(), 50);

    } 
    public static void scheduleThis(){
       String cronString='0 5 * * * ?';
       System.schedule('MyJob', cronString, new MySchedulerClass());
    }
}

To schedule this, I am running the following snipper from Developer Console 
MySchedulerClass.scheduleThis()

The job creates a async job and executes the batch after 5 mins as expected and then stops to run. I want this to execute every 5 minutes like a cron job. Am I doing anything wrong here? How to acheive a frequency of 5 min execution then?