• Nitzan Marinov
  • NEWBIE
  • 65 Points
  • Member since 2015

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

I have added a large set of free text fields to my opportunity object and I need to distribute them on a record by record basis to a group of recipients once a week. I cannot use the 'normal' reporting tabular structure because I have many long fields and it will not be readable. I suspect I'll have to use Visualforce to achieve this but having no experience with it, I'm not sure where to start. Any suggestions? Thanks

Here's the example of what I'd like to distribute: 
Hard Stop/Go

I'm on the App Customization > Customizing Actions module and I logged into my own trial org. I want to create a New Action on the Account object but when I click the New button, all it does is take me back to SETUP/Object Manager with a genral Create button

User-added image

Does anyone know why this is happening?

Thanks
Hi all,

I have these 3 fields:
SELECT Name, First_Name__c, Last_Name__c FROM Clients__c 

I would like to run a periodical apex process to split the values from Name into First Name and Last Name.

All charachters until 1st space is First Name and everything else is Last Name.

Can anyone please help?

Thanks
Hi all,

I made some changes to Apex class code and all tests come back without a failure. However, when I try to deploy and run the validation, I still get below 75% coverege but there is no explanation. Does anyone know how to resolve this?

Deployment Validation Error

Thanks
Nitzan
Hi everyone,

This may be really simple but I'm new to this so would appreciate any help.

I have this test trigger:

@isTest
private class TESTCLASS_EventTrigger {
static testMethod void validateEventTrigger() {

   datetime myDateTime =
   datetime.newInstance(2012, 1, 1);
   
Clients__c c = TestUtilities.insertClient();
Event e = new Event(Subject='Test Class Call', WhatID ='a0EC000000AkWqD',
                    DurationInMinutes=30, StartDateTime=myDateTime);
// Insert Client & Event
insert c;
insert e;

// Retrieve the new Event
e = [SELECT ID, Calendar_Title__c FROM Event WHERE Subject = 'Test Class Call'];
System.debug('Calendar_Title__c: ' + e.Calendar_Title__c);

// Test that the trigger correctly updated the price
System.assertEquals('Camilla Ferdinand: Test Class Call', e.Calendar_Title__c);
}
}

Here's the test utility:
@isTest
public with sharing class TestUtilities {
    
    public Contact      aContac         {get; set;}
    public Attachment   aAttachment     {get; set;}
    
    static User testUser;
    
    public void generateContact(){

        this.aContac                = new Contact();
        this.aContac.firstName      = 'Test';
        this.aContac.LastName       = 'Test';
        
        insert this.aContac;

        this.aAttachment = new Attachment();
        this.aAttachment.Body = Blob.valueOf('String');
    }
    
    public static TestUtilities generateTest(){
        TestUtilities e = new TestUtilities();
        e.generateContact();
        return e;
    }
    
        public static User createUser(Id profileId)
        {   
            //fetch existing users with provided profile and role
            List<User> userLst = [Select Id From User where ProfileId =: profileId and IsActive = :true Limit 1];
            
            User user;
            
            if(userLst.size()>0)
            {
                //at least one user exists; return user record
                user =  userLst[0];
            }
            else
            {
                //user does not exist; create new user
                user = new User(profileid = profileId,
                                alias = 'standt', email = 'standarduser@testorg.com',
                                emailencodingkey = 'UTF-8', lastname = 'Tsting', languagelocalekey = 'en_US',
                                localesidkey = 'en_US', timezonesidkey = 'America/Los_Angeles',
                                username = profileId + '@testorg.com');
                insert user;
            }
           
            return user;
        }
        
    public static Clients__c insertClient()
    {
        Clients__c c = new Clients__c(Name ='TestClient', Active__c = true,
                                      OC_Programme__c = 'OC Central', Current_Address__c = 'N/A',
                                      Primary_Phone_Number__c = 'N/A');
        return c;
    }
    
    public static Contact insertContact()
    {
        Contact c = new Contact(FirstName ='Test',LastName ='Test', Training_Contact__c = true);
        return c;
    }
    
    public static Project__c insertProject()
    {
        Profile p = [select id from profile where name='OC Impact'];
        UserRole r = [select id from UserRole where name='OC Impact Director'];
        User userSRO  = TestUtilities.createUser(p.Id);
        RecordType rt = [select id from RecordType where SobjectType = 'Project__c' and DeveloperName = 'Project' limit 1];
        string rId = rt.Id;
        Project__c proj = new Project__c(Name = 'testProject',
                                         OC_field__c = 'OC Impact',
                                         Project_summary__c = 'Test Summary',
                                         Project_start_date__c = date.newInstance(2013, 1, 1),
                                         Project_end_date__c = date.newInstance(2013, 12, 25),
                                         RecordtypeId = rt.id,
                                         Submit_for_Approval_by__c = date.newInstance(2018, 12, 25),
                                         Senior_Responsible_Officer_SRO__c = userSRO.Id);
        return proj;                                 
    }
    
    public static Project_Budget__c createProjectBudget(Id projId)
    {
        Project_Budget__c pb = new Project_Budget__c(Name = 'Session',
                                                     Cost_Centre__c = 'Session',
                                                     Income__c = 0,
                                                     Expense__c = 0,
                                                     Project__c = projId);
        return pb;
    }
    
    public static Project_Budget_Detail__c createProjectBudgetDetail(Id projBudgetId)
    {
        Project_Budget_Detail__c pb = new Project_Budget_Detail__c(
                                                     Paid_As__c = 'Cash',
                                                     Income__c = 0,
                                                     Expense__c = 0,
                                                     Project_Budget__c = projBudgetId);
        return pb;
    }
}

And here is the trigger code (which I haven't touched):
trigger EventTrigger on Event (before insert, before update) {

    Event[] eventToUpdate = trigger.new;
    Clients__c clientInfo = new Clients__c();
    Project__c projectInfo = new Project__c();
    
    for (Event e : eventToUpdate)
    {
        if(e.WhatId != Null)
        {
            If(string.valueOf(e.WhatId).startsWith('a0E'))
            {
                clientInfo = [SELECT ID, Name from Clients__c Where ID = :e.WhatId];
                e.Calendar_Title__c = clientInfo.Name + ': ' + e.Subject;
            }
            
            If(string.valueOf(e.WhatId).startsWith('a04'))
            {
                projectInfo = [SELECT ID, Name from Project__c Where ID = :e.WhatId];
                e.Calendar_Title__c = projectInfo.Name + ': ' + e.Subject;
            }
        
        }
    }

}

And here is the error message I get:
15:43:17:411 EXCEPTION_THROWN [13]|System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, EventTrigger: execution of BeforeInsert

Thanking you in advance.
I suspect that this test to the EventTrigger has not been working for a while but now it's stopping me from deploying some changes that seem to be related.

I think the problem is with the insert to event but I can't work out how to fix it.

@isTest
private class TESTCLASS_EventTrigger {
static testMethod void validateEventTrigger() {

   datetime myDateTime =
   datetime.newInstance(2012, 1, 1);
   
Clients__c c = TestUtilities.insertClient();
        insert c;
Event e = new Event(Subject='Test Class Call', WhatID ='a0E54000000Ct6e',
                    DurationInMinutes=30, StartDateTime=myDateTime, EndDateTime=myDateTime);
// Insert Client & Event
insert c;
insert e;

// Retrieve the new Event
e = [SELECT ID, Calendar_Title__c FROM Event WHERE Subject = 'Test Class Call'];
System.debug('Calendar_Title__c: ' + e.Calendar_Title__c);

// Test that the trigger correctly updated the price
System.assertEquals('Camilla Ferdinand: Test Class Call', e.Calendar_Title__c);
}
}

Error: 14:56:55:445 EXCEPTION_THROWN [13]|System.DmlException: Insert failed. First exception on row 0 with id a0E540000004i1TEAQ; first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id]

Not quite sure what information I need to supply apart from the code and the error information. So please let me know if you need more information.

Many thanks
Hi there,

I'm trying to make a simple change to this Apex code, trying to add RecordType to the list of fields displayed (see in bold):

public class AttendeeController{
   // global List<SelectableAccount> accounts {get;private set;}
    public List<ClientWrapper> clientList {get;set;}
    public Set<Id> selClientIds {get;set;}
    public Boolean hasSelClient {get;set;}
    public String datename {get; set;}
   
    public AttendeeController()
    {
        
        clientList = new List<ClientWrapper>();
        selClientIds = new Set<Id>();
        
        for(Clients__c c : [Select Id, Name, RecordType from Clients__c where Name != null and active__c = true order by Name limit 999])
        {
            clientList.add(new ClientWrapper(c));
        }
        integer i = 0;

I then get this error message:
No such column 'RecordType' on entity 'Clients__c'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

I have confirmed that RecordType is the correct field name. It is a standard field. I have also tried selecting another standard field and I get the same mesage. When I try selecting a custome field I have no problem at all.

Can someone help pleae?
Thanks
Hi,

I'm trying to deploy a validation rule and I get a Code Ceverage Failure. The vaildation is against the Current_Address__c field in the custome object Clients and the rule is:
AND (ISBLANK( Current_Address__c ), OR(ISNEW(),ISCHANGED(Current_Address__c)))

I have made sure that all the client records with a blank address were updated with a value ('N/A') and I still get the error messages on deployment validation.

Component Errors
, Details: Average test coverage across all Apex Classes and Triggers is 70%, at least 75% test coverage is required.

AttendeeControllerTEST.testAddClientToAllSessions(); AttendeeControllerTEST.testAddClientToSession(), Details: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please enter a valid Current Address for the client: [Current_Address__c] Class.AttendeeControllerTEST.testAddClientToAllSessions: line 30, column 1; System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please enter a valid Current Address for the client: [Current_Address__c] Class.AttendeeControllerTEST.testAddClientToSession: line 10, column 1

TESTCLASS_EventTrigger.validateEventTrigger(), Details: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please enter a valid Current Address for the client: [Current_Address__c] Class.TESTCLASS_EventTrigger.validateEventTrigger: line 11, column 1

Apex Test Failures
AttendeeControllerTEST testAddClientToSession System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please enter a valid Current Address for the client: [Current_Address__c]
Stack Trace: Class.AttendeeControllerTEST.testAddClientToSession: line 10, column 1

AttendeeControllerTEST testAddClientToAllSessions System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please enter a valid Current Address for the client: [Current_Address__c]
Stack Trace: Class.AttendeeControllerTEST.testAddClientToAllSessions: line 30, column 1

TESTCLASS_EventTrigger validateEventTrigger System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please enter a valid Current Address for the client: [Current_Address__c]
Stack Trace: Class.TESTCLASS_EventTrigger.validateEventTrigger: line 11, column 1
Deployment Validation Error

Thanks for your help.
 
Hi everyone,

I would like to create a web form to feed the contact standard object and a couple of custom objects.

I've been looking everywhere and all I can find is how to build an App, which is not what I want. 

Can anyone direct me to a tutorial that shows me how to do that?

All I really need is to understand how to create a new page based on the Contacts object.

Thanks
Nitzan
I'm on the Creating List View module in TrailHead and I'm trying to follow the instruction to create a list view: "To create a new view, click Create New View at the top of any list page or in the Views section of any tab home page."

The thing is, I cannot find the top of any list page or the Views section. I've looked everywhere :-(

I'm new to Salesforce, so please forgive me if the answer is very obvious :-)
Hi all,

I have these 3 fields:
SELECT Name, First_Name__c, Last_Name__c FROM Clients__c 

I would like to run a periodical apex process to split the values from Name into First Name and Last Name.

All charachters until 1st space is First Name and everything else is Last Name.

Can anyone please help?

Thanks
Hi all,

I made some changes to Apex class code and all tests come back without a failure. However, when I try to deploy and run the validation, I still get below 75% coverege but there is no explanation. Does anyone know how to resolve this?

Deployment Validation Error

Thanks
Nitzan
Hi everyone,

This may be really simple but I'm new to this so would appreciate any help.

I have this test trigger:

@isTest
private class TESTCLASS_EventTrigger {
static testMethod void validateEventTrigger() {

   datetime myDateTime =
   datetime.newInstance(2012, 1, 1);
   
Clients__c c = TestUtilities.insertClient();
Event e = new Event(Subject='Test Class Call', WhatID ='a0EC000000AkWqD',
                    DurationInMinutes=30, StartDateTime=myDateTime);
// Insert Client & Event
insert c;
insert e;

// Retrieve the new Event
e = [SELECT ID, Calendar_Title__c FROM Event WHERE Subject = 'Test Class Call'];
System.debug('Calendar_Title__c: ' + e.Calendar_Title__c);

// Test that the trigger correctly updated the price
System.assertEquals('Camilla Ferdinand: Test Class Call', e.Calendar_Title__c);
}
}

Here's the test utility:
@isTest
public with sharing class TestUtilities {
    
    public Contact      aContac         {get; set;}
    public Attachment   aAttachment     {get; set;}
    
    static User testUser;
    
    public void generateContact(){

        this.aContac                = new Contact();
        this.aContac.firstName      = 'Test';
        this.aContac.LastName       = 'Test';
        
        insert this.aContac;

        this.aAttachment = new Attachment();
        this.aAttachment.Body = Blob.valueOf('String');
    }
    
    public static TestUtilities generateTest(){
        TestUtilities e = new TestUtilities();
        e.generateContact();
        return e;
    }
    
        public static User createUser(Id profileId)
        {   
            //fetch existing users with provided profile and role
            List<User> userLst = [Select Id From User where ProfileId =: profileId and IsActive = :true Limit 1];
            
            User user;
            
            if(userLst.size()>0)
            {
                //at least one user exists; return user record
                user =  userLst[0];
            }
            else
            {
                //user does not exist; create new user
                user = new User(profileid = profileId,
                                alias = 'standt', email = 'standarduser@testorg.com',
                                emailencodingkey = 'UTF-8', lastname = 'Tsting', languagelocalekey = 'en_US',
                                localesidkey = 'en_US', timezonesidkey = 'America/Los_Angeles',
                                username = profileId + '@testorg.com');
                insert user;
            }
           
            return user;
        }
        
    public static Clients__c insertClient()
    {
        Clients__c c = new Clients__c(Name ='TestClient', Active__c = true,
                                      OC_Programme__c = 'OC Central', Current_Address__c = 'N/A',
                                      Primary_Phone_Number__c = 'N/A');
        return c;
    }
    
    public static Contact insertContact()
    {
        Contact c = new Contact(FirstName ='Test',LastName ='Test', Training_Contact__c = true);
        return c;
    }
    
    public static Project__c insertProject()
    {
        Profile p = [select id from profile where name='OC Impact'];
        UserRole r = [select id from UserRole where name='OC Impact Director'];
        User userSRO  = TestUtilities.createUser(p.Id);
        RecordType rt = [select id from RecordType where SobjectType = 'Project__c' and DeveloperName = 'Project' limit 1];
        string rId = rt.Id;
        Project__c proj = new Project__c(Name = 'testProject',
                                         OC_field__c = 'OC Impact',
                                         Project_summary__c = 'Test Summary',
                                         Project_start_date__c = date.newInstance(2013, 1, 1),
                                         Project_end_date__c = date.newInstance(2013, 12, 25),
                                         RecordtypeId = rt.id,
                                         Submit_for_Approval_by__c = date.newInstance(2018, 12, 25),
                                         Senior_Responsible_Officer_SRO__c = userSRO.Id);
        return proj;                                 
    }
    
    public static Project_Budget__c createProjectBudget(Id projId)
    {
        Project_Budget__c pb = new Project_Budget__c(Name = 'Session',
                                                     Cost_Centre__c = 'Session',
                                                     Income__c = 0,
                                                     Expense__c = 0,
                                                     Project__c = projId);
        return pb;
    }
    
    public static Project_Budget_Detail__c createProjectBudgetDetail(Id projBudgetId)
    {
        Project_Budget_Detail__c pb = new Project_Budget_Detail__c(
                                                     Paid_As__c = 'Cash',
                                                     Income__c = 0,
                                                     Expense__c = 0,
                                                     Project_Budget__c = projBudgetId);
        return pb;
    }
}

And here is the trigger code (which I haven't touched):
trigger EventTrigger on Event (before insert, before update) {

    Event[] eventToUpdate = trigger.new;
    Clients__c clientInfo = new Clients__c();
    Project__c projectInfo = new Project__c();
    
    for (Event e : eventToUpdate)
    {
        if(e.WhatId != Null)
        {
            If(string.valueOf(e.WhatId).startsWith('a0E'))
            {
                clientInfo = [SELECT ID, Name from Clients__c Where ID = :e.WhatId];
                e.Calendar_Title__c = clientInfo.Name + ': ' + e.Subject;
            }
            
            If(string.valueOf(e.WhatId).startsWith('a04'))
            {
                projectInfo = [SELECT ID, Name from Project__c Where ID = :e.WhatId];
                e.Calendar_Title__c = projectInfo.Name + ': ' + e.Subject;
            }
        
        }
    }

}

And here is the error message I get:
15:43:17:411 EXCEPTION_THROWN [13]|System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, EventTrigger: execution of BeforeInsert

Thanking you in advance.
I suspect that this test to the EventTrigger has not been working for a while but now it's stopping me from deploying some changes that seem to be related.

I think the problem is with the insert to event but I can't work out how to fix it.

@isTest
private class TESTCLASS_EventTrigger {
static testMethod void validateEventTrigger() {

   datetime myDateTime =
   datetime.newInstance(2012, 1, 1);
   
Clients__c c = TestUtilities.insertClient();
        insert c;
Event e = new Event(Subject='Test Class Call', WhatID ='a0E54000000Ct6e',
                    DurationInMinutes=30, StartDateTime=myDateTime, EndDateTime=myDateTime);
// Insert Client & Event
insert c;
insert e;

// Retrieve the new Event
e = [SELECT ID, Calendar_Title__c FROM Event WHERE Subject = 'Test Class Call'];
System.debug('Calendar_Title__c: ' + e.Calendar_Title__c);

// Test that the trigger correctly updated the price
System.assertEquals('Camilla Ferdinand: Test Class Call', e.Calendar_Title__c);
}
}

Error: 14:56:55:445 EXCEPTION_THROWN [13]|System.DmlException: Insert failed. First exception on row 0 with id a0E540000004i1TEAQ; first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id]

Not quite sure what information I need to supply apart from the code and the error information. So please let me know if you need more information.

Many thanks
Hi there,

I'm trying to make a simple change to this Apex code, trying to add RecordType to the list of fields displayed (see in bold):

public class AttendeeController{
   // global List<SelectableAccount> accounts {get;private set;}
    public List<ClientWrapper> clientList {get;set;}
    public Set<Id> selClientIds {get;set;}
    public Boolean hasSelClient {get;set;}
    public String datename {get; set;}
   
    public AttendeeController()
    {
        
        clientList = new List<ClientWrapper>();
        selClientIds = new Set<Id>();
        
        for(Clients__c c : [Select Id, Name, RecordType from Clients__c where Name != null and active__c = true order by Name limit 999])
        {
            clientList.add(new ClientWrapper(c));
        }
        integer i = 0;

I then get this error message:
No such column 'RecordType' on entity 'Clients__c'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

I have confirmed that RecordType is the correct field name. It is a standard field. I have also tried selecting another standard field and I get the same mesage. When I try selecting a custome field I have no problem at all.

Can someone help pleae?
Thanks
Hi,

I'm trying to deploy a validation rule and I get a Code Ceverage Failure. The vaildation is against the Current_Address__c field in the custome object Clients and the rule is:
AND (ISBLANK( Current_Address__c ), OR(ISNEW(),ISCHANGED(Current_Address__c)))

I have made sure that all the client records with a blank address were updated with a value ('N/A') and I still get the error messages on deployment validation.

Component Errors
, Details: Average test coverage across all Apex Classes and Triggers is 70%, at least 75% test coverage is required.

AttendeeControllerTEST.testAddClientToAllSessions(); AttendeeControllerTEST.testAddClientToSession(), Details: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please enter a valid Current Address for the client: [Current_Address__c] Class.AttendeeControllerTEST.testAddClientToAllSessions: line 30, column 1; System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please enter a valid Current Address for the client: [Current_Address__c] Class.AttendeeControllerTEST.testAddClientToSession: line 10, column 1

TESTCLASS_EventTrigger.validateEventTrigger(), Details: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please enter a valid Current Address for the client: [Current_Address__c] Class.TESTCLASS_EventTrigger.validateEventTrigger: line 11, column 1

Apex Test Failures
AttendeeControllerTEST testAddClientToSession System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please enter a valid Current Address for the client: [Current_Address__c]
Stack Trace: Class.AttendeeControllerTEST.testAddClientToSession: line 10, column 1

AttendeeControllerTEST testAddClientToAllSessions System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please enter a valid Current Address for the client: [Current_Address__c]
Stack Trace: Class.AttendeeControllerTEST.testAddClientToAllSessions: line 30, column 1

TESTCLASS_EventTrigger validateEventTrigger System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please enter a valid Current Address for the client: [Current_Address__c]
Stack Trace: Class.TESTCLASS_EventTrigger.validateEventTrigger: line 11, column 1
Deployment Validation Error

Thanks for your help.
 
Hi everyone,

I would like to create a web form to feed the contact standard object and a couple of custom objects.

I've been looking everywhere and all I can find is how to build an App, which is not what I want. 

Can anyone direct me to a tutorial that shows me how to do that?

All I really need is to understand how to create a new page based on the Contacts object.

Thanks
Nitzan
Hi,

I have a formula field named Contract End Date and the value of this field should be calucated based on Contract Start Date and the Contract Duration. Contract Start Date is of type Date and Contract Duration is the number of months. Id I just add both the fields it considers Contract Duration as number of days instead of month. How do I achieve this?

Thanks
Jina