• Jamie Browning
  • NEWBIE
  • 20 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 14
    Replies
Hi All,

I am trying to authorize an org (Dev org not sandbox) from VS Code and I am in my Company network and default port Id 1717 wouldnt work for me. I have followed the below steps to create a Connected App and change port number in sfdx-project.json file. But still its taking me to old 1717 localhost even after changin the port number.

From Connected App..
User-added image

From VSCode project setup..

User-added image

I have also tried to put 443 in the redirected URL instead of 1717. But it doesnt work either.

Is there any mistake that I have done while setting up the Conncted App ? BTW, I am not using JWT AUthentication. Its just web based authentication. How else can I change the default port number ?

PS : I have used both "oauthLocalPort" : "443" and "oauthLocalPort" : 443. 
 
As described here: https://releasenotes.docs.salesforce.com/en-us/summer15/release-notes/rn_service_emails_case_feed.htm ,
it should be possible to control the value of the "IsExternallyVisible" flag through a trigger.

We have our own logic which works well and were executing this code in the "before insert" of an EmailMessage record.
We recently noticed that even while our code sets the value in the before insert, Salesforce overrides this value later. (between the before insert and after insert)...

To fix this, I moved the code to update this field to the "after insert" logic.
But doing so, we now get an error when trying to update the EmailMessage records "Invalid operation".
I don't re-use the records comming from the Trigger.isNew cause that would cause "read only" exceptions.
What I do is like this:
EmailMessage emailToUpdate = new EmailMessage();
emailToUpdate.Id = mId;
emailToUpdate.IsExternallyVisible = value;
emailsToUpdate.add(emailToUpdate);
So I'm sure I'm only updating the IsExternallyVisible flag and not any other field that I wouldn't be allowed to...
I used this code already in execute anonymous mode to fix some emails incorrectly flagged as externally visible and this works from there.

What am I missing? Why doesn't there seem to be a proper way to control the IsExternallyVisible flag through code / trigger?...
  • November 23, 2015
  • Like
  • 0
Hi ,

 Im trying to deploy changes using ANT migration tool.

I'm getting below error. Please help me. Any help is really appreciated.
API Name Type        Line   Column     Error Message
Account  Custom Object 0 0 Custom Field Definition ID: bad value for restricted picklist field: RecordType

Thanks,
Naveen
On my test class, I am getting the following error.
System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, Chatter Answers User is not allowed for this License Type.: [UserPermissions] 
Stack Trace: Class.ChatterAnswersAuthProviderRegTest.validateCreateUpdateUser: line 32, column 1


The class that does it is

@isTest
private class ChatterAnswersAuthProviderRegTest {
  static testMethod void validateCreateUpdateUser() {
    User thisUser = [ select Id from User where Id = :UserInfo.getUserId() ];
    System.runAs ( thisUser ) {
      Auth.UserData userData = new Auth.UserData('testId', 'testFirst', 'testLast',
      'testFirst testLast', 'no-reply@salesforce.com', null, 'testuserlong', 'en_US', 'facebook',
      null, new Map<String, String>{'language' => 'en_US'});
      ChatterAnswersAuthProviderRegistration reg = new ChatterAnswersAuthProviderRegistration();
      Profile[] p = [SELECT Id FROM Profile WHERE Name = 'System Administrator'];
      User[] adminUser = [SELECT Id, Firstname, Lastname FROM User WHERE IsActive = true and ProfileId =: p[0].Id LIMIT 1];
      reg.setSiteAdminUserId(adminUser[0].Id);
      User newUser = reg.createUser(null, userData);
      System.assert(newUser != null, 'A new user should have been created');
      System.assertEquals(newUser.Firstname, 'testFirst', 'First name should have been same');
      System.assertEquals(newUser.Lastname, 'testLast', 'Last name should have been same');
      System.assertEquals(newUser.Email, 'no-reply@salesforce.com', 'Email should have been same');
      
      Contact c = new Contact();
      c.AccountId = (newUser.Username.split('@'))[0];
      c.LastName = 'contactLast';
      insert(c);
      
      newUser.profileId = p[0].Id;
      newUser.Alias = 'firstusr';
      newUser.TimeZoneSidKey = 'America/Los_Angeles';
      newUser.LocaleSidKey = 'en_US';
      newUser.EmailEncodingKey = 'UTF-8';
      newUser.LanguageLocaleKey = 'en_US';
      newUser.ContactId = c.Id;
      
      insert(newUser);
      
      
      Auth.UserData updateUserData = new Auth.UserData('testId', 'updatedFirst', 'updatedLast',
      'updatedFirst updatedLast', 'no-reply@new.salesforce.com', null, 'testuserlong', 'en_US', 'facebook',
      null, new Map<String, String>{'language' => 'en_US'});
      reg.updateUser(newUser.Id, null, updateUserData);
      
      User dbUser =  [SELECT Id, Firstname, Lastname, Email FROM User WHERE Id = :newUser.Id];
      System.assertEquals(dbUser.Firstname, 'updatedFirst', 'First name should have been updated');
      System.assertEquals(dbUser.Lastname, 'updatedLast', 'Last name should have been updated');
      System.assertEquals(dbUser.Email, 'no-reply@new.salesforce.com', 'Email should have been updated');
    }
  }
}


I think this is related to some permission with the profile "System Administrator".  Any idea which permission needs to be enabled the user?
 
There is a vfpage and a controller with it. while loading a page i want to insert a record. is it possible???
  • December 02, 2014
  • Like
  • 0
Hi,

Currently we are using Salesforce Professional Edition, How to Insert / Update / Export the data from Salesforce apart from Dataloader.io

Thanks & Regards,
Rajesh Potnuru

Hi,

 

This is anji salesforce dEVELOPER........

 

Can u tell me the code for "Input File"     ..............

 

How to insert image into Registration form using InputFile ................?

 

Please send me the code ..................

 

thanking  you,

Anjireddy

 


Can someone help me how to view  API Request debug logs? So i can track what the API Request are being made.

I'm trying to copy a new user as contact by using a trigger but I'm getting the following error

 

MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): Contact, original object: User

 

trigger Acceleration_User_Copyto_Contact on User (after insert, after update) {
    
   // Map<String,User> newLead = new Map <String, User>();
    
    system.debug('Acceleration_User_Copyto_Contact Trigger....');
 
    for ( User user : System.Trigger.new)
    {
        if  (user.Email.contains('acceleration'))
        {
            system.debug('Acceleration_User_Copyto_Contact Trigger..2.');
            Integer RecordCount = [select count() from Contact c where c.Email = : user.Email];
            
            system.debug('Acceleration_User_Copyto_Contact Trigger..2a .' + RecordCount);
            
            if (RecordCount == 0)
            {
                String AccountId = '';
                for ( Account a : [Select a.Id From Account a where Name = 'Acceleration']) 
                {
                    system.debug('Acceleration_User_Copyto_Contact Trigger..3.');
                     
                    AccountId = a.Id;
                
                    Contact con = New Contact();
                    con.AccountId = AccountId ;
                    con.Email = user.Email;
                    con.Firstname = User.Firstname;
                    con.Lastname = User.Lastname ;
                    con.User__c = User.Id;
                    insert con;
                }          
            }                   
        }
        
     }
    
    
}

 

Is there an easy way to only display the Time of a DateTime object in VisualForce?

 

Also is there an easy way to display the Day-of-the-week like 'Friday' in VisualForce?

 

Currently, I'm using a switch statement taken from the pdf on Formulas, but am wondering if there is a better method:

{!CASE(MOD( TODAY() - DATE(1900, 1, 7), 7),0, "Sunday",1, "Monday",2, "Tuesday",3, "Wednesday",4, "Thursday",5, "Friday",6, "Saturday", "Error")}

 

Thanks

Parker