• Lam Ha Tuan
  • NEWBIE
  • 40 Points
  • Member since 2023

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

Hi guys, I want to create an custom Object that is a children of Salesforce Task (default object), but when I create a lookup relationship but I can't find the Task in the Related To option. How can I create a lookup relationship with Salesforce Task?

Thanks for your help.

Hi guys! I am new to Salesforce development.
I created an Apex class that implements from the InstallHandler interface, Are there any steps else to make this class work for everytime the User install or update my Package? I already add it as an Apex class in the package but it doesn't work. Thanks so much for your help.
Hi everyone!
I am creating a custom app for schedule tasks, I need to use an object to manage the Holiday. I know that Salesforce has an object "Holiday", can I use this object in my custom app? Is there any restricts of using this object? And do all customer's org have this object in their org?

Hello everyone! I am new to Apex coding.
I am trying to create an Apex class to create some default records for my custom Object. Here is my PostInstall class:
global without sharing class PostInstall implements InstallHandler {
global void onInstall(InstallContext context) {
Account a = new Account(Name = 'Hello');
insert a;
}
}
I create a unit test for it: 

public class UnitTestClass {
    @isTest
    static void testInstallScript() {
      PostInstall postinstall = new PostInstall();
        Test.testInstall(postinstall, null);
        Test.testInstall(postinstall, new Version(0,1,0), true);
        Account[] a = [select id from Account where Name = 'Hello'];
        System.assertEquals(a.size(), 1, 'Hehe');
      }
}

And the UnitTestClass is correct. But when I try to create a package and install it to another org, the PostInstall class isn't even called to create records for Account object. Can you help me with this problem? Thank you so much.

Hi guys, I am new to Apex so that I am not sure about how the upsert work. I have the apex class to create an project, add members (are the users in the org) from teams and add users from the org to project. Users and Members from teams can be duplicate so I use 'upsert' to make sure I just add user to project member 1 time. Here is my Apex method:

insert project;
        for(String team: teams){
            Project_Team__c newProjectTeam = new Project_Team__c(Project__c = project.Id, Team__c = team);
            insert newProjectTeam;
            for(Team_Member__c teamMember: [Select Member__c from Team_Member__c where Team__c = :team]){
                Project_Member__c newProjectMember = new Project_Member__c(Project__c = project.Id, Member__c = teamMember.Member__c);
                upsert newProjectMember;
                System.Debug(newProjectMember);
            }
        }
        for(String member: members){
            Project_Member__c newProjectMember = new Project_Member__c(Project__c = project.Id, Member__c = member);
            upsert newProjectMember;
            System.Debug(newProjectMember);
        }

Is my code correct, especially the 'upsert' DMl?

Hi guys, are there any way that when user install my app to their org, it will automatically insert some default record for that org? I also have an object to store personal settings for user, how can I create record for each user when they install my app? 
Thanks for you helps so much.

Hello everyone, I want to create an Object to store the Settings of the user in my App. Is there any way to prevent user from creating a tab to see the records of this object and prevent them from changing it manually. 
Thanks for your helps.

Hi everyone, I want to create some user for my scratch using sfdx cli, I found a cmd is sfdx force:user:create but this command is just for 1 user 1 time. Can I use command: sfdx force:data:tree:import for import some Users into scratch org? Can you suggest me some solutions? 

Hi everyone, I have a problem when import user data into sratch org, I got this error: There are no available user licenses for the user profile "Standard User".

Here is my data about User got from User Definition File of Salesforce document:
{
    "Username": "tester1@sfdx.org",
    "LastName": "Hobbs",
    "Email": "tester1@sfdx.org",
    "Alias": "tester1",
    "TimeZoneSidKey": "America/Denver",
    "LocaleSidKey": "en_US",
    "EmailEncodingKey": "UTF-8",
    "LanguageLocaleKey": "en_US",
    "profileName": "Standard Platform User",
    "permsets": ["Dreamhouse", "Cloudhouse"],
    "generatePassword": true
}
Can anyone help me with this problem? I also have a question that I want to import tasks into Scratch org using sfdx force data tree import, how can I assign one of the user I've created into these tasks?
Thank you so much for your help.

I want to add custom field: StartDate to Task (Salesforce Standard object) but the salesforce does not allow that. Is there any solutions for this problem? 

Hello everyone! I am new to Apex coding.
I am trying to create an Apex class to create some default records for my custom Object. Here is my PostInstall class:
global without sharing class PostInstall implements InstallHandler {
global void onInstall(InstallContext context) {
Account a = new Account(Name = 'Hello');
insert a;
}
}
I create a unit test for it: 

public class UnitTestClass {
    @isTest
    static void testInstallScript() {
      PostInstall postinstall = new PostInstall();
        Test.testInstall(postinstall, null);
        Test.testInstall(postinstall, new Version(0,1,0), true);
        Account[] a = [select id from Account where Name = 'Hello'];
        System.assertEquals(a.size(), 1, 'Hehe');
      }
}

And the UnitTestClass is correct. But when I try to create a package and install it to another org, the PostInstall class isn't even called to create records for Account object. Can you help me with this problem? Thank you so much.

I want to add custom field: StartDate to Task (Salesforce Standard object) but the salesforce does not allow that. Is there any solutions for this problem?