• Linda 98
  • NEWBIE
  • 368 Points
  • Member since 2013

  • Chatter
    Feed
  • 8
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 169
    Questions
  • 264
    Replies

While coding I get double lines as shown:

User-added image

The further down the page I go the worse it is. Is there a fix for this that doesn't involve switching browsers, as I find Chrome useful. The further down the page of code I go, the worse it gets. I have tried increasing/decreasing font size, and that didn't work.

Hello,

I am having a trigger on an Opportunity object(after update) which fires after the checkbox is selected and creates child objects.
I have this trigger to divide the total amount based on the number of days(start date to end date)

Everything works fine. Now I would like to update the child object records if the amount is changed and recalculate the amount and update the records.Debug logs shows the values correctly,but when i update list,i get error MISSING ARGUMENT ID
Below is my code.JUST THE UPDATE PART WHICH I AM DOING
 
trigger createprojects on Opportunity (after update) {
/****
other functions of trigger****/
    set<id> ids = new set<id>();  
               //Check if amount is changed
                if(oldOpp.Amount !=Opp.Amount__c && OPP.Amount__c != null)
                {
                    for(Opportunity op :trigger.new)
                    {
                        if (op.id != null) 
                        {
                            ids.add(op.id);

                        }
                    }
                    
                    for(Project__c plookup:[select id from Project__c where opportunity in :ids])
                    {
                        if(Opp.Start_Date__c != null && opp.End_date__c != null)
                        {
                        noOfMonths = Opp.Start_Date__c.monthsBetween(Opp.End_date__c); 
                        }
                        if(noOfMonths != Null & noOfMonths > 0)
                        {
                           Integer startMonth = Opp.Start_Date__c.month();
                           Date startDate = Opp.Start_Date__c;
                           Date endDate = OPP.Start_Date__c; 
                           for(Integer i = 0; noOfMonths >= i; i++)
                            {    
                        Project__c pro =new Project__c();
                            if(i > 0)
                            {
                            Date endD = endDate;
                            startDate = endD.addDays(1);
                            }
                            Date strD = startDate;

                            if(Opp.Amount !=null &&opp.Amount__c >0){
                            Integer dINM = date.daysInMonth(startDate.year(), (i < 0?(strD.month()+1):startDate.month()));

                            endDate = Date.newInstance(startDate.year(), startDate.month(), dINM);

                            Date eD= (i > 0)?(endDate > Opp.End_date__c?Opp.End_date__c:endDate):endDate;     

                            Integer noOfDays = startDate.daysBetween(ED)+1; 

                            pro.Name='Pro-'+startdate;
                            Pro.opporunity__c = Opp.id;
                            pro.Start_Date__c = startDate;
                            pro.End_Date__c = (i > 0)?(endDate > Opp.End_date__c?Opp.End_date__c:endDate):endDate;

                            pro.Opportunity = Pro.id;
                            pro.NumberofDays__c=noofdays;
                           pro.Plan_Amount__c=Opp.Amount/Opp.Project_Duration_CD__c*noofdays;
                            projectlistupdate.add(pro);
                            }
                        }          
                    }
               }  
              
    if(projectlistupdate.size() >0){
    update projectlistupdate;
    }
   }           
//    Insert projectlist;
    } 
}

 
Hi
Below is the code with dynamic soql which fetches 5-6 records if no contact has level TOP and is fetching 3 records if they are TOP.(WHICH IS OK) 
but i want to fetch only 3 records if level is NOT TOP. but i am failing in building dynamic soql.How can i include LIMIT (already having LIMIT condition)?
String level='Top';
String query ='select id,custompicklist__c from contact';

if(Roleslist.size() >0){
    Set<String> roleSet = new Set<String>(Roleslist);
        for(Integer i= 0; i<Roleslist.size();i++){
            if(i==0){
            query +=' where account.Active__c=true and roles__c  INCLUDES (\''+Roleslist[0]+'\'';       
            }else{
            query += ',\''+Roleslist[i]+'\'';
            }
           } 
                query += ')';  //LIMIT 3 here does the work but it is giving me error for next condition.
        Boolean enforceLimit = false;
        if([SELECT count() FROM Contact WHERE  account.Active__c=true AND custompicklistfield__c=:level AND roles__c IN :roleSet LIMIT 1] > 0){
        query += ' AND custompicklistfield__c=:level';
        enforceLimit = true;
    }
    if(enforceLimit){
            query += ' LIMIT 3';
    }
        if(query.contains(' INCLUDES ')){
 
        c=database.query(query);

 
Hi

I am having an after update trigger which fires when a checkbox is set to true. It then creates records in the related object.
After creating(after trigger functionality is implemented), I want to make the checkbox again as false programmatically. How can I achieve this?
I tried to make it false after building the list, but I am facing Read only error.

Thanks
I am having a list of Occupations, Driver, Mechanic, Plumber, Carpenter, Chef.
I have contact records with above occupations. One contact can have multiple occupations too.
So I have a trigger which creates Opportunities with these contacts when another field is updated.
Currently i am creating only one opportunity for each contact, now I am trying to create one opportunity for each contact based on occupation. For instance,

contact 1 - name:contact1,occupation:chef,carpenter
contact 2-name:contact2,occupation:Chef,driver
contact 3 -name:contact3,occupation:driver,mechanic,Plumber

My occupation list contains :  Chef,Driver,mechanic

So it should create 5 opportunities( now it creates only 3 opportunities using 3 contacts) like
1.Name-opp1,contact(lookup)-contact1,Contact occ-chef
2.Name-Opp2,contact(lookup)-contact2,contact occu-Chef
3.Name-Opp3,contact(lookup)-contact2,contact occu-driver
4.Name-Opp4,contact(lookup)-contact3,contact occu-Driver
5.Name-Opp5,contact(lookup)-contact3,contact occu-mechanic
I have to iterate over the list of occupations,and create opportunity records.How can i get this change.Thanks all.
Hello all,
How can I include email service email when a customer replies to the email which is sent from custom record.??
When a customer (Contact in Salesforce) clicks Reply from his email id, it is only being sent to the sender so I am not able to get in my inbound email class. I am sure I have to include the email service email id when sending the email but not able to figure out how as I am sending email with template to the contact email using Workflow. How can I include?

Thank you,

 
I am having a Custom object which sends an email(Process builder does that) to the contact field on the record with a template.

I am trying to 
1. When the contact email clicks reply and fill the template, the response should be returned to the record and linked to the same record.
2. Parse the values in the template and update the record from which email is sent.
I am sure I have to use the inbound email service class but not able to figure on how it works and how to start with.
I had already read on email services and inbound email services but couldn't understand how can I implement that my particular req.

 
String level ='Top';
String query='select id,Custompicklist__c  from Contact';

 if(Roleslist.size() >0){
        for(Integer i =0; i<roles.size();i++){
            if(i==0){
             query +=' where account.Active__c=true and custompicklistfield__c=:level and roles__c INCLUDES (\''+roleslist[0]+'\'';    
            }else{
            query += ',\''+roleslist[i]+'\'';
            }
           } 
                query += ')' limit 3;     
        }
        c=database.query(query);


THIS BRINGS CONTACT IDs of CONTACTS WHOSE LEVEL IS SET TO HIGH. BUT WHEN the field is set to a null or different value, then the query goes wrong and fetches 0 records.

 
Having a trigger to fire when a value is changed.
On update of the field, it should consider multi-select picklist values(List of roles-As it's multi-select datatype, may have one role is chosen or multiple chosen) and use them in a query to contact(Multi-select picklist field). Further, I would like to use those contact ids to create records in another custom object.
I saved the roles on record(trigger.new) into a list. But when I try to query to contact, I am not able to get the values.

For instance,
Values on Record 1-
checkbox -checked to true(which fires trigger)
Roles- Manager; Owner; Supervisor

Contact records-
contact 1-
Roles :Manager;Supervisor
Contact 2-
Roles-Owner
Contact 3:
roles-Manager;Architect
Contact 4-
Roles-Manager
Contact 5-
Roles: Analyst;Architech

In the above example, I would like to get all the contact IDs except contact 5. I even want Contact 3 even his roles include Architect which is not in our record roles list. As he is having a manager role, I would like to collect it too.

I used 
conroles=[select id,Roles__c,Title from contact where Roles__c IN :Roleslist];
Roleslist=List of roles on Record.
But its only fetching first roles contact's.

Split(',') doesn't seem to work, What am I doing wrong?
My use case- Custom object linkedcontacts__c with Master detail relations on contact and customobject2__c objects.
Having two multi-select picklist fields on both the objects, Named as Roles.
I am having a trigger on customobject2 which fires when a field is changed, then I am trying to get those multi-select field values(roles) and check against contact roles, and link the related contacts.
My major issue is as they are multi-select values if multiple roles are chosen then how can I achieve this??

For instance, if I am having a CB2 record with roles director; manager, I should be able to query those contacts whose roles are director or manager or director and manager(if any) and should relate by inserting record in the linkedcontact__c object. 
Please guide me.Thank you.
 
Created a custom object on record detail page.VF page will search records by using query in controller.
It has a input field and holds search text.I want to have more flexibity with the search text.It is being filled with value from record field.Like name of record.But i would like to give user to change the search text if he wants and still fit in the query.Like dynamic text field.
It has to work two ways,value from standard field and also should work if user chnages the value and give new value.Please help.
 
How can I change the location of error message.? I have a button which when clicked if required fields are not filled then I want to display error message above the button.

Now it's displaying on top of the page. I want to change the location of the error message. Changed in CSS to display bottom. Still no luck.Anything that I am missing.???
I have an apex class and apex trigger which calculates rollup fields.(6 fields) and updates total fields on the custom object from account object.

Everything works fine but now I want to move this to scheduler class as accounts update doesn't take place from UI and it only updates with a daily run.
So we are trying to write a scheduler class. Below is my apex class and trigger which works fine but when I try to move it to scheduler class and schedule it i am getting an error saying the list has no rows.

I don't want to trigger this class but schedule it to run every day 10 PM EST as my account update runs at 9 PM EST.
Public class rollupclass {
    Public static void totalRollup(List<Account> Acctlist){
        set<id> oppIds = new set<id>();
       
        double totalamt = 0;
       
        try {
                for (Account objacc : acclist){
                    oppIds.add(objacc.Values__c);  //Lookup relationship
               } 

          values__c objval = [SELECT Id,amttotal__c FROM values__c WHERE Id = :oppIds];
 
          List<Account> listAcc = [SELECT Id, amt1__c FROM Account WHERE values__c =:objacc.Id];
                
           for(Account Accounttotals : listAcc) {
                        totalamt += Accounttotals.amt1__c ;
                 }
               
                 objval.amttotal__c = totalamt;
                  update objval;   
            } 
        catch (Exception e) {
            }
    }
 }


 
I have a trigger to create a child, sub child records when status is changed.
like. Opportunity with line items and when  status changed then create customobject__c and its line items.
Everything works fine till here.
but when a field on opportunity line items called as 'numberoflines' is updated, I am trying to update 'totallines' field on customobject line items object
I created a trigger on Opplineitems,which when changed,have to update totallines field onn customobjectlineitems.
trigger totallineupdate on Opplineitem (before update) {

    Map<id,customobjectlineitem__c> newMap =new Map<id,customobjectlineitem__c>();
    
    for(Opplineitem Oli :trigger.new)
    {
        
        Opplineitem oldLi = Trigger.oldMap.get(Oli.id);
        
        if(Oli.Numberoflines != OldFL.Numberoflines){
                
            customobjectlineitem__c Coli =new customobjectlineitem__c(Opportunity__c=oli.Opportunity__c,Totallines=oLI.numberoflines);
            newMap.put(OLI.Opportunity__c,coli);         
      }
   }
   update newMap.values();   //id not specifed error here
   
}


What am I doing wrong?

I used opportunity, opportunity line items as examples as it explains relations.Thank you


 
I am changing one particular  field by checking lastmodifeddate in my code.All works fine but i am struck with test class.I am chnaging multiple records from multiple objects so my batch class looks like below.
 
global class editrecords implements Database.Batchable<string>, Schedulable{
global boolean bool = false;

global Iterable<string> start(Database.BatchableContext ctx) {
    return new list<String> { 'CO__c', 'CO2__c', 'CO3__c','CO4__c'};
}
global void execute(Database.BatchableContext ctx, list<string> listObj) {
    list<sObject> editrecords = new list<sObject>();
    for(string strObjName : listObj) {
        for(sObject objsObject : database.query('Select Id from ' + strObjName + ' where LastModifiedDate < LAST_N_DAYS:36')) {
                editrecords.add(objsObject);
            else {
                b = true;
                break;
            }
        }
    }
    update editrecords;
}
global void finish(Database.BatchableContext ctx) {

}        global void execute(SchedulableContext sc){
         Database.executebatch(new editrecords ());    
    }
}

my test class is as below which get 58% of coverage.How can i get lastmodified date and cover rest of code.please help.
 
@isTest
Public class testeditrecords{

    static testMethod void testMethod1(){

        CO__c CO =new CO__c(Name='testdata');
        insert CO;
        CO2__c co2 =new 
  co2__c(Name='testdata');
        insert co2;
        Co3__c co3 =new Co3__c(Name='test2');
        insert co3;

       for(CO__c c:[Select ID from CO__c where createddate=TODAY]){
        Test.startTest();
       
        editrecords obj = new editrecords();
        Database.executeBatch(obj);
        Test.stopTest();       
        }
   } 
}

 
we are using App from app exchange which is managed.
we are trying to edit VF page to display parent fields using field sets.we are not able to get them on to vf page.
What am i missing??

my VF page is as below.
 
<apex:page standardController="Childobject__c" extensions="managedapexclass" recordSetVar="CO">
  <script>
        window.onload = function(e) {
           var recordIds = '{!selected}';
           var Objectname = 'Childobject__c';
           var action = 'Edit';
           var fieldsetName = 'Myfieldset name';
           
          if(recordIds!='')
          {
              Redirect(recordIds,Objectname,action,fieldsetName);
          }
          else
          {
            alert('Please select a record.');
            window.history.back();
          }
            };
      </script>
 <apex:form >
 <apex:actionFunction action="{!Redirect}" name="Redirect" rerender="none">
   <apex:param name="recordIds" assignTo="{!recordIds}" value=""/>
   <apex:param name="Objectname" assignTo="{!objectName}" value=""/>
   <apex:param name="action" assignTo="{!action}" value=""/>
   <apex:param name="fieldsetName" assignTo="{!fieldsetName}" value=""/>

 </apex:actionFunction>
   

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

 
I am trying to get the mid part of the string in my flow and use the string

Like    Hello:  Linda Klein :Thank you

I would like to get Linda Klein.As i am having other various conditions,I have to check if my string begins with Hello and contains thank you.
I have written it as below but i dont get value in my field update.
Where am i going wrong.


IF( AND( BEGINS(Info, 'Hello: ') ,(CONTAINS(Info, ':Thank you'))), MID(Info, FIND("Hello: ", info )+ 6 , 
(FIND(": Thank you", info )-11) - (FIND("Hello: - ",Info ))),info)

nO error..no value in field.I am struck.

Thanks!!
I am using a Workflow field update and having IF conditions in it.
I want to trim left(6) and right(20) parts
My example is

'You can call on: 123456789 -thank you'

this is my string of which i want  only 123456789

IF(BEGINS(Info,'You can call on:  '),RIGHT(info,LEN(info) -15),
info))

This is giving me '123456789 -thank you'
I am struck with errors here.(If is not allowing me more than 3 conditions) Pointers please.
I am having a long text area field which has long information.
I am trying get one middle line,which is like this.

xxxxxxx
xxxxxxxx
xxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx




salesforce office:Working hours 
XXXXXXXXXXXXXX
XXXXXXXXXXXXX
XXXXXXXXXXXXXXXX


So i want to get everything after 'salesforce office: '

output in this case= 'working hours' This is dynamic value.

and save that it another text field.I am able to get that everything after office: but its not recognizing line break.


thats were i am struck..I am having other reasons to use apex trigger.So workflow or Builder doesnt work for me.
Any help?Thanks!!


 
We are using professional org.
Having a process builder which updates a field on some condition with formula type.

this is how the formula is ,i am using & between them.

I am having datetime field which is used in the update field but the format is being changed 


"Start Date:" & TEXT(DATETIMEVALUE([Opportunity].Date_Time_Start__c )) &
"End Date:" &TEXT([Opportunity].Date_Time_End__c ) &

This is the format i am looking for 
2/27/2018 4:00 PM

but this is how i am getting

2017-02-27 21:00:00Z 

How can i get this fixed?? 
 
We are using professional org.
Having a process builder which updates a field on some condition with formula type.

this is how the formula is ,i am using & between them.

I am having datetime field which is used in the update field but the format is being changed 


"Start Date:" & TEXT(DATETIMEVALUE([Opportunity].Date_Time_Start__c )) &
"End Date:" &TEXT([Opportunity].Date_Time_End__c ) &

This is the format i am lookinh for 
2/27/2018 4:00 PM

but this is how i am getting

2017-02-27 21:00:00Z 

How can i get this fixed?? 

 
I am having a VF page and class and test class.I am getting 43% code coverage.How can i increae it?
Below is my aoex class which gets value from user on VF page and creates account.

When i debug the test classs,i am not getting account.name value even though i gave a.name='testaccount' in my test class.
So i am able to cover those lines of code.Please help me what am i missing.
 
public class new_classforpage {
    Public customobjectt__c pr{get;set;}
    
    Public string accountname{get;set;}
    public string contactname{get;set;}
    public string contactemail{get;set;}
   
    public Account account {get;set;}


    public new_classforpage(ApexPages.StandardController sc) {
    pr= (object__c )sc.getRecord();
    account=new account();
    }
    
    Public pagereference save(){
     upsert pr;

    if(accountname!= '' && accountname!= null){
      
        account.name=accountname;
       
        upsert account;
        
        contact c=new contact();
        c.accountid=account.id;
        c.lastName=contactname;
        c.Email=contactemail;;
        insert c;
            
        pr.account_Name__c=account.id;
        update Pr;
    }
    
   return new PageReference('/'+pr.Id+'/e?retURL=%2F'+pr.Id);   
    }
}

and this is my test class:
 
@istest
Public class test_classforpage{
    static testMethod void test(){
        test.startTest();        
        PageReference pref = Page.mypage;
        Test.setCurrentPage(pref);
        
        
        Account a =new account();

        a.name='accountname';
       
        if(a.name!= '' && a.name!= null){

        upsert a;
        
        contact c=new contact();
        c.lastname='test contact';
        c.accountid=a.id;
        c.email='testemail@gmail.com';
        insert c;
        
        Purchase_request__c pr =new Purchase_request__c();
        pr.account_Name__c=a.id;
        
        insert pr;
        
        update pr;

        // Instantiate standard Controller
        ApexPages.StandardController sc = new ApexPages.StandardController(pr);

        // Instantiate controller extension
        myclass  mc = new myclass (sc);
                
        mc.save();
           test.stopTest();
}
     }
}


 
Hi,

i had build the package and all and ran the retrieve from command prompt.
I want custom fields to be retrived.So i had explicitly mentioned custom fields name in my package.xml file.
Like custom fields on standard objects .
But when i look at my retrived data,i dont see anything like that.
I am not able to conform that i got fields backed up.

I am scared to deploy again as i may loose the data.
Where can i find those data?Please point me regarding this.

Thanks in advance!!

 
I have a custom button which when clickd will execute a apex class.The whole logic is like this:
http://wiki.developerforce.com/page/The_Get_Next_Button#Quickstart:_The_Get_Next_Case_and_Get_Next_Lead_Button

I had customized this and using as per my req.This works perfect in sandbox where i just have test data.When moved to production where i have 500k records/leads i get the error TOO MANY DML ROWS:10001

Can any one please tell me what am i missing?
Do i need to bulkify my class still?
Please help ..
Below is my apex code:

global without sharing class RetrieveNextUtils {
    webService static Id retrieveNextLead(String userId){
  
    String RtID=null;   
    String query ='Select Id,Owner.name,status,Time_Zone__c from Lead where Status =\'new\' ';
    query=query+ ' and owner.Name= 'Queue'  FOR UPDATE';  //Locking statment as when two users click the button they are pulling same lead .
    try{
    List<Lead> leads = Database.Query(query); 
   
    for(integer i=0;i<leads.size();i++)
    {
        String tzname = leads[i].time_zone__c;
        String str_LeadCurrTime= DateTime.now().format('HHmm',tzname);
     
        if(str_LeadCurrTime >=  '0900' && str_LeadCurrTime <= '1145' || str_LeadCurrTime >= '1315' && str_LeadCurrTime <= '1700' )
        {   
             leads[i].OwnerId =UserInfo.getUserId();
             RtID=leads[i].Id;
             break;
         } 
   }
   update leads;
   return RtID;
   }
   Catch(exception ex){
        return RtID;
   }

}
}

Hello,

I am having a trigger on an Opportunity object(after update) which fires after the checkbox is selected and creates child objects.
I have this trigger to divide the total amount based on the number of days(start date to end date)

Everything works fine. Now I would like to update the child object records if the amount is changed and recalculate the amount and update the records.Debug logs shows the values correctly,but when i update list,i get error MISSING ARGUMENT ID
Below is my code.JUST THE UPDATE PART WHICH I AM DOING
 
trigger createprojects on Opportunity (after update) {
/****
other functions of trigger****/
    set<id> ids = new set<id>();  
               //Check if amount is changed
                if(oldOpp.Amount !=Opp.Amount__c && OPP.Amount__c != null)
                {
                    for(Opportunity op :trigger.new)
                    {
                        if (op.id != null) 
                        {
                            ids.add(op.id);

                        }
                    }
                    
                    for(Project__c plookup:[select id from Project__c where opportunity in :ids])
                    {
                        if(Opp.Start_Date__c != null && opp.End_date__c != null)
                        {
                        noOfMonths = Opp.Start_Date__c.monthsBetween(Opp.End_date__c); 
                        }
                        if(noOfMonths != Null & noOfMonths > 0)
                        {
                           Integer startMonth = Opp.Start_Date__c.month();
                           Date startDate = Opp.Start_Date__c;
                           Date endDate = OPP.Start_Date__c; 
                           for(Integer i = 0; noOfMonths >= i; i++)
                            {    
                        Project__c pro =new Project__c();
                            if(i > 0)
                            {
                            Date endD = endDate;
                            startDate = endD.addDays(1);
                            }
                            Date strD = startDate;

                            if(Opp.Amount !=null &&opp.Amount__c >0){
                            Integer dINM = date.daysInMonth(startDate.year(), (i < 0?(strD.month()+1):startDate.month()));

                            endDate = Date.newInstance(startDate.year(), startDate.month(), dINM);

                            Date eD= (i > 0)?(endDate > Opp.End_date__c?Opp.End_date__c:endDate):endDate;     

                            Integer noOfDays = startDate.daysBetween(ED)+1; 

                            pro.Name='Pro-'+startdate;
                            Pro.opporunity__c = Opp.id;
                            pro.Start_Date__c = startDate;
                            pro.End_Date__c = (i > 0)?(endDate > Opp.End_date__c?Opp.End_date__c:endDate):endDate;

                            pro.Opportunity = Pro.id;
                            pro.NumberofDays__c=noofdays;
                           pro.Plan_Amount__c=Opp.Amount/Opp.Project_Duration_CD__c*noofdays;
                            projectlistupdate.add(pro);
                            }
                        }          
                    }
               }  
              
    if(projectlistupdate.size() >0){
    update projectlistupdate;
    }
   }           
//    Insert projectlist;
    } 
}

 
Hi

I am having an after update trigger which fires when a checkbox is set to true. It then creates records in the related object.
After creating(after trigger functionality is implemented), I want to make the checkbox again as false programmatically. How can I achieve this?
I tried to make it false after building the list, but I am facing Read only error.

Thanks
String level ='Top';
String query='select id,Custompicklist__c  from Contact';

 if(Roleslist.size() >0){
        for(Integer i =0; i<roles.size();i++){
            if(i==0){
             query +=' where account.Active__c=true and custompicklistfield__c=:level and roles__c INCLUDES (\''+roleslist[0]+'\'';    
            }else{
            query += ',\''+roleslist[i]+'\'';
            }
           } 
                query += ')' limit 3;     
        }
        c=database.query(query);


THIS BRINGS CONTACT IDs of CONTACTS WHOSE LEVEL IS SET TO HIGH. BUT WHEN the field is set to a null or different value, then the query goes wrong and fetches 0 records.

 
Having a trigger to fire when a value is changed.
On update of the field, it should consider multi-select picklist values(List of roles-As it's multi-select datatype, may have one role is chosen or multiple chosen) and use them in a query to contact(Multi-select picklist field). Further, I would like to use those contact ids to create records in another custom object.
I saved the roles on record(trigger.new) into a list. But when I try to query to contact, I am not able to get the values.

For instance,
Values on Record 1-
checkbox -checked to true(which fires trigger)
Roles- Manager; Owner; Supervisor

Contact records-
contact 1-
Roles :Manager;Supervisor
Contact 2-
Roles-Owner
Contact 3:
roles-Manager;Architect
Contact 4-
Roles-Manager
Contact 5-
Roles: Analyst;Architech

In the above example, I would like to get all the contact IDs except contact 5. I even want Contact 3 even his roles include Architect which is not in our record roles list. As he is having a manager role, I would like to collect it too.

I used 
conroles=[select id,Roles__c,Title from contact where Roles__c IN :Roleslist];
Roleslist=List of roles on Record.
But its only fetching first roles contact's.

Split(',') doesn't seem to work, What am I doing wrong?
My use case- Custom object linkedcontacts__c with Master detail relations on contact and customobject2__c objects.
Having two multi-select picklist fields on both the objects, Named as Roles.
I am having a trigger on customobject2 which fires when a field is changed, then I am trying to get those multi-select field values(roles) and check against contact roles, and link the related contacts.
My major issue is as they are multi-select values if multiple roles are chosen then how can I achieve this??

For instance, if I am having a CB2 record with roles director; manager, I should be able to query those contacts whose roles are director or manager or director and manager(if any) and should relate by inserting record in the linkedcontact__c object. 
Please guide me.Thank you.
 
Created a custom object on record detail page.VF page will search records by using query in controller.
It has a input field and holds search text.I want to have more flexibity with the search text.It is being filled with value from record field.Like name of record.But i would like to give user to change the search text if he wants and still fit in the query.Like dynamic text field.
It has to work two ways,value from standard field and also should work if user chnages the value and give new value.Please help.
 
I am changing one particular  field by checking lastmodifeddate in my code.All works fine but i am struck with test class.I am chnaging multiple records from multiple objects so my batch class looks like below.
 
global class editrecords implements Database.Batchable<string>, Schedulable{
global boolean bool = false;

global Iterable<string> start(Database.BatchableContext ctx) {
    return new list<String> { 'CO__c', 'CO2__c', 'CO3__c','CO4__c'};
}
global void execute(Database.BatchableContext ctx, list<string> listObj) {
    list<sObject> editrecords = new list<sObject>();
    for(string strObjName : listObj) {
        for(sObject objsObject : database.query('Select Id from ' + strObjName + ' where LastModifiedDate < LAST_N_DAYS:36')) {
                editrecords.add(objsObject);
            else {
                b = true;
                break;
            }
        }
    }
    update editrecords;
}
global void finish(Database.BatchableContext ctx) {

}        global void execute(SchedulableContext sc){
         Database.executebatch(new editrecords ());    
    }
}

my test class is as below which get 58% of coverage.How can i get lastmodified date and cover rest of code.please help.
 
@isTest
Public class testeditrecords{

    static testMethod void testMethod1(){

        CO__c CO =new CO__c(Name='testdata');
        insert CO;
        CO2__c co2 =new 
  co2__c(Name='testdata');
        insert co2;
        Co3__c co3 =new Co3__c(Name='test2');
        insert co3;

       for(CO__c c:[Select ID from CO__c where createddate=TODAY]){
        Test.startTest();
       
        editrecords obj = new editrecords();
        Database.executeBatch(obj);
        Test.stopTest();       
        }
   } 
}

 
I am using a Workflow field update and having IF conditions in it.
I want to trim left(6) and right(20) parts
My example is

'You can call on: 123456789 -thank you'

this is my string of which i want  only 123456789

IF(BEGINS(Info,'You can call on:  '),RIGHT(info,LEN(info) -15),
info))

This is giving me '123456789 -thank you'
I am struck with errors here.(If is not allowing me more than 3 conditions) Pointers please.