• K@S
  • NEWBIE
  • 75 Points
  • Member since 2014

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 15
    Replies
I am trying to discover how to override the standard style in Salesforce. I am more of a declartive developer. I would like to keep the SF header. I simply want a new skin (white background).
1) Can you tell me how to do this.
2) Provide sample VF code.  
3) Instruct me as to how to include the VF page, to override the standard SF style, so that the style is universal (application wide)..

 I would truly appreciate it.
Hi,

I Need to restrict two decimal points in field type is percent.

NOT(
 REGEX(TEXT(ABC__c),"\d+(\.\d{0,2})"))

But showing syntax error
Please help on this.
  • March 03, 2016
  • Like
  • 0
Hi team,
I face this error
System.AssertException: Assertion Failed: Missing id at index: 0
I want to delete the item time through the error in.
please help on this
  static testMethod void Testtems(){
       User u2 = TestCaseHelpers.usrMethdLstWithProfileNameAndRoleName(2, 'Super System Admin', 'Nicole Team')[0];
        System.runAs(u2){
        
        list<OpportunityLineItem> oliList = new list<OpportunityLineItem>();
        //Create test line item
        OpportunityLineItem oliInst = new OpportunityLineItem();
        oliInst.OpportunityId = op.Id;
        oliInst.ServiceDate = startDate;
        oliInst.Quantity = 1;
        oliInst.UnitPrice = 1;
        oliInst.AB2__ABDropID__c = '-1';
        oliList.add(oliInst);
        insert oliList;
        try{
            delete oliList;
        }
        
        Catch(ListException e){
            System.assert(e.getMessage().contains('Error:You are trying to delete Opportunity Line Item(s) that have delivery; this function is not allowed here'),e.getMessage());       
        }
      
        }
      }
  • November 05, 2015
  • Like
  • 0
Hi Team,
process Builder :how to a total opportunity amounts to add contaract object amount field using process builder.
I am new to process builder.
please let me know(Urgent).

Thanks,
kae
  • October 12, 2015
  • Like
  • 0
Hi Team,
This my apex controller and I wrote test class for this related but not working(test class).
Could you please help  me on this.
public class searchClientVisits{   
    List<Client_Visit__c> clientVisitList {get;set;}
    public Client_Visit__c clientInfo { get;set;}
    public SearchClientVisits(){  
        clientInfo = new Client_Visit__c ();
    } 
    //get a client visit list 
    public List<Client_Visit__c> getclientVisitList(){
        return clientVisitList;
    }
    //search the client records
    public void runSearch(){
        if(clientInfo.Start_Date__c != null && clientInfo.End_Date__c != null){
            Date startDate = clientInfo.Start_Date__c;
            System.debug('#####'+startDate); 
            Date endDate = clientInfo.End_Date__c;
            System.debug('#####'+endDate);            
            clientvisitList = [SELECT Id,Accounts__c,Start_Date__c,End_Date__c,Clients__c,Locations__c  FROM Client_Visit__c  WHERE Start_Date__c >= :startDate AND End_Date__c <=:endDate];
            System.debug('#####'+clientvisitList);     
        }       
    }
    public PageReference reset(){
        PageReference newpage = new PageReference(System.currentPageReference().getURL());
        newpage.setRedirect(true);
        return newpage;
    }
======================================================
Test class
@isTest
Public class clientVistTest{
   static testMethod void tsetSearchList() {
       clientvisitList cv = new  clientvisitList();
       clientvisitList = [SELECT Id,Accounts__c,Start_Date__c,End_Date__c,Clients__c,Locations__c  FROM Client_Visit__c  WHERE Start_Date__c >= :startDate AND End_Date__c <=:endDate];
       System.assert(!cv = null );
        Test.startTest();
        PageReference pageRef = Page.reset;
        Test.setCurrentPageReference(pageRef);
        Test.stopTest();
    }
}
 
  • July 01, 2015
  • Like
  • 0
Hi Team,
I got the errors, please help on this.
Apex class
[Error] Error: Compile Error: Variable does not exist: Start_Date__c at line 11 column 11
public class searchClientVisits{   
    List<Client_Visit__c> clientVisitList {get;set;}
    public Client_Visit__c clientInfo { get;set; }
    
    public SearchClientVisits(){  
     clientInfo  = new Client_Visit__c ();
    }
    
     public PageReference runSearch(){
       string query='SELECT Id,Start_Date__c,End_Date__c FROM Client_Visit__c WHERE CloseDate < LAST_FISCAL_QUARTER';
       if(Start_Date__c == strtdate && End_date__c == enddate){
             
      }
      clientVisitList =database.query(query);
   }
     public PageReference reset(){
        PageReference pg = new PageReference(System.currentPageReference().getURL());
        pg.setRedirect(false);
        return pg;
    }
}

VF page
[Error] Error: Unknown property 'void.Start_Date__c'

<apex:page controller="searchClientVisits">
    <apex:form>
        <apex:pageBlock>
        <apex:pageBlockSection >
        <apex:inputField value="{!clientInfo.Start_Date__c}" label="Start Date"/>
        <apex:inputField value="{!clientInfo.End_Date__c }" label="End Date"/>
        </apex:pageBlockSection>

    <apex:pageBlockButtons >
    <apex:commandButton value="Reset" action="{!reset}"/>
    <apex:commandButton value="Search" action="{!runSearch}"/>
    </apex:pageBlockButtons>
    </apex:pageBlock>

    <apex:pageBlock >
    <apex:pageBlockTable value="{!clientVisitList }" var="client" id="clientList">
    <apex:column value="{!client.Start_Date__c}" headerValue="Start Date"/>
    <apex:column value="{!client.End_Date__c }" headerValue="End Date"/>
   </apex:pageBlockTable>
   
  </apex:pageBlock>
</apex:form>
</apex:page>
  • June 30, 2015
  • Like
  • 0
Hi Team,
how  to write test class  for this trigger,please help on this
trigger updateStatusTrigger on Task (after insert,after update) {
    List<Opportunity> oppLst = new List<Opportunity>();
    Set<Id> oppId = new Set<Id>();
    for(Task tObj:trigger.new){
        oppId.add(tObj.WhatId);
    }   
    Map<Id,Opportunity> oppMap =new Map<Id,Opportunity>([SELECT Id,StageName,CloseDate,Task_Status__c FROM Opportunity WHERE Id IN :oppId]);
      for(Task t : Trigger.new){
      if(Trigger.isInsert || (Trigger.isUpdate && (t.Status!= Trigger.oldMap.get(t.Id).Status))){
       
       oppMap.get(t.whatId).Task_Status__c=t.Status;
       }
     
    database.update(oppMap.values(),false);
    }
}

I wrote this like
test class
public class updatequotestatus_test
{
    static testmethod void MyUnitTest()
    {    
        // Create an Opportunity record
        Opportunity opp = new Opportunity(Name='TestOpp',CloseDate=System.today(),StageName='Prospecting');
        insert opp;
        
        // Create an Task record to test your Trigger and relate it with the Quote created
        Task t = new Task(Name='Test Task',Priority='Normal',whatId=q.id,Subject='Call',Status='Not Started');
        insert t;
    }

}
Thanks,
kae

 
  • June 26, 2015
  • Like
  • 0
 In opportunity object create a new Lookup – Deal Lead which is a lookup to Lead object.
Create new field Opportunity status and Lead status respectively in Opportunity and Lead.
 Both pick list should contain below values: Open, In progres,Closed
When opportunity status is getting modified modify corresponding lead status also.
Assume that you can associate one lead with only one opportunity
trigger Update_status_Trigger on Opportunity (after update) {
   Set<Id> oppId =new Set<Id>();
   List<Lead> updList =new List<Lead>();
   for(opportunity opps : Trigger.new){
       if(opps.status__c!=Trigger.oldMap.get(opps.id).status__c){
           oppId.add(opps.Id);
       }
   }
   for(Lead led : ([select id,name,status__c FROM Lead WHERE oppId IN : oppId ])){
       if(!Trigger.newMap.get(led.oppId).status__c.contains(led.status__c)){
           updList.add(led);
       }
   }
   try{
       if(updList .size()>0){
           Database.update(updList ,false);
       }
      }catch(Exception e){
       System.debug('########'+e.getMessage());
       }
}
  • June 22, 2015
  • Like
  • 0
Hi,

I Need to restrict two decimal points in field type is percent.

NOT(
 REGEX(TEXT(ABC__c),"\d+(\.\d{0,2})"))

But showing syntax error
Please help on this.
  • March 03, 2016
  • Like
  • 0
Hello,
I am having trouble hitting the code coverage level on a event trigger, i am getting 57% at the moment.

I am guessing there is something small i am missing.

Any hits would be great.

===== Trigger =====
trigger CreateReminder on Enrolment__c (after insert) {
    List<Enrolment__c> Enrolment = new List<Enrolment__c>();
    List<Event> tasks = new List<Event>();  
    
    for (Enrolment__c e: trigger.new) {
        Product2[] PD = [select Agent_Reminder__c,Enrolment_Support_Reminder__c from Product2 where Id = :e.Product__c and IsActive = TRUE];
        Group GP = [SELECT Id FROM Group where Name = 'Enrolment Support Reminders'];
        GroupMember GM = [SELECT UserOrGroupId FROM GroupMember where GroupId = :GP.id limit 1];
        String enrolment_support = GM.UserOrGroupId;
        
        for(Product2 ipd: PD ) {
       
            if (ipd.Agent_Reminder__c == true) {
                tasks.add(new Event(
                    Whatid = e.id,  
                    OwnerID = UserInfo.getUserId(),
                    Engagement__c = 'Follow Up Pending ',
                    Subject = '48 hour enrolment follow-up call',
                    Description = 'Please call your enrolled student and ensure they have successfully submitted all relevant documentation and have accepted their offer.\n\nPlease ensure they are happy with the process so far, and overcome any issues they may have.\n\nPlease send Lode Careers email and encourage the student to opt-in now.',
                    ReminderDateTime = System.now().addHours(47),
                    IsReminderSet = true,
                    DurationInMinutes = 5,
                    StartDateTime = System.now().addHours(48)
                    )
                );
            }
            
            if (ipd.Enrolment_Support_Reminder__c == true) {
                tasks.add(new Event(
                    Whatid = e.id,
                    OwnerID = enrolment_support,
                    Engagement__c = 'Follow Up Pending ',
                    Subject = 'Enrolment Support: Follow-up enrolment',
                    Description = 'Please validate this enrolment is progressing towards the first census date.',
                    DurationInMinutes = 5,
                    StartDateTime = System.now().addHours(336)
                    )
                );
            }
        }
    }  
    
    insert tasks;
}


===== Test Class =====
@isTest
private class test_create_reminder {

    @isTest(SeeAllData=false)
    private static void test_create_enrolment() {
    
        List<enrolment__c> createenrolment = new List <enrolment__c> ();
        
        List<Account> acc = [SELECT id FROM account limit 1];
        
        for (Account a: acc) {
            createenrolment.add(
                new enrolment__c(
                    Product__c = '01t90000004q3PH',
                    Account__c = a.id,
                    Call_Centre__c = 'Call_Centre__c',
                    Who_Enrolled__c = '00590000001Symm'
                )
            );
        }
        
        insert createenrolment;

    
        List<Event> tasks = new List<Event>();
        List<Enrolment__c> en = [SELECT id FROM Enrolment__c limit 1];

        for (Enrolment__c e: en) {
            Product2[] PD = [select Agent_Reminder__c,Enrolment_Support_Reminder__c from Product2 where Id = :e.Product__c];
            Group GP = [SELECT Id FROM Group where Name = 'Enrolment Support Reminders'];
            GroupMember GM = [SELECT UserOrGroupId FROM GroupMember where GroupId = :GP.id limit 1];
            String enrolment_support = GM.UserOrGroupId;
                
            for(Product2 ipd: PD ) {
                if (ipd.Agent_Reminder__c == true) {
                    tasks.add(new Event(
                            Whatid = e.id,  
                            OwnerID = UserInfo.getUserId(),
                            Engagement__c = 'Follow Up Pending ',
                            Subject = '48 hour enrolment follow-up call',
                            Description = 'Please call your enrolled student and ensure they have successfully submitted all relevant documentation and have accepted their offer.\n\nPlease ensure they are happy with the process so far, and overcome any issues they may have.\n\nPlease send Lode Careers email and encourage the student to opt-in now.',
                            ReminderDateTime = System.now().addHours(47),
                            IsReminderSet = true,
                            DurationInMinutes = 5,
                            StartDateTime = System.now().addHours(48)
                            )
                    );
                }

                if (ipd.Enrolment_Support_Reminder__c == true) {
                    tasks.add(new Event(
                        Whatid = e.id,
                        OwnerID = enrolment_support,
                        Engagement__c = 'Follow Up Pending ',
                        Subject = 'Enrolment Support: Follow-up enrolment',
                        Description = 'Please validate this enrolment is progressing towards the first census date.',
                        DurationInMinutes = 5,
                        StartDateTime = System.now().addHours(336)
                        )
                    );  
                }
            }   
            
            insert tasks;
        }
    }
}
Here i am trying to write a test class this class,which work is to upload large amount of records in a custom object.
Help me to write its test class please.

public class MassUpload{
    transient public Blob M_Body{get;set;}
    public String emailToalert{get;set;}
    public String retURL{get;set;}
    
    
    public MassUpload(){
    emailToalert='';
    retURL = ApexPages.currentPage().getParameters().get('retURL');
    }
    public void massUpload(){
        if(M_Body==null || M_Body.size()==0){
        ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Please select a file to attach.'));
        return;
        }
        try{
        List<String> csvFileLines=M_Body.toString().split('\n');
        csvFileLines.remove(0);
        if(csvFileLines!=null && csvFileLines.size()>0){
        MassUpload mass=new MassUpload(csvFileLines,emailToalert);
        Database.executeBatch(mass,26);
        }
        }catch(Exception e){
            ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured while importin data Please make sure input csv file is correct');
            ApexPages.addMessage(errorMessage);
        }
    }
}
  • November 09, 2015
  • Like
  • 0
I am trying to discover how to override the standard style in Salesforce. I am more of a declartive developer. I would like to keep the SF header. I simply want a new skin (white background).
1) Can you tell me how to do this.
2) Provide sample VF code.  
3) Instruct me as to how to include the VF page, to override the standard SF style, so that the style is universal (application wide)..

 I would truly appreciate it.
Hey Peeps!

I'm having an issue that I hope someone can help me with, concerning rendering a list of objects in a VF page.

I have a controller called Ticket, which contains a generic class:
public class Comment {
    Integer id {get; set;}
    String author {get; set;}
    String body {get; set;}
    String created {get; set;}
}
I have a list of these generic classes:
public List<Comment> comments {get {
    Comment [] cmt = this.fetchTicketComments(); 
    return cmt;
}set;}
The method fetchTicketComments calls another method:
private List<Comment> parseTicketComments(String json_string) {
	Comment [] ticket_comments = new List<Comment>();
	Map<String, Object> json_object = (Map<String, Object>) JSON.deserializeUntyped(json_string);
	List<Object> jira_ticket_comments = (List<Object>) json_object.get('comments');
	while (jira_ticket_comments.size() > 0) {
		Comment instance_comment = new Comment();
		Map<String, Object> cmt = (Map<String, Object>) jira_ticket_comments.get(0);
		Map<String, Object> author = (Map<String, Object>) cmt.get('author');
		instance_comment.id = Integer.valueOf(cmt.get('id'));
		instance_comment.author = String.valueOf(author.get('displayName'));
		instance_comment.body = String.valueOf(cmt.get('body'));
		instance_comment.created = Datetime.valueOf(String.valueOf(cmt.get('created')).replace('T', ' ')).format('M/d/y hh:mm a');
		
		ticket_comments.add(instance_comment);
		jira_ticket_comments.remove(0);
	}
	return ticket_comments;
}


Now to display this list of comments along with other data for a Ticket, I have this markup in my VF page:
<apex:pageBlockSection rendered="{!NOT is_new}" id="comment_detail" collapsible="true">
	<apex:repeat value="{!comments}" var="cmt">
		<apex:outputText >Comment:</apex:outputText>
 		<apex:inputTextarea cols="80" rows="4" value="{!cmt.body}" />
	</apex:repeat>
</apex:pageBlockSection>

The problem is that everytime I save, I get this error: 
Compilation error: Unknown property 'Ticket.Comment.body'

I'm confused because comments is a List of Comment objects, and a Comment object has a body property.

I'm fairly new to Apex, but not software development, so this is driving me nuts =)
I'm clearly missing some Java/Apex idiom here.

Thanks for any help.
Paul
HI All,
i have an question suppose i have two custom object A & B
i have a lookup 'C' on object  B of  object A
Now i want to write some SOQL like i just want to select value from object A and B which have C value that i will passed.
Hi Team,
This my apex controller and I wrote test class for this related but not working(test class).
Could you please help  me on this.
public class searchClientVisits{   
    List<Client_Visit__c> clientVisitList {get;set;}
    public Client_Visit__c clientInfo { get;set;}
    public SearchClientVisits(){  
        clientInfo = new Client_Visit__c ();
    } 
    //get a client visit list 
    public List<Client_Visit__c> getclientVisitList(){
        return clientVisitList;
    }
    //search the client records
    public void runSearch(){
        if(clientInfo.Start_Date__c != null && clientInfo.End_Date__c != null){
            Date startDate = clientInfo.Start_Date__c;
            System.debug('#####'+startDate); 
            Date endDate = clientInfo.End_Date__c;
            System.debug('#####'+endDate);            
            clientvisitList = [SELECT Id,Accounts__c,Start_Date__c,End_Date__c,Clients__c,Locations__c  FROM Client_Visit__c  WHERE Start_Date__c >= :startDate AND End_Date__c <=:endDate];
            System.debug('#####'+clientvisitList);     
        }       
    }
    public PageReference reset(){
        PageReference newpage = new PageReference(System.currentPageReference().getURL());
        newpage.setRedirect(true);
        return newpage;
    }
======================================================
Test class
@isTest
Public class clientVistTest{
   static testMethod void tsetSearchList() {
       clientvisitList cv = new  clientvisitList();
       clientvisitList = [SELECT Id,Accounts__c,Start_Date__c,End_Date__c,Clients__c,Locations__c  FROM Client_Visit__c  WHERE Start_Date__c >= :startDate AND End_Date__c <=:endDate];
       System.assert(!cv = null );
        Test.startTest();
        PageReference pageRef = Page.reset;
        Test.setCurrentPageReference(pageRef);
        Test.stopTest();
    }
}
 
  • July 01, 2015
  • Like
  • 0
Hi Team,
I got the errors, please help on this.
Apex class
[Error] Error: Compile Error: Variable does not exist: Start_Date__c at line 11 column 11
public class searchClientVisits{   
    List<Client_Visit__c> clientVisitList {get;set;}
    public Client_Visit__c clientInfo { get;set; }
    
    public SearchClientVisits(){  
     clientInfo  = new Client_Visit__c ();
    }
    
     public PageReference runSearch(){
       string query='SELECT Id,Start_Date__c,End_Date__c FROM Client_Visit__c WHERE CloseDate < LAST_FISCAL_QUARTER';
       if(Start_Date__c == strtdate && End_date__c == enddate){
             
      }
      clientVisitList =database.query(query);
   }
     public PageReference reset(){
        PageReference pg = new PageReference(System.currentPageReference().getURL());
        pg.setRedirect(false);
        return pg;
    }
}

VF page
[Error] Error: Unknown property 'void.Start_Date__c'

<apex:page controller="searchClientVisits">
    <apex:form>
        <apex:pageBlock>
        <apex:pageBlockSection >
        <apex:inputField value="{!clientInfo.Start_Date__c}" label="Start Date"/>
        <apex:inputField value="{!clientInfo.End_Date__c }" label="End Date"/>
        </apex:pageBlockSection>

    <apex:pageBlockButtons >
    <apex:commandButton value="Reset" action="{!reset}"/>
    <apex:commandButton value="Search" action="{!runSearch}"/>
    </apex:pageBlockButtons>
    </apex:pageBlock>

    <apex:pageBlock >
    <apex:pageBlockTable value="{!clientVisitList }" var="client" id="clientList">
    <apex:column value="{!client.Start_Date__c}" headerValue="Start Date"/>
    <apex:column value="{!client.End_Date__c }" headerValue="End Date"/>
   </apex:pageBlockTable>
   
  </apex:pageBlock>
</apex:form>
</apex:page>
  • June 30, 2015
  • Like
  • 0
 In opportunity object create a new Lookup – Deal Lead which is a lookup to Lead object.
Create new field Opportunity status and Lead status respectively in Opportunity and Lead.
 Both pick list should contain below values: Open, In progres,Closed
When opportunity status is getting modified modify corresponding lead status also.
Assume that you can associate one lead with only one opportunity
trigger Update_status_Trigger on Opportunity (after update) {
   Set<Id> oppId =new Set<Id>();
   List<Lead> updList =new List<Lead>();
   for(opportunity opps : Trigger.new){
       if(opps.status__c!=Trigger.oldMap.get(opps.id).status__c){
           oppId.add(opps.Id);
       }
   }
   for(Lead led : ([select id,name,status__c FROM Lead WHERE oppId IN : oppId ])){
       if(!Trigger.newMap.get(led.oppId).status__c.contains(led.status__c)){
           updList.add(led);
       }
   }
   try{
       if(updList .size()>0){
           Database.update(updList ,false);
       }
      }catch(Exception e){
       System.debug('########'+e.getMessage());
       }
}
  • June 22, 2015
  • Like
  • 0
I am new to sfdc please some one help me out.
In opportunity i need to have a custom "button". when i click a button it must open a popup and get all users with search functionality in it. When i select a user and click on "save" it must change the opportunity owner to the user. main functionality is assigning user to opportunity after creation. Thanks in advance.